Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: Lisp routine to delete blocks
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
a quick mod
(defun c:deleteblock (/ *error* msge effnme ent entl setl e)
(vl-load-com)
(alert
"warning! - this command deletes all occurences of block selected")
(defun *error* (msge)
(princ "error: ")
(setq msge (princ "\nfunction cancelled"))
(terpri))
(setq effnme (lambda (x)
(vla-get-effectivename
(if (eq (type x) 'ENAME)
(vlax-ename->vla-object x)
x))))
(princ "\nselect block to delete: ")
(if (setq ent (ssget "_
" '((0 . "INSERT"))))
(progn
(setq entl (effnme (ssname ent 0)))
(ssget "x" (list (cons 2 (strcat entl ",`*U*"))))
(vlax-for
itm (vla-get-ActiveSelectionSet
(vla-get-ActiveDocument
(vlax-get-acad-object)))
(if (eq (effnme itm) entl)
(vl-catch-all-apply
'vla-delete
(list itm))))
(princ (strcat "\nall blocks named "
entl
" have now been deleted")))
(princ "\nNo Block Selected:"))
(princ)
)
HTH


