OriginalRob2 Posted Monday at 01:28 PM Posted Monday at 01:28 PM Hi I found the lisp below, it looks like it could do what I want but I can't see how to change it to remove unreferenced PDF underlays, any advice please? https://www.cadtutor.net/forum/topic/96952-lisp-to-remove-unreferenced-xref/#comment-664904 ;; PurgeImages.lsp by Trevor Bird ;; Removes Unreferenced Images ;; 2021-02-20 ;;------------------------------------------------------------------------------ (defun purgeimages ( / ACAD_IMAGE_DICT__dxf ACAD_IMAGE_DICT__ename ACAD_REACTORS__dxf assoc_330 count_imagedef count_imageref count_purged dps_3 dps_330 entity_dxf entity_ename entity_type imagedef_dxf imagedef_ename ImageFile imageref_dxf imageref_ename list_ImageNames ) (setq count_purged 0) (cond ( (not (setq ACAD_IMAGE_DICT__dxf (dictsearch (namedobjdict) "ACAD_IMAGE_DICT")))) ( (not (setq ACAD_IMAGE_DICT__ename (cdr (assoc -1 ACAD_IMAGE_DICT__dxf))))) ;; dps_3 = xrecord names = image names ( (not (setq dps_3 (vl-remove-if-not '(lambda ( _dp ) (= (car _dp) 3)) ACAD_IMAGE_DICT__dxf)))) ;; List of xrecord names = list of image Names ( (not (setq list_ImageNames (mapcar 'cdr dps_3)))) (list_ImageNames (foreach fe__ImageName list_ImageNames (setq imagedef_dxf (dictsearch ACAD_IMAGE_DICT__ename fe__ImageName) imagedef_ename (cdr (assoc -1 imagedef_dxf)) ImageFile (cdr (assoc 1 imagedef_dxf)) );setq (cond ( (not (setq ACAD_REACTORS__dxf (member '(102 . "{ACAD_REACTORS") imagedef_dxf)))) ( (not (setq ACAD_REACTORS__dxf (reverse (member '(102 . "}") (reverse ACAD_REACTORS__dxf))) dps_330 (vl-remove-if-not '(lambda ( _dp ) (= (car _dp) 330)) ACAD_REACTORS__dxf) );setq );not ); (dps_330 (setq count_imagedef 0 count_imageref 0 );setq (foreach fe__dp dps_330 (setq entity_ename (cdr fe__dp) entity_dxf (entget entity_ename) entity_type (cdr (assoc 0 entity_dxf)) );setq (cond ( (not (= entity_type "IMAGEDEF_REACTOR"))) ( (not (setq count_imagedef (1+ count_imagedef)))) ;; 330 - Object ID for associated image object (image reference) ( (not (setq assoc_330 (assoc 330 entity_dxf)))) (assoc_330 (setq imageref_ename (cdr assoc_330) imageref_dxf (entget imageref_ename) );setq (cond ( (not imageref_dxf) ;; Image reference was deleted. );(not imageref_dxf) (imageref_dxf (setq count_imageref (1+ count_imageref)) );imageref_dxf );cond );assoc_330 );cond );fe__dp (if (zerop count_imageref) (progn ;; Delete image definition xrecord. (setq count_purged (1+ count_purged)) (entdel imagedef_ename) (dictremove ACAD_IMAGE_DICT__ename fe__ImageName) (princ "\nDeleting image ") (prin1 fe__ImageName) (princ ".") );progn );if );dps_330 );cond` );fe__ImageName );list_ImageNames );cond (cond ( (not (zerop count_purged)) (princ "\n") (prin1 count_purged) (if (> count_purged 1) (princ " images ") (princ " image ") );if (princ "deleted.") );(not (zerop count_purged)) ( (zerop count_purged) (princ "\nNo unreferenced images found.") );(zerop count_purged) );cond (princ) ) ;c:purgeimages Quote
Saxlle Posted yesterday at 10:55 AM Posted yesterday at 10:55 AM You can try with Drawing Purge from autodesk app store, it's free. 1 Quote
SLW210 Posted yesterday at 11:01 AM Posted yesterday at 11:01 AM RadicalPurge | AutoCAD | Autodesk App Store 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.