Release v0.8.9

By mozman, Mi 28 November 2018, in category Releases

lwpolyline, mesh, release, spline

News

  • IMPORTANT: Python 2 support will be dropped in ezdxf v0.9.0, because Python 2 support get more and more annoying.
  • CHANGE: refactoring of internal tag representation for a smaller memory footprint, but with some speed penalty
  • NEW: packed data for LWPOLYLINE, SPLINE, MESH
  • NEW: data queries over all layouts and blocks
  • NEW: change entity redraw order in layouts
  • NEW: ezdxf.algebra.Arc helper class for arcs
  • CHANGE: Safe deleting of block definitions
  • NEW: rename paper space layouts by Drawing.layouts.rename(old_name, new_name)
  • NEW: BlockLayout.is_layout_block, True if block is a model space or paper space block definition
  • NEW: Basic support for embedded objects (new in AutoCAD 2018)
  • BUGFIX: invalid CLASS definition for DXF version R2000 (AC1015) fixed, bug was only triggered at upgrading from R13/R14 to R2000
  • Basic read support for many missing DXF entities/objects

Dropping Python 2 support

Python 2 support will be dropped in ezdxf v0.9.0, for more information look at this posting .

Refactoring for a smaller memory footprint

Some entities (LWPOLYLINE, SPLINE, MESH, ...) using now array.array() for repeating tags like vertices, edge and face indices (packed data), this reduces the memory usage, but also adds some runtime penalty.

LWPOLYLINE

LWPOLYLINE has now packed data, (x, y) coordinates, start- and end width and bulge are stored as 8-byte double values in an array.array(). Faster point access by __getitem__(), added __setitem__(), __delitem__(), insert() and append() methods.

With the new data structure, getting vertices is now faster and has full support for slicing operations:

line = layout.add_lwpolyline([(1, 1), (2, 2), (3, 3)])

# modify existing vertex
line[0] = (4, 4)
assert (4, 4, 0, 0, 0) == line[0]

# slicing vertices
assert len(line[:-1]) == 2

# len support
# assert len(line) == 3

User defined point format for append(), insert(), append_points(), points(), get_points() and set_points(). The user defined format allows reordering of point components: coordinates 'x, y' , start width 's', end width 'e' and bulge value 'b' , default format is 'xyseb'.

If you just need x, y and bulge value:

points = line.get_points(format="xyb")

Renamed discard_points() in clear(). Removed get_rstrip_points() and context manager rstrip_points(), which can be replaced by using an user defined point format.

For more see the documentation for LWPolyline: https://ezdxf.mozman.at/docs/dxfentities/lwpolyline.html

SPLINE

SPLINE has packed data:

  • knots and weights are stored as 4-byte float arrays
  • fit- and control points are stored as 8-byte double arrays

Access methods get_knot_values(), get_weights(), get_control_points() and get_fit_points() are deprecated, direct access to this attributes by Spline.knot_values, Spline.weights, Spline.control_points and Spline.fit_points, all with a list-like interface.

Knot, fit- and control point counter updated automatically, therefore counters are read only now.

Editing a mesh by Spline.edit_data() context manager still works the same way as in previous versions.

For more see the documentation for Spline: https://ezdxf.mozman.at/docs/dxfentities/spline.html

MESH

MESH has packed data.

  • vertices are stored as 8-byte double arrays
  • edges are stored as 8-byte double arrays
  • faces ands creases are stored as list of arrays(), array type depends from data: byte, integer or long

Editing a mesh by Mesh.edit_data() context manager still works the same way as in previous versions.

For more see the documentation for Mesh: https://ezdxf.mozman.at/docs/dxfentities/mesh.html

Data queries over all layouts and blocks

  • Drawing.layouts_and_blocks(): iterate over all layouts (mode space and paper space) and all block definitions
  • Drawing.chain_layouts_and_blocks(): chain entity spaces of all layouts and blocks. Yields an iterator for all entities in all layouts and blocks
  • Drawing.query(): entity query over all layouts and blocks
  • Drawing.groupby(): groups DXF entities of all layouts and blocks by an DXF attribute or a key function

For more see the documentation for Drawing: https://ezdxf.mozman.at/docs/drawing.html

Change entity redraw order in layouts

To change redraw order associate a different sort handle to entities, this redefines the order in which the entities are regenerated.

  • Layout.get_redraw_order()
  • Layout.set_redraw_order(handles): set redraw order of entities in model space or paper space layouts

For more see the documentation for Layout: https://ezdxf.mozman.at/docs/layouts.html#change-redraw-order

Safe deleting of block definitions

Changed behavior for deleting BLOCK definitions.

  • Drawing.blocks.delete_block(name, safe=True), new parameter save, check if block is still referenced(raises DXFValueError)
  • Drawing.blocks.delete_all_blocks(safe=True), if parameter safe is True, do not delete blocks that are still referenced

Algebra helper class for arcs

New helper class ezdxf.algebra.Arc to create arcs from 2 points and an angle or radius, or from 3 points.

For more see the documentation for ezdxf.algebra.Arc: https://ezdxf.mozman.at/docs/algebra/arc.html

Support for DXF R2018 embedded objects

Basic support for embedded objects (new in AutoCAD 2018), ezdxf reads and writes the embedded data as it is, no interpretation no modification, just enough to not break DXF files with embedded objects at saving.

Basic read support many additional DXF entities

  • ACAD_PROXY_GRAPHIC
  • HELIX
  • LEADER
  • LIGHT
  • MLEADER (incomplete)
  • MLINE (incomplete)
  • OLEFRAME
  • OLE2FRAME
  • SECTION
  • TABLE (incomplete)
  • TOLERANCE
  • WIPEOUT
  • ACAD_PROXY_OBJECT
  • DATATABLE
  • DICTIONARYVAR
  • DIMASSOC
  • FIELD (incomplete)
  • FIELDLIST (not documented by Autodesk)
  • IDBUFFER
  • LAYER_FILTER
  • MATERIAL
  • MLEADERSTYLE
  • MLINESTYLE
  • SORTENTSTABLE
  • SUN
  • SUNSTUDY (incomplete) (no real world DXF files with SUNSTUDY for testing available)
  • TABLESTYLE (incomplete)
  • VBA_PROJECT (no real world DXF files with embedded VBA for testing available)
  • VISUALSTYLE
  • WIPEOUTVARIABLES
  • for all other unsupported entities/objects exists only raw DXF tag support