- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I found a lisp some years ago that prompts the user to pick a block and it selects all instances of the block wherever they exist in the drawing. This allows the user to select different visibility states, change common attributes, or even delete them all. Unfortunately, I don't know the source of the original author to give proper credit.
(defun C:SelBlkEv ( / blk SS nSS i e )
(setvar 'errno 0)
(while (/= 52 (getvar 'errno))
(setq blk (car (entsel "\nSelect block to filter <exit>: ")))
(cond
((= 7 (getvar 'errno)) (princ) (setvar 'errno 0))
((and blk (/= "INSERT" (cdr (assoc 0 (entget blk))))) (princ))
(blk
(setq blk (vla-get-EffectiveName (vlax-ename->vla-object blk)))
(setq SS (ssget "_X" (list (cons 0 "INSERT"))))
(setq nSS (ssadd))
(repeat (setq i (sslength SS))
(setq e (ssname SS (setq i (1- i))))
(and (eq blk (vla-get-EffectiveName (vlax-ename->vla-object e)))
(ssadd e nSS)
)
)
(sssetfirst nil nSS)
(setvar 'errno 52)
)
)
)
(princ)
)
I could have sworn it worked when I first used it years ago, but it isn't functioning the way I'd like, which is to delete all instances of the selected block in all locations, model or any layouts. I'm not a coder and am hoping someone can identify the issue or maybe point me to an alternative lisp to accomplish this?
Thanks!
Solved! Go to Solution.