我想选择高程参数以“0”或“5”结尾的所有实体,将它们放在某个图层中。
import ezdxf
import sys
try:
doc = ezdxf.readfile("Courbes_Lidar_1m.dxf")
except IOError:
print(f'Not a DXF file or a generic I/O error.')
sys.exit(1)
except ezdxf.DXFStructureError:
print(f'Invalid or corrupted DXF file.')
sys.exit(2)
print("File opened ----------------------------------------")
CP = doc.layers.new("Main curves")
CP.color = 181
CS = doc.layers.new("Secondary curves")
CS.color = 182
print("Layers created ----------------------------------------")
msp = doc.modelspace()
for x in msp:
print("Get elevation ----------------------------------------")