Release v0.10

By mozman, So 01 September 2019, in category Release

release

New Entity System

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.

API changes

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.

DXFEntity

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:

See also the DXFEntity reference.

Layer

See also the Layer reference.

Polyline

Polyline vertices are now stored as Vertex objects in a standard Python list called Polyline.vertices.

See also the Polyline reference.

Insert

Block reference attributes (attached ATTRIB entites) are stored as Attrib objects in a standard Python list called Insert.attribs.

See also the Insert reference.

Hatch

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.

MText

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.

Dimension

Deleting a Dimension entity also removes the associated anonymous dimension block.

Viewport

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.

See also the Viewport reference.

Options

New Features

Layer

Renaming layers byLayer.rename(), renames the layer and all known (documented) references to this layer. Support for true color, transparency and layer description.

Leader

Added support for the LEADER entity.

Query

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"

Forms/Shapes

Added ngon(), star() and gear() to ezdxf.render.forms

See also ezdxf.render.forms documentation.

Importer add-on

Importer add-on rewritten, API incompatible to previous ezdxf versions, but previous implementation was already broken.

See also Importer documentation.

Source code generator add-on

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.

STB files

Added support for named plot style tables ('.stb' files), see also Plot Style Files documentation.