SSGET "X" formatting

SSGET "X" formatting

dplumb_BWBR
Advisor Advisor
885 Views
5 Replies
Message 1 of 6

SSGET "X" formatting

dplumb_BWBR
Advisor
Advisor

Can anyone tell me why this fails

_$ (setq PLineSS (ssget "x" '((-4 . "<AND") (0 . "LWPOLYLINE") (CONS 8 "AC*") (-4 . "AND>"))))
; error: bad SSGET list

 

and this works?
_$ (setq PLineSS (ssget "x" '((-4 . "<AND") (0 . "LWPOLYLINE") (8 . "AC*") (-4 . "AND>"))))
<Selection set: 2e>

 

If I do (CONS 8 "AC*") all by itself, it returns (8 . "AC*"), so it seems the same to me.

 

TIA

 

0 Likes
886 Views
5 Replies
Replies (5)
Message 2 of 6

scot-65
Advisor
Advisor
When CONStructing a dotted pair, one cannot 'Quote.
One must use (LIST...

(LIST (-4 . "<AND") (0 . "LWPOLYLINE") (CONS 8 "AC*") (-4 . "AND>"))

???

Scot-65
A gift of extraordinary Common Sense does not require an Acronym Suffix to be added to my given name.

0 Likes
Message 3 of 6

cadffm
Consultant
Consultant

(setq PLineSS (ssget "x" '((-4 . "<AND") (0 . "LWPOLYLINE") (CONS 8 "AC*") (-4 . "AND>"))))
evaluate by the first step to

(setq PLineSS (ssget "x" '((-4 . "<AND") (0 . "LWPOLYLINE") (CONS 8 "AC*") (-4 . "AND>"))))

because you quote the list - Your apostroph after "x" mean that "do nothing inside the following argument/list

and (CONS 8 "AC*")  isn't a valid item for a filter list.

 


(setq PLineSS (ssget "x" '((-4 . "<AND") (0 . "LWPOLYLINE") (8 . "AC*") (-4 . "AND>"))))

evaluate by the first step to

(setq PLineSS (ssget "x" '((-4 . "<AND") (0 . "LWPOLYLINE") (8 . "AC*") (-4 . "AND>"))))

because you quote the list - Your apostroph after "x" mean that "do nothing inside the following argument/list

and (8 ". AC*")  is a valid item for a filter list.

 

 take a look:

 

(setq PLineSS (ssget "x" (list '(-4 . "<AND") '(0 . "LWPOLYLINE") (cons 8 "AC*") '(-4 . "AND>"))))
in this case not very useful, but this is how it works.
 
 
 
(defun SL (lay)
..
  (ssget "_X" (list '(-4 . "<AND") '(0 . "LWPOLYLINE") (cons 8 lay) '(-4 . "AND>"))))
..
)
 
 

 

 

Sebastian

0 Likes
Message 4 of 6

Kent1Cooper
Consultant
Consultant

In addition to using the explicit (list) function instead of the (quote) [ ' ] function when there's something requiring evaluation in the list, in this case you don't need the (cons) function [and therefore don't even need the explicit (list) function], and  you don't need the <AND> wrapping.  You should be able to do just this:

 

(setq PLineSS (ssget "_X" '((0 . "LWPOLYLINE") (8 . "AC*"))))

Kent Cooper, AIA
0 Likes
Message 5 of 6

Kent1Cooper
Consultant
Consultant

@Kent1Cooper wrote:

....  You should be able to do just this:

(setq PLineSS (ssget "_X" '((0 . "LWPOLYLINE") (8 . "AC*"))))


 

Now, if [for example] the "AC" part of the beginning of Layer names was something that would vary  in different usage, and was stored in a variable  established by asking the User, or by picking on an object on a Layer whose name starts with the letter combination you're after and extracting that Layer name start, then  you would need to do some evaluating/operations to combine that Layer-name beginning with an asterisk to catch all following Layer name content, and to "consociate" that string with an 8 to apply it for Layer names, and therefore you would need the (cons) and the explicit (list) function, like this [with LayerNameStart being the variable name]:

 

(setq PLineSS (ssget "_X" (list (0 . "LWPOLYLINE") (cons 8 (strcat LayerNameStart "*")))))

Kent Cooper, AIA
0 Likes
Message 6 of 6

dplumb_BWBR
Advisor
Advisor

Thanks! That did the trick.

It's been a while since I did any serious LISPing.

I've forgotten some of the intricacies.

 

0 Likes