Was your issue with Unreferenced or Orphaned images resolved? I am having this problem also.
Today is your lucky day.
From help from other members in this community, many years ago, I have a block of code that will detach unreferenced images.
It is part of a comprehensive file maintenance program, therefore no defun statement.
;*** AUTOMATICALLY REMOVE ALL UNREFERENCED IMAGES *** 5-5-07 (if (and (setq dict (dictsearch (namedobjdict) "ACAD_IMAGE_DICT")) (assoc 350 dict) );and (progn (setq lst nil) (if (setq ss1 (ssget "X" (list (cons 0 "IMAGE")))) (progn (princ "\n Removing Unreferenced Images.") (setq n 0) (repeat (sslength ss1) (setq lst (cons (cdr (assoc 340 (entget (ssname ss1 n)))) lst) n (1+ n)) );repeat );progn );if (setq n nil) (while (setq n (tblnext "BLOCK" (not n))) (setq ss1 (cdr (assoc -2 n))) (while ss1 (if (= (cdr (assoc 0 (setq elst (entget ss1)))) "IMAGE") (setq lst (cons (cdr (assoc 340 elst)) lst)) );if (setq ss1 (entnext ss1)) );while );while (foreach n dict (if (and (= (car n) 350) (not (member (cdr n) lst))) (entdel (cdr n)) );if );foreach );progn );if (setq dict nil ss1 nil n nil lst nil elst nil)
As far as xref's, I do not have a similar program.
Hope this helps.
Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.
Hello From France
I am not a developper but I have a routine XD which detach automatically ALL UnReferenced XRefs from the current drawing !
Sorry I don't know who is the author !?
Loading with APPLOAD
Run with XD
Patrice BRAUD
braudpat,
I know that this is an old post but as we are still active in this community, I am very much hoping for some help. I have a PDFUNDERLAY that rests on a layer made for it. The PDFUNDERLAY is the only item on the layer named "DRAWING". I need to delete the PDF making it's status "UNREFERENCED", then I need to detach it so that I can delete the PDF from it's location in "\\Documents\\". This is so that I can re-render and attach the PDF for to be included with the etransmit package. I have no issues until I try to detach the PDFUNDERLAY. Even the "XD__Remove_UnReferenced_XREF.lsp" does nothing other than return "nil". I am at whit's end.
Anyone please help.
Thank you in advance for any suggestions and/or help.
I finally worked it out utilizing scot-65's code. I had to make just a few changes; here it is for anyone else hunting this information down.
(IF (AND (SETQ DICT (DICTSEARCH (NAMEDOBJDICT) "ACAD_PDFDEFINITIONS")) (ASSOC 350 DICT) ) ;and (PROGN (SETQ LST NIL) (IF (SETQ SS1 (SSGET "X" (LIST (CONS 0 "PDFUNDERLAY")))) (PROGN (PRINC "\n Removing Unreferenced PDFs.\n") (SETQ N 0) (REPEAT (SSLENGTH SS1) (SETQ LST (CONS (CDR (ASSOC 340 (ENTGET (SSNAME SS1 N)))) LST) N (1+ N) ) ) ;repeat ) ;progn ) ;if (SETQ N NIL) (WHILE (SETQ N (TBLNEXT "BLOCK" (NOT N))) (SETQ SS1 (CDR (ASSOC -2 N))) (WHILE SS1 (IF (= (CDR (ASSOC 0 (SETQ ELST (ENTGET SS1)))) "PDFUNDERLAY") (SETQ LST (CONS (CDR (ASSOC 340 ELST)) LST)) ) ;if (SETQ SS1 (ENTNEXT SS1)) ) ;while ) ;while (FOREACH N DICT (IF (AND (= (CAR N) 350) (NOT (MEMBER (CDR N) LST))) (ENTDEL (CDR N)) ) ;if ) ;foreach ) ;progn )
The above code is ONLY for DETACHING UNREFERENCED PDFUNDERLAYs. I am sure that it can be applied to the slew of XREFs but I only need this version.
Unfortunately, even though the above program does appear to detach the PDF, the file on disk is still locked and does not allow itself to be deleted. Can anyone see what I have missed?
Please help if you can.
Thank you in advance for any help / advice.
Fortunately, I have found a work-around solution. I do not need to detach and etransmit withing the same session. Therefore I can detach after each etransmit, that will allow for updating the PDFUNDERLAY as I need once per session.
If anyone else knows of a way to detach the unreferenced PDFUNDERLAY in a way that allows the PDF file to be deleted from it's location on HDD, then I am eager to hear it.
Sometimes we just have to work around Autodesk.
Thanks all.