我尝试用ezdxf创建文本,但是当我打开文件时,它什么也没显示!对于行等,它工作。我尝试了文档中的示例,但是也不工作!
import ezdxf
# TEXT is a basic entity and is supported by every DXF version.
# Argument setup=True for adding standard linetypes and text styles.
doc = ezdxf.new('R12', setup=True)
msp = doc.modelspace()
# use set_pos() for proper TEXT alignment:
# The relations between DXF attributes 'halign', 'valign',
# 'insert' and 'align_point' are tricky.
msp.add_text("A Simple Text").set_pos((2, 3), align='MIDDLE_RIGHT')
# Using a text style
msp.add_text("Text Style Example: Liberation Serif",
dxfattribs={
'style': 'LiberationSerif',
'height': 0.35}
).set_pos((2, 6), align='LEFT')
doc.saveas("simple_text.dxf")
1条答案
按热度按时间z9smfwbn1#
set_pos
似乎从版本0.18开始就被弃用了,现在是set_placement
。检查https://github.com/mozman/ezdxf/blob/master/examples/using_all_text_styles.py