fl202 发表于 2016-7-26 15:29 
遇到嵌套块是很烦的。好多人定义块时,对象没有在0层(习惯非常不好)。这样最后出图图纸上图层特别多,清理 ...  - ;;; 将图中所有块(含嵌套块)内所有对象更改到0图层,颜色随层.
- ;;; 由“USER”根据“fl202”原作进行改动.
- (defun c:tt (/ BLK E L N X)
- (setvar "clayer" "0")
- (while (setq bLk (tblnext "block" (not bLk)))
- (if (not (member (setq n (cdr (assoc 2 bLk))) L))
- (progn
- (setq e (tblobjname "block" n)
- l (cons n l)
- )
- (while (setq e (entnext e))
- (setq x (entget e))
- (entmod (subst '(8 . "0") (assoc 8 x) x))
- )
- )
- )
- )
- (command "_.regen")
- (princ)
- )
|