MJLM 发表于 2022-7-5 23:34:16

ssget using entity type & poin

I have this expression
 
(setq myvar (ssget "X" '((0 . "LINE") (10 5 3 2))))
 
It makes a selection of all lines starting from this point x=5, y=3, z=2.
However when I get the values of 5,3,2 from an other command as variables e.g
 
(setq a 5 b 3 c 2)
 
the following gives me error "bad ssget list"
 
(setq myvar (ssget "X" '((0 . "LINE") (10 a b c))))
 
Would it be possible to avoid this and have the selection based on xyz points as variables rather than fixed known values?

David Bethel 发表于 2022-7-6 00:05:17

The quote ' makes an expression literal ( not evaluated )
 
Try
(setq myvar (ssget "X" (list (cons 0 "LINE")(cons 10 (list a b c)))))
 
or

(setq myvar (ssget "X" (list (cons 0 "LINE")(list 10 a b c))))
 
-David

MJLM 发表于 2022-7-6 00:19:04

Thank you.

Lee Mac 发表于 2022-7-6 00:34:45

Further to David's excellent suggestion, here is a tutorial explaining why the quote cannot be used when there are expressions to be evaluated: The Apostrophe & Quote Function
页: [1]
查看完整版本: ssget using entity type & poin