简体   繁体   English

如何使用python dxfwrite绘制六角形

[英]How to draw hexagonal shape using python dxfwrite

How to draw a hexagonal( or any polygon with more than 4 sides) shape in python using dxfwrite? 如何使用dxfwrite在python中绘制六边形(或具有4个以上边的任何多边形)形状? Thank you in advance. 先感谢您。

Use the POLYLINE entity: 使用POLYLINE实体:

http://pythonhosted.org/dxfwrite/entities/polyline.html 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()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM