Delete unreferenced DataLinks?

Delete unreferenced DataLinks?

DC-MWA
Collaborator Collaborator
1,826 Views
5 Replies
Message 1 of 6

Delete unreferenced DataLinks?

DC-MWA
Collaborator
Collaborator

Hello,

Ronjonp helped me with a little routine to delete this pesky Datalink that kept showing up in our drawings.

I'm wondering if there is a way to delete all unreferenced Datalinks in a drawing.

Here is what the routine Ronjonp helped me with....

(defun c:foo (/ a b)
  ;; RJP » 2020-01-17
  ;; Delete MWA* datalinks
  (foreach e (setq a (dictsearch (namedobjdict) "ACAD_DATALINK"))
    (if	(and (= 3 (car e)) (wcmatch (strcase (setq b (cdr e))) "MWA*"))
      (progn (entdel (cdadr (member e a))) (print (strcat b " deleted...")))
    )
  )
  (princ)
)

Can this be modified to delete all unreferenced Datalinks?
Thank in advance for any input received.






0 Likes
1,827 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

hi i have found this code earlier

 

(dictremove (namedobjdict) "ACAD_DATALINK")

 

Regards,

Master From Lost Nalanda

 

0 Likes
Message 3 of 6

dlanorh
Advisor
Advisor

Perhaps THIS can help

I am not one of the robots you're looking for

0 Likes
Message 4 of 6

DC-MWA
Collaborator
Collaborator

This deletes all datalinks in the drawing. I do not want to delete all the datalinks. Only the unreferenced ones.

Thanks.

0 Likes
Message 5 of 6

DC-MWA
Collaborator
Collaborator

Dictedit does the trick, but it's hard to teach drafters to use let alone the fact that it accesses every dictionary in the drawing. I do not want the potential headaches of newby drafters messing with dictionaries.

thanks.

0 Likes
Message 6 of 6

cadman1965
Enthusiast
Enthusiast

THANKS FOR REPOSTING THIS !
I HAVE SEVERAL BLOCKS THAT ARE HAUNTED BY DATALINKS!

0 Likes