Jump to content
Jakub

Selecting layers by its name

Recommended Posts

Jakub

Hi,

 

I'm searching a lisp that selecting layers by them name. As an example I give some names:

 

AAA_BBB_xxx

AAA_BBB_xxy

AAA_BBB_xyz

 

I need to select all layers that names start as AAA_BBB. The third part of name is changing. In this case I'd like to select only this layers that name has AAA_BBB. How can I do this?

 

Thank you for any suggestions in advance.

Jakub

Share this post


Link to post
Share on other sites
Tharwat

Try.

 

(setq sel (ssget "_:L" '((8 . "AAA_BBB*"))))

Share this post


Link to post
Share on other sites
BIGAL

Do you need a lisp ?

 

FILTER, select object, edit layer name, AAA_BBB* selects all layers that start with AAA_BBB

Share this post


Link to post
Share on other sites
BIGAL

2nd suggestion pick object then "how many characters to match" for above its 7 then substr and use Tharwats suggestion.

 

; bit rough but for testing
(setq obj (vlax-ename->vla-object (car (entsel))))
(setq lay (vla-get-layer obj) )
(alert (strcat "You have picked layer " lay "Enter number of characters next step"))
(setq num ("Enter number of characters"))
(setq str (strcat (substr lay 1 num) "*" ))
(setq sel (ssget "_:L" (list (cons 8 str))))

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×