Jump to content

Recommended Posts

Posted (edited)

I need to make a selection set of objects in three different layers (or layers with prefix "RH_".

What I have is this - it works when I specify only one layer.

 

How do I make a selection set of objects on multiple layers ?

 

(setq lay "RH_D-1")
(setq lay2 "RH_D-2")
(setq lay3 "RH_D-3")
 
(setq blklst (ssget (list (cons 0  "INSERT")
             (cons 8 lay)
             ;(cons 8 lay2)
             ;(cons 8 lay3)
             )))

thanks

Edited by sadhu
Posted

[b][color=BLACK]([/color][/b]setq ss [b][color=FUCHSIA]([/color][/b]ssget [b][color=NAVY]([/color][/b]list [b][color=MAROON]([/color][/b]cons -4 [color=#2f4f4f]"<OR"[/color][b][color=MAROON])[/color][/b]
                       [b][color=MAROON]([/color][/b]cons 8 [color=#2f4f4f]"LAY"[/color][b][color=MAROON])[/color][/b]
                       [b][color=MAROON]([/color][/b]cons 8 [color=#2f4f4f]"LAY2"[/color][b][color=MAROON])[/color][/b]
                       [b][color=MAROON]([/color][/b]cons 8 [color=#2f4f4f]"LAY3"[/color][b][color=MAROON])[/color][/b]
                     [b][color=MAROON]([/color][/b]cons -4 [color=#2f4f4f]"OR>"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

[b][color=BLACK]([/color][/b]setq ss [b][color=FUCHSIA]([/color][/b]ssget [b][color=NAVY]([/color][/b]list [b][color=MAROON]([/color][/b]cons 8 [color=#2f4f4f]"LAY,LAY2,LAY3"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

[b][color=BLACK]([/color][/b]setq ss [b][color=FUCHSIA]([/color][/b]ssget [b][color=NAVY]([/color][/b]list [b][color=MAROON]([/color][/b]cons 8 [color=#2f4f4f]"RH_*"[/color][b][color=MAROON])[/color][/b][b][color=NAVY])[/color][/b][b][color=FUCHSIA])[/color][/b][b][color=BLACK])[/color][/b]

 

 

The 1st 2 are about

 

The 3rd uses wildcards.

 

-David

Posted

Hi

 

There are probably a few different ways you can do it

 

Ssget accepts wild card search patterns (See wcmatch in the AutoCAD AutoLisp help files for list)

 

layers with prefix "RH_"

 

(setq blklst (ssget (list (cons 0  "INSERT")
             (cons 8 "RH_*")
             )))

 

objects in three different layers

 

(setq lay "RH_D-1")
(setq lay2 "RH_D-2")
(setq lay3 "RH_D-3")

(setq layfilter (strcat lay "," lay2 ","lay3))
 
(setq blklst (ssget (list (cons 0  "INSERT")
             (cons 8 layfilter)
             )))

 

There are also conditional statements you can use but either of the above should work

Posted

Thank you David.

Thank you Jammie.

 

Resolved my problem and learned a new trick too.

 

I choose this one:

 

  (setq blklst (ssget (list (cons 0  "INSERT") 
 (cons 8 "RH_*") )))

  • 3 years later...
Posted

I know I'm resurrecting an old thread but for the life of me I couldn't get any of these solutions to work.

 

I did get this to work though.

 

(ssget "X"  
 '(
   (-4 . "<OR")
       (8 . "OBJ03")
       (8 . "HIDDEN")
   (-4 . "OR>")
 )
)

Posted

if you tried this

(setq ss (ssget (list (cons 8 "LAY,LAY2,LAY3"))))

 

 

It should have worked.

Posted
I know I'm resurrecting an old thread but for the life of me I couldn't get any of these solutions to work.

 

I did get this to work though.

 

(ssget "X"  
 '(
   (-4 . "<OR")
       (8 . "OBJ03")
       (8 . "HIDDEN")
   (-4 . "OR>")
 )
)

 

This could also be:

(ssget "X" '((8 . "OBJ03,HIDDEN")))

Posted
This could also be:

(ssget "X" '((8 . "OBJ03,HIDDEN")))

 

Yea, I tried that but for some odd reason it didn't want to work. Maybe because I would using it from inside a script?

 

Anyways, thanks all for your input.

 

Thanks.

Posted

Sadhu this will not work "LAY,LAY2,LAY3" you can not use a lisp variable this looks for layers called lay Lay2 Lay3 see other post about using strcat to use variables.

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