2017-02-18 26 views
0

DXF文本我想用任一dxfwriteezdxf以沿着(WCS)y方向上的文字,並與在(WCS)z方向上的高度。使用dxfwrite或ezdxf以在z方向上的

使用autocad,我通過設置UCS並輸入文本來完成此操作。

我該如何在dxfwrite或ezdxf(或任何其他的python友好庫)中進行操作?

dxf.ucs('textucs',xaxis=(0.,1.,0),yaxis=(0.,0.,1.)) 
lab = dxf.mtext('hello',np.array([0.,0.,.5]),layer='mylay',height=0.3) 

不工作,大概是因爲我只創建了UCS,和我不使用它。

回答

1

定義一個UCS什麼也不做,dxfwrite/ezdxf不是CAD應用程序。

此示例使用ezdxf寫在YZ平面上的文字:

import ezdxf 

dwg = ezdxf.new('ac1015') 
modelspace = dwg.modelspace() 
modelspace.add_mtext("This is a text in the YZ-plane", 
        dxfattribs={ 
         'width': 12, # reference rectangle width 
         'text_direction': (0, 1, 0), # write in y direction 
         'extrusion': (1, 0, 0) # normal vector of the text plane 
        }) 

dwg.saveas('mtext_in_yz_plane.dxf') 

多行文字中dxfwrite只是一堆文本實體的,因爲MTEXT實體要求DXF13或更高版本。

相關問題