@braudpat wrote:
Hello @ronjonp
1) Thanks for your routine !
2) Please I would like a version 1.1 ...
Use standard ACAD selection ... I don't want to "filter" ALL Blocks !
THE HEALTH, Regards, Patrice
Try this:
(defun c:foo (/ a b d n r s)
;; RJP » 2020-12-03
(if (setq s (ssget '((0 . "INSERT"))))
(progn (vlax-for l (vla-get-layers (setq d (vla-get-activedocument (vlax-get-acad-object))))
(cond ((= -1 (vlax-get l 'lock)) (vlax-put l 'lock 0) (setq a (cons l a))))
)
(setq b (vla-get-blocks d))
(foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s)))
(or (vl-position (setq n (vla-get-effectivename (vlax-ename->vla-object e))) r)
(vlax-for o (vla-item b n)
(if (= (vla-get-objectname o) "AcDbPoint")
(vl-catch-all-apply 'vla-delete (list o))
)
)
)
(setq r (cons n r))
)
(foreach l a (vlax-put l 'lock -1))
(vla-regen d acallviewports)
)
)
(princ)
)
This still modifies the block definition so blocks outside of the selection set will change too. If you want just the blocks in the selset to change then the blocks would need to be converted to anonymous ( to make them unique ) then process .. but this is a bit messy IMO.