You may want to reconsider this line:
For fun, here's another option:
- (defun c:FOO (/ *acadDoc* eName ss blockItem) (vl-load-com) (vla-startundomark (setq *acadDoc* (vla-get-activedocument (vlax-get-acad-object)))) (if (and (setq eName (car (entsel "\nSelect the Block You Wish to Delete: "))) (setq ss (ssget "_x" (list '(0 . "INSERT") (assoc 2 (entget eName)))))) (progn (vlax-for x (setq ss (vla-get-activeselectionset *acadDoc*)) (cond (blockItem) ((setq blockItem (vla-item (vla-get-blocks *acadDoc*) (vla-get-effectivename x))))) (vla-delete x)) (vla-delete blockItem) (vla-delete ss))) (vla-endundomark *acadDoc*) (princ))
Option #2 will also remove the block reference from the blocks collection. |