如何使用python dxfwrite绘制六边形

时间:2017-05-16 08:47:45

标签: python parsing shapefile shapely dxf

如何使用dxfwrite在python中绘制六边形(或任何多边4边多边形)的形状?提前谢谢。

1 个答案:

答案 0 :(得分:1)

使用POLYLINE实体:

http://pythonhosted.org/dxfwrite/entities/polyline.html

from dxfwrite import DXFEngine as dxf

dwg = dxf.drawing('polyline.dxf')

points = [(0, 3), (2, 0), (5, 0), (7, 3), (5, 6), (2, 6)]
polyline = dxf.polyline(points)
polyline.close()
dwg.add(polyline)

dwg.save()