我修改了提供的代码,试图允许一个文本有3行。
我需要帮助让它工作。
(defun c:dimtest ( / e i s )
(setq txt1 (getstring "\nEnter Text line 1 to add to Dim: "))
(setq txt2 (getstring "\nEnter Text line 2 to add to Dim: "))
(setq txt3 (getstring "\nEnter Text line 3 to add to Dim: "))
(if (setq s (ssget "_:L" '((0 . "*DIMENSION") (1 . "~*?*"))))
(repeat (setq i (sslength s))
(setq e (entget (ssname s (setq i (1- i)))))
(entmod (subst '(1 . "<>\\X{\\C1;\\H1.3;txt1}") (assoc 1 e) e))
)
)
(princ)
) 一个更好的方法是使用strcat循环txt2 getstring以连接entmod中的多个输入。你可以有一个特定的字符也为一个空白行。
txt1 85.67
txt2 this is a
txt3 test of text
something like this not tested
(entmod (subst '((cons 1(strcat "<>\\X{\\C1;" txt2 "\\P" "txt3" "}"))
嗨Bigal
它只会插入txt1、txt2和txt3。
您是否能够解释插入每个值的格式,而不是txt编号?
谢谢 请尝试以下操作:
(defun c:dimtest ( / enx idx lne lst sel str )
(setq lne 0)
(while (/= "" (setq str (getstring t (strcat "\nSpecify text for line " (itoa (setq lne (1+ lne))) " <done>: "))))
(setq lst (cons str lst))
)
(setq str (car lst))
(foreach itm (cdr lst) (setq str (strcat itm "\\P" str)))
(setq str (cons 1 (if str (strcat "<>\\X{\\C1;" str "}") "")))
(if (setq sel (ssget "_:L" '((0 . "*DIMENSION") (1 . "~*?*"))))
(repeat (setq idx (sslength sel))
(setq enx (entget (ssname sel (setq idx (1- idx)))))
(entmod (subst str (assoc 1 enx) enx))
)
)
(princ)
) 嘿,李
工作起来很有魅力。
再次感谢 不客气。
页:
1
[2]