试试 不知道是不是这样- ;;; 炸开嵌套块或组-阿甘修改2012.7.14
- (defun c:xx (/ *error* ent gr i msg n qf ss)
- (defun *error* (msg)
- (setvar "qaflags" qf)
- (princ msg)
- (princ)
- )
- (setq qf (getvar "qaflags"))
- (setvar "qaflags" 1)
- (princ "\n选择要炸开的块或组")
- (setq ss (ssget))
- (setq n (sslength ss))
- (setq i (- n 1))
- (repeat n ; 先删除组
- (setq ent (ssname ss i))
- (setq gr (cdr (assoc 0 (entget (cdr (assoc 330 (entget ent)))))))
- (if (= "GROUP" gr)
- (entdel (cdr (assoc 330 (entget ent))))
- )
- (setq i (1- i))
- )
- (while (setq ss (ssget "P" '((0 . "INSERT")))) ; 再炸开嵌套块
- (command ".explode" ss "")
- )
- (setvar "qaflags" qf)
- (princ)
- )
|