Complete rewrite of the entity system by keeping the high level interface unchanged, changes for users should be minimal, but there are some bigger changes that could impact users too.
Entities are no more stored as tag lists, instead each DXF entity is represented by a proper Python object like the wrapper classes in previous ezdxf versions, by overhauling the complete system I decided to use a unified entity system for ALL DXF versions.
Advantage is a faster and easier internal processing, and you can save as any DXF version you want by the cost of losing data and attributes if you choose to save in an older DXF version, because ezdxf is still not a DXF converter or CAD application. Otherwise saving an older DXF versions as a newer DXF version should work properly e.g. open a DXF R12 and save it as DXF R2018.
Creating new drawings by exdxf.new()
is about 6x faster than before, because no templates from file system are needed
anymore, new drawings are build from scratch in memory.
Disadvantage, ezdxf has to interpret all group codes of supported entities and Autodesk do not document all group codes in the official DXF reference, this unknown group codes will be lost by saving a modified DXF drawing, unsupported and unknown entities are still stored and preserved as dumb tag lists (unsupported is my term for documented entities, just stored for preservation). ezdxf logs unknown tags, but I don't have the time and will to research the functionality of these unknown tags. This new entity system also causes a little time penalty for loading and saving DXF files, the actual loading process is optimized for the old entity system and could be optimized for the new entity system later, but the penalty is only ~1.5x to 2x and is only noticeable at really large files (>5MB).
CAUTION: SOME DATA MAYBE LOST BY MODIFYING EXISTING DXF FILES.
Renamed all DXF attributes which represent a handle to clarify the type of the attribute, except for handle
and
owner
all handle attributes have a "_handle" suffix.
The DXFEntity
class is still the base class of all DXF entities, but some major changes had be done, mostly
important for developers which go beyond the high level API:
DXFEntity.drawing
to DXFEntity.doc
get_xdata()
keyword xdata_tag
to tags
set_xdata()
keyword xdata_tag
to tags
remove_reactor_handle()
to discard_reactor_handle()
supports_dxf_attrib()
to is_supported_dxf_attrib()
dxf_attrib_exists()
to has_dxf_attrib()
get_extension_dict()
returns ExtensionDict
object instead of the raw DICTIONARY objectSee also the DXFEntity reference.
line_weight
as synonym for lineweight
plot_style_name
to plotstyle_handle
material
to material_handle
true_color
attribute (DXF R2004+, undocumented)Layer.color
property to set/get ACI color values Layer.rgb
property to set/get true color values as (R, G, B) tuples Layer.transparency
property to set/get layer transparency as float value between 0 and 1 Layer.description
property to set/get layer description rename()
: rename layer and all known (documented) references to this layerSee also the Layer reference.
Polyline vertices are now stored as Vertex
objects in a standard Python list called Polyline.vertices
.
See also the Polyline reference.
Block reference attributes (attached ATTRIB entites) are stored as Attrib
objects in a standard Python list called
Insert.attribs
.
See also the Insert reference.
Direct access to paths (Hatch.paths
), pattern (Hatch.pattern
) and gradient (Hatch.gradient
) objects, context
manager to edit this data is not needed anymore, but still available for backward compatibility
See also the Hatch reference.
Integration of MTextData
methods into MText
, removed methods edit_data()
, get_text()
, set_text()
from MText
,
get_text()
and set_text()
are replaced by the property MText.text
and context manager edit_data()
is not needed
anymore.
See also the MText reference and the new MText tutorial.
Deleting a Dimension
entity also removes the associated anonymous dimension block.
Same handling of the VIEWPORT entity for all DXF versions, but DXF R12 does not support all features, unsupported features are ignored at saving as DXF R12.
Viewport.dxf.center_point
to Viewport.dxf.center
Viewport.dxf.target_point
to Viewport.dxf.target
See also the Viewport reference.
ezdxf.options.template_dir
, no more neededezdxf.options.log_unprocessed_tags
to log unprocessed (unknown) DXF tags, default is True
Renaming layers byLayer.rename()
, renames the layer and all known (documented) references to this layer. Support for
true color, transparency and layer description.
Added support for the LEADER entity.
Result container EntityQuery
got first
and last
properties, to get first or last entity or None
if query
result is empty.
Exclude DXF types from '*'
search, by appending type name with a preceding '!' e.g. query for all entities
except LINE = "* !LINE"
Added ngon()
, star()
and gear()
to ezdxf.render.forms
See also ezdxf.render.forms documentation.
Importer add-on rewritten, API incompatible to previous ezdxf versions, but previous implementation was already broken.
See also Importer documentation.
Source code generator to create Python source code from DXF entities, to recreate this entities by ezdxf.
This tool creates only simple structures as a useful starting point for parametric DXF entity creation from existing DXF files. Not all DXF entities are supported!
See also dxf2code documentation.
Added support for named plot style tables ('.stb' files), see also Plot Style Files documentation.