将属性值复制到anothe
我一直在寻找一个例程来获取一个属性的值并将其分配给另一个属性。我正在使用AutoCAD Electrical 2012标题栏更新功能修复此问题。在标题栏设置中,我可以将文本字符串或Autolisp表达式指定给任何属性。我要做的是将属性“%%UTITLE2”的现有值赋给属性“TITLE3”的值。
这就是我需要autolisp例程的地方。我认为它只需要调用属性“%%UTITLE2”的值。我认为标题栏更新功能实际上分配了这个值。
提前感谢您的帮助! 我不确定这是否适用于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)
)
用块的名称替换标题栏名称。
编辑-请确认您的标记名,您在某些情况下显示空格,在其他情况下不显示空格。
页:
[1]