Delete DXF Attributes from Entities¶
All DXF attributes of an entity are grouped in the namespace attribute dxf
.
You can delete a DXF attribute by the del operator:
line = msp.add_line((0, 0), (1, 0))
line.dxf.layer = "MyLayer"
del line.dxf.layer
assert line.dxf.layer == "0" # the default layer for all entities
The del operator raises an DXFAttributeError
if the attribute doesn’t exist
or isn’t supported. The discard()
method ignores these errors:
line.dxf.discard('text') # doesn't raise an exception