As seen in a previous post [found here] which removes all XREFs in a drawing, the featured routine today only removes any pictures that are in the drawing. As seen in the animated picture below, there are .bmp and .jpg formated pictures in the drawing.
Here’s how:
REMOVEALLPICS <enter> to start
That’s it…
(defun RemoveAllRaster ( doc / _catchapply dict lockd ) (vl-load-com) (defun _catchapply ( method params / result ) (if (not (vl-catch-all-error-p (setq result (vl-catch-all-apply method params)) ) ) result ) ) (vlax-for layer (vla-get-layers doc) (if (eq :vlax-true (vla-get-lock layer)) (vla-put-lock (car (setq lockd (cons layer lockd))) :vlax-false) ) ) (vlax-for block (vla-get-blocks doc) (vlax-for object block (if (member (vla-get-objectname object) '("AcDbOle2Frame" "AcDbRasterImage")) (_catchapply 'vla-delete (list object)) ) ) ) (if (setq dict (_catchapply 'vla-item (list (vla-get-dictionaries doc) "ACAD_IMAGE_DICT"))) (progn (vlax-for object dict (_catchapply 'vla-delete (list object)) ) (_catchapply 'vla-delete (list dict)) ) ) (if (setq dict (_catchapply 'vla-item (list (vla-get-dictionaries doc) "ACAD_IMAGE_VARS"))) (_catchapply 'vla-delete (list dict)) ) (foreach layer lockd (vla-put-lock layer :vlax-true)) (vla-regen doc acallviewports) (princ) ) (defun c:RemoveAllPics nil (RemoveAllRaster (vla-get-activedocument (vlax-get-acad-object))) (princ) ) (vl-load-com)