Jump to content

Selecting layers by its name


Jakub

Recommended Posts

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

Link to comment
Share on other sites

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))))

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...