variable filter-list item

Discussion of Common Lisp

variable filter-list item

Postby 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
sergiowow
 
Posts: 2
Joined: Thu Sep 20, 2018 7:52 am

Re: variable filter-list item

Postby 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)))).
pjstirling
 
Posts: 159
Joined: Sun Nov 28, 2010 4:21 pm

Re: variable filter-list item

Postby 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))))
edgar-rft
 
Posts: 226
Joined: Fri Aug 06, 2010 6:34 am
Location: Germany

Re: variable filter-list item

Postby sergiowow » Mon Sep 24, 2018 5:08 am

Thanks Edgar, that work
sergiowow
 
Posts: 2
Joined: Thu Sep 20, 2018 7:52 am


Return to Common Lisp

Who is online

Users browsing this forum: No registered users and 8 guests

cron