快速书写:
- (defun c:DelBlock ( / blk ent inc obj sel )
- (while
- (not
- (or
- (eq "" (setq blk (getstring t "\nSpecify Block Name: ")))
- (tblsearch "BLOCK" blk)
- )
- )
- (princ "\nBlock not Found.")
- )
- (if
- (and
- (not (eq "" blk))
- (setq sel (ssget "_X" (list '(0 . "INSERT") (cons 2 (strcat "`*U*," blk)))))
- )
- (repeat (setq inc (sslength sel))
- (setq ent (ssname sel (setq inc (1- inc)))
- obj (vlax-ename->vla-object ent)
- )
- (if
- (or
- (and
- (vlax-property-available-p obj 'effectivename)
- (eq
- (strcase blk)
- (strcase (vla-get-effectivename obj)))
- )
- (eq
- (strcase blk)
- (strcase (vla-get-name obj))
- )
- )
- (entdel ent)
- )
- )
- )
- (princ)
- )
- (vl-load-com) (princ)
|