select xrefs in drawing by name with wildcards

select xrefs in drawing by name with wildcards

Anonymous
Not applicable
2,124 Views
4 Replies
Message 1 of 5

select xrefs in drawing by name with wildcards

Anonymous
Not applicable

I am looking for a lisp routine to select xrefs in a drawing by name, using wildcards.  For instance, depending on the floor, the xref would have the name "x-FLOOR 09" or "x-FLOOR 08", etc.  The wild card name specification would be "x-FLOOR*" and it would be used in a script to assign those xrefs to a specific layer. 

 

Is such a lisp routine possible?

0 Likes
2,125 Views
4 Replies
Replies (4)
Message 2 of 5

Kent1Cooper
Consultant
Consultant

Welcome to these Forums!

 

Xrefs are INSERT objects, with their names stored in the (assoc 2) slot in entity data, like Blocks, and (ssget) honors wildcards.  This should find them:

(setq YourSelectionSetVariable (ssget "_X" '((0 . "INSERT") (2 . "x-FLOOR*")))

 

[That assumes that you don't have any ordinary Blocks in the drawing with names that fit that pattern.  If you might, it is possible to have a routine do whatever it does to only the Xrefs out of what it finds.]

 

Do you need help getting something to put them on the Layer you want, or was it just the selection you were asking about?

Kent Cooper, AIA
0 Likes
Message 3 of 5

Anonymous
Not applicable

Thanks for this.  I will try to test this out shortly and let you know if i need anything further.

0 Likes
Message 4 of 5

Anonymous
Not applicable

Can you please help me with understanding this line better?
(setq YourSelectionSetVariable (ssget "_X" '((0 . "INSERT") (2 . "x-FLOOR*")))

 

YourSelectionSetVariable = xref name that matches wildcard content?

And if "x-FLOOR*" is wildcard content, what is "_X"??

 

Thanks

0 Likes
Message 5 of 5

cadffm
Consultant
Consultant

Read the help to SSGET (AutoLISP)

The underline is just for international command/option the the X stand for Entire Database, without userinput.

 

https://help.autodesk.com/view/ACD/2020/ENU/?guid=GUID-0F37CC5E-1559-4011-B8CF-A3BA0973B2C3

 

Sebastian