I have encountered an issue when creating a new drawing using the ezdxf library. I need to create a new dxf drawing, AutoCAD release R2000, so I use the following commands:
doc = ezdxf.new(dxfversion='AC1015') # AutoCad Release R2000
msp = doc.modelspace()
New entities, e.g. a simple line, are added on separate layers. For example:
msp.add_line((0,0), (1,1), dxfattribs={"layer": "MyLines"})
And then at the end:
doc.saveas('drawing.dxf')
for saving the document.
This works fine: I can create a dxf version R2000 with the line/lines I added.
However, the layer is not yet present. If I save the document from AutoCAD, then I can see the layer. This is quite strange, have you ever encountered something similar?
The DXF format do not require a layer table entry for a layer. A layer without a layer table entry has the default linetype "Continuous", a default color of 7 and a lineweight of -3 which represents the default lineweight of 0.25mm in most circumstances.
For more information read the docs of ezdxf
about the basics of layers.