XData
CheshireCC opened this issue · comments
Cheshire commented
some times , add xdata to entity, dxf file can't be read by CAD, I tried R2000
、R2010
、R2018
format, don't work.
Error
The following error was encountered while reading POLYLINE (starting at line 4918):
Target ends early
Invalid or incomplete DXF input-drawing is discarded.
Code:
doc = ezdxf.new("R2000",setup=True)
doc.layers.new('JZD', dxfattribs={'color': 1})
msp = doc.modelspace()
points=[(0,0),(100,100),(200,300)]
pl_ = msp.add_polyline2d(points, dxfattribs={'layer': 'JZD',"default_start_width": 0.15, "default_end_width":0.15}, close=True)
pl_.set_xdata("SOUTH",[(1071,300000),(1000, "141121JC00005"),(1000, f"{pl.name}"),(1000,"0702")])
doc.saveas(r"./01.dxf")
And I also found that, change xdata code to:
pl_.set_xdata("EZDXF",[(1071,300000),(1000, "141121JC00005"),(1000, f"{pl.name}"),(1000,"0702")])
It'll work.
And if I replace "EZDXF" in 01.dxf
with "SOUTH" by notepad++ , also work.
I don't know what happand, I did sth wrong?
Grzegorz commented
You need to add the application to the APPID table.
doc.appids.add("SOUTH")
Cheshire commented
You need to add the application to the APPID table.
doc.appids.add("SOUTH")
Thx, that‘s right way