我不确定这是否适用于Electrical,但它适用于AutoCAD 2011。
- (defun c:test ( / e x a ax v)
- (setq e (car (entsel "\nSelect the titleblock to change : "))
- x (entget e)
- )
- (if
- (and
- (= "INSERT" (cdr (assoc 0 x)) )
- (= "YOURTITLEBLOCKNAME" (cdr (assoc 2 x)) )
- )
- (progn
- (setq a (entnext e)
- ax (entget a)
- )
- (while
- (/= "SEQEND" (cdr (assoc 0 ax)) )
- (if
- (= "%%UTITLE2" (cdr (assoc 2 ax)) )
- (setq v (cdr (assoc 1 ax)) )
- )
- (if
- (= "TITLE3" (cdr (assoc 2 ax)) )
- (entmod
- (subst
- (cons 1 v)
- (assoc 1 ax)
- ax
- )
- )
- (entupd e)
- )
- (setq a (entnext a)
- ax (entget a)
- )
- )
- )
- (princ "\nTitleblock not selected!")
- )
- (princ)
- )
用块的名称替换标题栏名称。
编辑-请确认您的标记名,您在某些情况下显示空格,在其他情况下不显示空格。 |