Choose objects in current layer with ssget.

Choose objects in current layer with ssget.

davidlanesmith673
Enthusiast Enthusiast
871 Views
5 Replies
Message 1 of 6

Choose objects in current layer with ssget.

davidlanesmith673
Enthusiast
Enthusiast

I am having some trouble with the ssget function. I want to just select objects within the curent active layer, but it isn't working. If I input the name manually then the code works.

 

(setq ss (ssget "WP" box '((-4 . "<AND") (-4 . "<OR") (0 . "TEXT") (0 . "LWPOLYLINE") (-4 . "OR>") (8 . "Road Points") (-4 . "AND>"))))

 

But when I replace the layer name by a variable, it says error: bad SSGET list value

 

(setq curLay (getvar "clayer"))

(setq ss (ssget "WP" box '((-4 . "<AND") (-4 . "<OR") (0 . "TEXT") (0 . "LWPOLYLINE") (-4 . "OR>") (8 . curLay) (-4 . "AND>"))))

 

Is there a way to get this to work, so I only select objects in the current layer?

0 Likes
Accepted solutions (1)
872 Views
5 Replies
Replies (5)
Message 2 of 6

pbejse
Mentor
Mentor
Accepted solution
(setq ss (ssget	"WP"
		box
		(list '(-4 . "<AND")
		      '(-4 . "<OR")
		      '(0 . "TEXT")
		      '(0 . "LWPOLYLINE")
		      '(-4 . "OR>")
		      (cons 8 curLay)
		      '(-4 . "AND>")
		)
	 )
)
0 Likes
Message 3 of 6

pbejse
Mentor
Mentor

Oops, wrong thread 🙂

 

I attached a lsp file here that was intended here

 

0 Likes
Message 4 of 6

davidlanesmith673
Enthusiast
Enthusiast

Yah that works thanks! Could you explain why that works and mine doesn't? Why do you need list plus an apostrophe before each entry except for when cons is used?

0 Likes
Message 5 of 6

pbejse
Mentor
Mentor

@davidlanesmith673 wrote:

Yah that works thanks! Could you explain why that works and mine doesn't? Why do you need list plus an apostrophe before each entry except for when cons is used?


Good for you @davidlanesmith673 , glad it helps

The Apostrophe and the Quote Function saves me time to explain 🙂

 

0 Likes
Message 6 of 6

davidlanesmith673
Enthusiast
Enthusiast

Thank you, that is very helpful!

0 Likes