demus72 Posted July 18 Posted July 18 On 1/11/2017 at 8:53 AM, Grrr said: This should grip all blocks in the drawing, with the same name: (defun C:test ( / 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 found this lsp and have been using it for a few years, great lsp. I used it today to delete a block from all layouts but when I switch from one layout to the next, the block still exists in all subsequent layouts. I want to delete our title block from all layouts, only 9 layouts, and purge it. It's the same identical block with the same name, any reason the above lsp wouldn't select them all? Thanks Quote
ronjonp Posted July 18 Posted July 18 (edited) 2 hours ago, demus72 said: I found this lsp and have been using it for a few years, great lsp. I used it today to delete a block from all layouts but when I switch from one layout to the next, the block still exists in all subsequent layouts. I want to delete our title block from all layouts, only 9 layouts, and purge it. It's the same identical block with the same name, any reason the above lsp wouldn't select them all? Thanks Using this as a base try this code: (defun c:foo (/ e n s) (if (and (setq e (car (entsel "\nPick block to delete: "))) (setq n (assoc 2 (entget e))) (setq s (ssget "_X" (list n))) ) (foreach o (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex s))) (vl-catch-all-apply 'vla-delete (list o)) ) ) (princ) ) Edited July 18 by ronjonp Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.