sadhu Posted October 11, 2010 Posted October 11, 2010 (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 October 11, 2010 by sadhu Quote
David Bethel Posted October 11, 2010 Posted October 11, 2010 [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 Quote
jammie Posted October 11, 2010 Posted October 11, 2010 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 Quote
sadhu Posted October 11, 2010 Author Posted October 11, 2010 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_*") ))) Quote
iconeo Posted September 15, 2014 Posted September 15, 2014 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>") ) ) Quote
BIGAL Posted September 16, 2014 Posted September 16, 2014 Also last but not least (cons 8 "RH_D1,RH_d2,RH_D3") Quote
sadhu Posted September 16, 2014 Author Posted September 16, 2014 if you tried this (setq ss (ssget (list (cons 8 "LAY,LAY2,LAY3")))) It should have worked. Quote
Lee Mac Posted September 16, 2014 Posted September 16, 2014 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"))) Quote
iconeo Posted September 16, 2014 Posted September 16, 2014 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. Quote
BIGAL Posted September 17, 2014 Posted September 17, 2014 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. Quote
Recommended Posts
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.