for entity in msp:
print('Entity #{}'.format(entity.dxf.handle))
# If it's a LINE
if entity.dxftype() == 'LINE':
worksheet.write(row, col, entity.dxf.start[0])
worksheet.write(row, col+1, entity.dxf.start[0])
print("** WRITING VERTICES")
row += 1
worksheet.write(row, col, entity.dxf.end[0])
worksheet.write(row, col, entity.dxf.end[1])
print("** WRITING VERTICES")
row += 1
try:
for i, location in enumerate(entity.vertices()):
worksheet.write(row, col, location[0])
worksheet.write(row, col+1, location[1])
worksheet.write(row, col+2, entity.dxf.handle)
print("** WRITING VERTICES")
row += 1
except:
print("Entity had no Vertices")
try:
for i, location in enumerate(entity.points()):
worksheet.write(row, col, location.x)
worksheet.write(row, col+1, location.y)
worksheet.write(row, col+2, entity.dxf.handle)
print("** WRITING POINTS")
row += 1
except:
print("Entity had no Polyline Points, moving to next entity")