variable filter-list item

Discussion of Common Lisp
Post Reply
sergiowow
Posts: 2
Joined: Thu Sep 20, 2018 7:52 am

variable filter-list item

Post by sergiowow » Thu Sep 20, 2018 8:04 am

I actually find a block in a drawing with :

(setq ss (ssget "_X" '((2 . "blockname"))))

But I want the blockname to be a variable.

So I want to do :
(setq a "blockname") and then
(setq ss (ssget "_X" '((2 . a)))).
But this do not work. I tries : (list a), (setq a) but that doesn't work either
thanks

pjstirling
Posts: 166
Joined: Sun Nov 28, 2010 4:21 pm

Re: variable filter-list item

Post by pjstirling » Sat Sep 22, 2018 1:14 am

Because you are using single-quote (') your A symbol is not being evaluated.

Try using back-quote instead:

Code: Select all

(setq ss (ssget "_X" `((2 . ,a)))).

edgar-rft
Posts: 226
Joined: Fri Aug 06, 2010 6:34 am
Location: Germany

Re: variable filter-list item

Post by edgar-rft » Sun Sep 23, 2018 8:46 am

A version without backquote would look like:

Code: Select all

(setq ss (ssget "_X" (list (cons 2 a))))

sergiowow
Posts: 2
Joined: Thu Sep 20, 2018 7:52 am

Re: variable filter-list item

Post by sergiowow » Mon Sep 24, 2018 5:08 am

Thanks Edgar, that work

Post Reply