TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: David Bethel on November 30, 2017, 07:34:47 AM
-
Morning,
I'm wanting to select a single anonymous INSERT and then select additional INSERTs without highlighting the previous selection
defun c:foo
(/ en ss as en ed bn
) (and (princ "\nSelect Main WCS Anonymous Block To Add To...")
(princ "\nSelect INSERTs To Add...") ))))
I've tried all kinds of filter / syntax without any luck
(cons 2 (strcat "~" bn))
(cons 2 (strcat "~`" bn))
Any suggestions
( there will be additional filters on the adding picks )
TIA -David
-
Hi,
Try like this:
Note the dxf code is -4 instead of 4.
-
Thanks for the catching my typo
Sorry, but the "<NOT" filter doesn't work either
I'm sure it has to do with the leading asterisk in the block name
-David
-
Not a block name filter, but this seems to work:
(defun c:foo
(/ en ss as en ed p
) (and (princ "\nSelect Main WCS Anonymous Block To Add To...") )
)
)
(princ "\nSelect INSERTs To Add...") )
)
-
Hi David,
I don't have the time to test this at the moment, but could it be that when you are specifying the "bn" variable, you are re-referencing it from the selection, and the "*" in the block name is no longer escaped as in your original selection set? Perhaps (strcat "`" bn)?
I'm not sure if that will work. I don't know if the string when referenced from the ename is already escaped? I guess it wouldn't hurt to give it a try.
In any case Ronjonp's solution is probably a better choice (He posted while I was replying LOL).
-
finally figured it out :
(while (not as)
(princ "\nSelect INSERTs To Add...")
(setq as (ssget (list (cons 0 "INSERT")
(cons -4 "<NOT")
(cons 2 (strcat "`" bn))
(cons -4 "NOT>")
))))
Ron, with our system, ironically there can be multiple blocks inserted at the very same point ( a common origin point of an assembly )
Here the oven, dolly base RH open burner, salamander broiler and support shelf are all inserted and the same point.
Thanks! -Davod
-
Glad you got it sorted :) You could also just ssdel the ename from your second selection set too. I know it will get selected again, but not processed.
-
Ron,
That (ssdel) is exactly what I have been doing.
It is more visual thing. I don't want the main unit to be highlighted during the 2nd ssget selection call
-David
-
finally figured it out :
You're Welcome :-D