属性标记-值-
我想知道是否有lisp例程或脚本文件可以将文本从一个块属性标记“值”列复制到
同一块。我发现有些很接近,但不太管用。
问题是我需要填写的值列是空的,所以我不能
只要做一个匹配文本。我正在运行autocad 2012。
我正在发送一个Cad文件和lisp例程的示例。
谢谢
Cad 2000_Exmpl。图纸
matchatts。LSP 尝试以下未经测试的代码-调整属性标记以适应:
(defun c:test ( / des ent lst map src )
(setq map '(("TAG1" . "TAG2")))
(while
(progn (setvar 'errno 0) (setq ent (car (entsel "\nSelect block: ")))
(cond
( (= 7 (getvar 'errno))
(princ "\nMissed, try again.")
)
( (null ent) nil)
( (/= "INSERT" (cdr (assoc 0 (entget ent))))
(princ "\nThe selected object is not a block.")
)
( (null
(setq lst
(mapcar
'(lambda ( x ) (cons (strcase (vla-get-tagstring x)) x))
(vlax-invoke(vlax-ename->vla-object ent) 'getattributes)
)
)
)
(princ "\nThe selected block has no attributes.")
)
( (foreach itm map
(if (and (setq src (cdr (assoc (car itm) lst)))
(setq des (cdr (assoc (cdr itm) lst)))
(vlax-write-enabled-p des)
)
(vla-put-textstring des (vla-get-textstring src))
)
)
)
)
)
)
(princ)
)
(vl-load-com) (princ)
我假设您希望在单个块内的属性标记之间复制属性值。 Lee和student21可能有一种不同的方法,你可以使用属性创建顺序,这意味着你不需要知道标记名,你可以说获取“属性2”并将其复制到“属性4”。此方法适用于大多数块。例如更新修订块,查找下一个空白属性行并填充。
VBA做得很好,attrib(1)等
粗野的
; Change attribute value by created position
(vl-load-com)
(setq y 1)
(setq ss1 (car (entsel)))
(setq bname (vla-get-name(vlax-ename->vla-object SS1)))
(setq x (getint "\nEnter line no to pick")) ; change this line in block
(SETQ newstrblank ".")
(foreach att (vlax-invoke (vlax-ename->vla-object SS1) 'getattributes)
(if (= y x)
(progn
(setq newstr (vla-get-textstring att ))
(vla-put-textstring att newstrblank)
)
)
(setq y (+ Y 1))
)
(setq y 1)
(setq x (getint "\nEnter line no to move to"))
(foreach att (vlax-invoke (vlax-ename->vla-object SS1) 'getattributes)
(if (= y x)
(vla-put-textstring att newstr)
)
(setq y (+ Y 1))
)
(princ)
页:
[1]