已测试,并在您发布的示例图形中工作。如果你遇到任何问题,请告诉我。
- ;;;
- ;;; CheSyn 2013
- ;;; BLK2LAYER - change layer of block to tag value
- ;;;
- (defun c:blk2layer ( / oe ss no e x at ax ln)
- (command "_.undo" "BEgin")
- (setq oe (getvar 'CMDEcho) )
- (setvar 'CMDEcho 0)
- (setq ss (ssget "_x" '( (0 . "INSERT")(2 . "BLK*")(8 . "0") ))
- no 0 )
- (while
- (< no (sslength ss) )
- (setq e (ssname ss no)
- x (entget e)
- at (entnext e)
- ax (entget at) )
- (while
- (/= "SEQEND" (cdr (assoc 0 ax)) )
- (if
- (= "Postcode" (cdr (assoc 2 ax)) )
- (setq ln (cdr (assoc 1 ax)) )
- )
- (setq at (entnext at)
- ax (entget at) )
- )
- (entmod
- (subst
- (cons 8 ln)
- (assoc 8 x)
- x
- )
- )
- (entupd e)
- (setq no (1+ no) )
- )
- (setvar 'CMDEcho oe)
- (command "_.undo" "End")
- (princ)
- )
|