
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm after a method of selecting all dynamic blocks in the current space so I can delete them programmatically - obviously the name of the block will need to be added to the lisp.
I've managed to find this code from CADTutor but it requires the selection of one instance first.
Would anyone know either what can be changed in this code or maybe have an alternative that selects all versions without a pick first?
Many thanks in advance.
(defun c:sb (/ e name n out ss x rjp-getblockname)
(vl-load-com)
(prompt "\n Pick BLOCK to acquire its instances in the drawing...")
(defun rjp-getblockname (obj)
(if (vlax-property-available-p obj 'effectivename)
(vla-get-effectivename obj)
(vla-get-name obj)
)
)
(if (setq x (ssget '((0 . "INSERT")))
x (ssname x 0)
name (rjp-getblockname (vlax-ename->vla-object x))
ss (ssget "_X" '((0 . "INSERT")))
n -1
out (ssadd)
)
(while (setq e (ssname ss (setq n (1+ n))))
(if (= (rjp-getblockname (vlax-ename->vla-object e)) name)
(ssadd e out)
)
)
)
(sssetfirst nil out)
(princ)
)
Solved! Go to Solution.