dxf解析python_Python 读取DXF文件

至于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

你可能感兴趣的:(dxf解析python)