Joseph
Guest
just to widen the scope of possible solutions, as I did in the first "posts", I inserted the lambda function inside vlax-map-collection instead of vlax-for.
(defun c:del-lay1 ()
(vl-load-com)
(setq layers (vla-get-layers))
(vlax-map-collection layers '(lambda (x) (if (/= (vl-string-search "ec" (vla-get-name x)) nil)
(vla-delete x)))
)
-----
with regard to the assignment of variables, personally during the drafting of the code I check them independently, especially because this facilitates the operation of "debug"; only in the vers. I try to eliminate them to the limit of comprensibility.
the fact that the assignment occupies more memory was a problem with the machines of twenty years ago; Moreover, declaring them as premises, at the end of the execution their allocation is emptied and still available.
(defun c:del-lay1 ()
(vl-load-com)
(setq layers (vla-get-layers))
(vlax-map-collection layers '(lambda (x) (if (/= (vl-string-search "ec" (vla-get-name x)) nil)
(vla-delete x)))
)
-----
with regard to the assignment of variables, personally during the drafting of the code I check them independently, especially because this facilitates the operation of "debug"; only in the vers. I try to eliminate them to the limit of comprensibility.
the fact that the assignment occupies more memory was a problem with the machines of twenty years ago; Moreover, declaring them as premises, at the end of the execution their allocation is emptied and still available.