2

我想在我的 dxf 中放置一些简单的文本,如下所示:

mtext = msp.add_mtext("TEXT TEST", dxfattribs={'style': 'OpenSans'})

我想将此文本插入到我的 dxf 中的x=1位置y=1

这是我尝试过的:

mtext.dxf.insert([1,1,0])

但我得到错误:

mtext.dxf.insert([1,1,0])
TypeError: 'Vector' object is not callable

解决此问题的任何帮助表示赞赏。

编辑:

使用单行文本时,例如:

mtext = msp.add_text("TEXT TEST").set_pos((1, 2),align='MIDDLE_RIGHT')

一切正常,但我仍然需要编写多行文本。

4

1 回答 1

1

命名空间内的所有 DXF 属性都MText.dxf像常规对象属性一样,在这种情况下,设置MText.dxf.insert属性如下所示:

mtext.dxf.insert = (1, 1, 0)

扩展放置方法称为MText.set_location()

mtext.set_location(insert=(1, 1, 0), rotation=0, attachment_point=1)

有关更多信息,请查看文档MTEX​​T 教程

于 2020-08-16T03:19:07.197 回答