至于dxf文件的格式在之前的博文中已经有详细的叙述,在此将不做赘述。
from Point import Point
class DXFReaderImpl:
def __init__(self,file):
self.file = file
self.points = [] ## 用于记录点实体的坐标值
self.points_line = [] ## 用于记录线段的各端点坐标值,包括直线和折线两种线型
self.points_polygon = [] ## 用于纪录多边形的顶点坐标值
def readDXF(self):
firstLine =""
secondLine = ""
secondLine = self.file.readline().strip()
while secondLine != "EOF":
if firstLine.strip() == "0" and secondLine.strip()== "LWPOLYLINE":
self.readPolyline()
if firstLine.strip() == "0" and secondLine.strip() == "LINE":
self.readLines()
if firstLine.strip() == "0" and secondLine.strip() == "POINT":
pass
firstLine = secondLine
secondLine = self.file.readline().strip()
print "there are " + str(i) + "polyline"
##
## def readPolygon(self):
##

本文介绍如何使用Python读取DXF文件中的点、直线、折线和多边形等实体的坐标数据。
最低0.47元/天 解锁文章

5529

被折叠的 条评论
为什么被折叠?



