如何在autolisp中使用DTEXT
你好sombody能否告诉我如何在autolisp中使用DTEXT插入:)两个或多个预定义文本,如autocad图形的模型空间中所示:
(命令“dtext”text1 text2 text3…..)
结果将是:text1
文本2
文本3 在调用命令函数时,您应该将该命令的提示复制为参数-您的代码如下所示:
(foreach TextLabel (list Text1st Text2nd Text3rd)
(command "_DTEXT" InsertionPoint TextHeight TextAngle TextLabel)
)
当做
米尔恰 我是这样做的:
(command "TEXT" pt0 "0.1" "0" eastin)
(command "TEXT" "" northin)
第二个命令对位置(“”)的响应为空,并将其写在前面的文本下面。
eldon的方法不错。你也可以这样写:
关于,
米尔恰
(defun text ( text insertionpoint layer height )
(entmakex
(list
(cons 0 "text")
(cons 1 text);text content
(cons 7 "Romans");style
(cons 8 layer)
(cons 10 insertionpoint)
(cons 72 1)
(cons 73 2)
(cons 40 height)
(cons 11 insertionpoint)
)
)
)
(
(lambda ( insertionpoint1 insertionpoint2 )
(foreach x (list insertionpoint1 insertionpoint2)
(text "testing" x "0" 3.)
)
)
(list 0. 0. 0.)
(list 0. 4. 0.)
)
(vl-load-com)
(
(lambda ( ms insertionpoint1 insertionpoint2 )
(foreach x (list insertionpoint1 insertionpoint2)
(vla-addtext ms"testing"(vlax-3d-point (trans x 0 1)) 3)
)
)
(vla-get-modelspace
(vla-get-activedocument (vlax-get-acad-object))
)
(list 0. 0. 0.)
(list 0. 4. 0.)
)
非常感谢大家。
我们可以把每个文本(text1,text2,…)都放进去吗在不同的层中。
(defun text ( text insertionpoint layer height )
(entmakex
(list
(cons 0 "text")
(cons 1 text);text content
(cons 7 "Romans");style
(cons 8 layer)
(cons 10 insertionpoint)
(cons 72 1)
(cons 73 2)
(cons 40 height)
(cons 11 insertionpoint)
)
)
)
(
(lambda ( insertionpoint1 insertionpoint2 )
(foreach x (list insertionpoint1 insertionpoint2)
(text "testing" x "0" 3.)
)
)
(list 0. 0. 0.)
(list 0. 4. 0.)
)
(
(lambda ( pt1 pt2 )
(foreach x (list pt1 pt2)
(text "testing" (cdr x) (car x) 3.)
)
)
(cons "0" (list 0. 0. 0.))
(cons "Defpoints" (list 0. 4. 0.))
)
(vl-load-com)
(
(lambda ( ms pt1 pt2 )
(foreach x (list pt1 pt2)
(vla-put-layer
(vla-addtext ms"testing"(vlax-3d-point (trans (cdr x) 0 1)) 3)
(car x)
)
)
)
(vla-get-modelspace
(vla-get-activedocument (vlax-get-acad-object))
)
(cons "0" (list 0. 0. 0.))
(cons "Defpoints" (list 0. 4. 0.))
)
如果您计划使用msasu的示例
(foreach TextLabel (list Text1st Text2nd Text3rd)
(command "_TEXT")
(if InsertionPoint (setq InsertionPoint (command InsertionPoint TextHeight TextAngle)) (command ""))
(command TextLabel)
(and
(setq elast (entget (entlast)))
(entmod
(subst
(cons 8 x);put new layer here
(assoc 8 elast)
elast
)
)
)
)
[缩进]非常感谢大家。我们能把每一条文字(text1'日期='text2,…)在不同的层中。
... 我们是否可以将该过程重复256次“date=”,使256个文本实体相互重叠,并使每次迭代分别对应于256种标准(非真彩色)颜色中的每种颜色?
[/缩进] 引号未显示Renderman。。我是做错了什么还是错过了什么?
编辑:请不要理会,我得到了我想要的(笑声)。干杯
页:
[1]
2