Code Red > AutoLISP (Vanilla / Visual)
Finding xrefs amongst the blocks
Hangman:
So, I was a wonder'n, is there any way of finding unwanted miscellaneous xrefs among needed xrefs and blocks inserted in a drawing?
I know the tblsearch puts xrefs and blocks into the same category, and I'm looking for a way to distinguish between xrefs and blocks so I can detach any unwanted xrefs and keep those I need. Unfortunately, the names of the unwanted xrefs are random so I can't be specific when searching those out.
I'm also trying to find a way to detach any undefined or unreferenced images, again, the names are random with the dwg.
Any ideas ???
MP:
I don't the benefit of free time right now to yack, but here's a couple of posts to get the gearrs turning --
Post 1
Post 2
Search around the swamp, there's tons here.
Good luck.
GDF:
--- Quote from: Hangman on April 13, 2006, 12:47:41 PM ---So, I was a wonder'n, is there any way of finding unwanted miscellaneous xrefs among needed xrefs and blocks inserted in a drawing?
I know the tblsearch puts xrefs and blocks into the same category, and I'm looking for a way to distinguish between xrefs and blocks so I can detach any unwanted xrefs and keep those I need. Unfortunately, the names of the unwanted xrefs are random so I can't be specific when searching those out.
I'm also trying to find a way to detach any undefined or unreferenced images, again, the names are random with the dwg.
Any ideas ???
--- End quote ---
This is not a standalone dialog routine, but if you want to go on a fishing trip, you can fish out what you need.
Gary
Binky:
I needed to sift the xref's out awhile back. I used TBLNEXT to cycle through all of theblock entities. I then tested for the presence of ASSOC code 1. If it was there then it's an xref, if not it's a block. Not sure how to tell between wanted and unwanted xref's but this will put them in front of you one at a time so you can evaluate them to your criteria.
(defun c:siftxref (/ entry xname xpath )
(while
(setq entry (tblnext "block" (not entry)))
(if (cdr (assoc 1 entry))
(progn
;;;whatever it was you wanted to do;;;
);_end progn
);_end if
);_end while
(princ));_end function
I can not speak to images. I have not messed with them at all.
Hope this helps some.
Hangman:
Binky, Thanks for the info. That's more or less what I was looking for, ASSOC code 1.
There are times we get architects dwgs with orphaned xrefs and other miscellaneous items that we have to manually search for. It's a nightmare. So I'm trying to find a way I can have a lisp search and detach any orphaned and/or nested xrefs within xrefs that they have attached to the dwgs.
I've still got to go search MP's referenced posts. Too busy to breathe at the moment.
Thanks again.
Navigation
[0] Message Index
[#] Next page
Go to full version