如何使用 python dxfwrite 绘制六边形

How to draw hexagonal shape using python dxfwrite

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

使用 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()