TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Grrr1337 on March 10, 2020, 03:28:19 AM
-
Hey guys,
Currently I've got this working -
(defun AvoidHatches:CB
(rtr args
/ L
)
(
); repeat
); and
L
); if
); lambda
)
); setq L
(
(ssadd (vlax
-vla
-object
->ename o
) nSS
) ); foreach
); lambda
L
)
); and
); defun
But I am aware that my callback function might not be the faster way.
Can you come up with some alternatives that would be better? - to select anything else but the "HATCH" entities from the implied selection.
-
I don't know if I understand the question correctly ... perhaps the easiest way is the fastest:
(setq NewSSt (ssadd))
(repeat (setq i (sslength SS))
(or
(= "HATCH" (cdr (assoc 0 (entget (setq EntNam (ssname SS (setq i (1- i))))))))
(setq NewSSt (ssadd EntNam))
)
)
-
Currently I've got this working -
you've noticed that your function is 'recursive'?
the purpose of you filtering is unclear to me
why don't you want to use (ssget "_I" (list (cons 0 "~HATCH"))) ?
-
Changing the pickfirst selection within a function evaluated when the pickfirst selection is changed is never a good idea :evil:
-
Also consider that a selection set can contain sub-entities.
-
Currently I've got this working -
you've noticed that your function is 'recursive'?
the purpose of you filtering is unclear to me
why don't you want to use (ssget "_I" (list (cons 0 "~HATCH"))) ?
Hi,
The point is while constantly selecting to filter out the hatch objects - the key is in lines 13. and 14.
"Recursion" stops when no acDbHatch objects are contained within the current selection.
My question was is if I could avoid the SS iteration in the 1st place - my callback function seems to be clumsy.
I don't know if I understand the question correctly ... perhaps the easiest way is the fastest:
(setq NewSSt (ssadd))
(repeat (setq i (sslength SS))
(or
(= "HATCH" (cdr (assoc 0 (entget (setq EntNam (ssname SS (setq i (1- i))))))))
(setq NewSSt (ssadd EntNam))
)
)
Thanks! I've got used with these lists that I've forgot I could just rebuilt the new SS within the iteration of the original SS. :uglystupid2:
-
Thanks! I've got used with these lists that I've forgot I could just rebuilt the new SS within the iteration of the original SS. :uglystupid2:
Well come on is not really a big flaw! 8-) (Google Transl.)