I would like to do something like
(if (setq SS (ssget "X" (list (cons 0 "INSERT") (cons 2 "TOBY") (cons 2 "MANI")))) )
where the selection set SS includes any instance of the block "TOBY" and "MANI"
my code isn't working where am I going wrong?
This should work (untested)
(ssget "x" '((0 . "insert")(2 . "TOBY,MANI")))
not including the if and setq.
Wildcards are also supported (if I remember correctly). There is no need to use CONS unless you have a symbol that needs to be evaluated.
Hi Richie,
The reason that your original code does not work is because the ssget filter list employs an implicit AND operator when evaluating each item to return a match.
Hence, in your code, the selection was attempting to find an INSERT entity with DXF group 2 (block name) containing the value TOBY and containing the value MANI - this is of course impossible since DXF group 2 can only hold one of these values.
In the code supplied by dbroad, the ssget fitler list is using a wildcard pattern to match either TOBY or MANI as the value of DXF group 2. This is possible where string valued groups are concerned as ssget will permit the use of wildcards; for groups using different data types (such as DXF group 40, for example), logical operators (such as '(-4 . "<OR") (-4 . "OR>") can be used - my ssget function reference provides some examples of these.
Lee