New support for creating angular dimensions.

There are several factory methods to add angular dimensions:
ConstructionArc objectFor more information: Tutorial for Angular Dimension
New support for creating arc dimensions.

There are several factory methods to add arc dimensions:
ConstructionArc objectFor more information: Tutorial for Arc Dimension
New support for creating ordinate dimensions by these factory methods:
Global feature location: the ordinate origin is the global WCS origin

Local feature location: the ordinate origin is the origin of a user defined UCS

For more information: Tutorial for Ordinate Dimension
Extended usability of the EntityQuery class.
This is a simple entity query which selects all LINE entities from the
modelspace as starting point for the following explanations:
lines = msp.query("LINE")
__getitem__() method to accept also a DXF attribute name that
returns all entities which support this attribute, this is the base for
supporting queries by relational operators.__setitem__() method to assigns a DXF attribute to all supported
entities in the EntityQuery container. E.g. change the layer of all selected
lines: lines["layer"] = "MyLayer"__delitem__() method to discard a DXF attribute from all entities inEntityQuery container. E.g. delete the layer attribute from all selected
lines: del lines["layer"], which reset the layer to the default value 0lines.layer = "MyLayer"<, <=, ==, !=, >=, >) which work
in conjunction with the extended attribute selection of __getitem__() to
allow further conditional selections. E.g. select all lines on layer
"MyLayer": lines_on_my_layer = lines.layer == "MyLayer"lines.layer.match("^My.*") lines.filter(lambda e: ...)Set operators to combine queries by union (|), intersection (&),
difference (-) and symmetric_difference (^). Example for selecting all blue lines and red circles from modelspace:
result = (msp.query("LINE").color == 5) | (msp.query("CIRCLE").color == 1)
For more information: Extended EntityQuery Features
The ezdxf.gfxattribs module
provides the GfxAttribs class to create valid
attribute dictionaries for the most often used DXF attributes supported by all
graphical DXF entities. The advantage of using this class is auto-completion
support by IDEs and an instant validation of the attribute values.
import ezdxf
from ezdxf.gfxattribs import GfxAttribs
doc = ezdxf.new()
msp = doc.modelspace()
attribs = GfxAttribs(layer="MyLayer", color=ezdxf.colors.RED)
line = msp.add_line((0, 0), (1, 0), dxfattribs=attribs)
circle = msp.add_circle((0, 0), radius=1.0, dxfattribs=attribs)
For more information: Documentation of the gfxattribs module
TextEntityAlignment enum replaces the string based alignment definition.
New Text methods:
Text.get_pos()Text.set_pos()Text.get_align()Text.set_align()height and rotation, dxfattribs is now a keyword argumentheight and rotation, dxfattribs is now a keyword argumentNew virtual DXF attribute MText.dxf.text which is linked to the MText.text
attribute, this adds API compatibility to other text based entities: TEXT,
ATTRIB and ATTDEF
New support for creating MULTILEADER entities.
Both factory methods return builder objects:
Due of the lack of good documentation it’s not possible to support all combinations
of MULTILEADER properties with decent quality!
For more information: Tutorial for creating MultiLeaders
New support for creating HELIX entities by the factory method add_helix().
New support for layer attribute override in VIEWPORT entities.
This feature is implemented in the LAYER entity. The new method
Layer.get_vp_overrides
returns a LayoutOverride
object which allows overriding properties for this specific layer for individual
viewports.
For more information: Example for overriding layer attributes in viewports
The ezdxf.appsettings
is a high-level module for working with CAD application
settings and behaviors. None of these settings have any influence on the
behavior of ezdxf, since ezdxf only takes care of the content of the DXF file
and not of the way it is presented to the user.
Example for updating the extents of the modelspace:
import ezdxf
from ezdxf import zoom, appsettings
doc = ezdxf.readfile("your.dxf")
extents = appsettings.update_extents(doc)
The function updates only the values in the HEADER section, to zoom the active viewport to these extents, use the zoom module:
zoom.center(doc.modelspace(), extents.center, extents.size)
For more information: Documentation of the appsettings module
Refactoring of the ezdxf.bbox.extents
function to make use of the improved bounding box calculation for Bézier curves,
this eliminates the need to estimate a suitable flattening distance.
The argument flatten is replaced by fast. If argument fast is True
the calculation of Bézier curves is based on their control points, this may
return a slightly larger bounding box. The fast mode also uses a simpler and
mostly inaccurate text size calculation instead of the more precise but very
slow calculation by matplotlib.
The ezdxf.addons.meshex module provides functions to exchange meshes with other tools by the following file formats:
STL - import/exportOFF - import/exportOBJ - import/exportPLY - export onlyOpenSCAD - export as polyhedron()IFC4 - export onlyThe source or target object is always a MeshBuilder instance and therefore
the supported features are also limited by this class. Only vertices and faces
are exchanged, colors, textures and explicit face- and vertex normals are lost.
For more information: Documentation of the meshex add-on
Interface to the OpenSCAD application to apply boolean
operations to MeshBuilder objects. The OpenSCAD application is not bundled
with ezdxf, you need to install the application yourself.
This example subtracts a sphere from a Menger sponge by OpenSCAD and exports the
result as MESH entity in a DXF file:
import ezdxf
from ezdxf.render import forms
from ezdxf.addons import MengerSponge, openscad
doc = ezdxf.new()
msp = doc.modelspace()
sponge = MengerSponge(level=3).mesh()
sponge.flip_normals() # important for OpenSCAD
sphere = forms.sphere(
count=32, stacks=16, radius=0.5, quads=True
).translate(0.25, 0.25, 1)
sphere.flip_normals() # important for OpenSCAD
script = openscad.boolean_operation(openscad.DIFFERENCE, sponge, sphere)
result = openscad.run(script)
result.render_mesh(msp)
doc.set_modelspace_vport(6, center=(5, 0))
doc.saveas("OpenSCAD.dxf")

For more information: Documentation of the OpenSCAD add-on
This add-on is based on the 3D bin packing module py3dbp to solve the bin packing problem.
For more information: Documentation of the binpacking add-on
New functions added:
For more information: Documentation of the odafc add-on
True if the given text angle in degrees causes an upside down text in the WCS.radius between straight line segments.radius between straight line segments.length between straight line segments.a and b from the
segment points between straight line segments.New ezdxf.path.helix()
function: Returns a helix as a Path object.
Improved ezdxf.path.bbox()
function: New algorithm to determine the exact bounding boxes of Bézier curves,
eliminating the need to estimate a suitable flattening distance.
Added argument fast which allows bounding
box calculation based on Bézier curve control points, this may result in
slightly larger bounding boxes in favor of increased execution speed.
Removed the arguments flatten and segments without deprecation warnings
(raises TypeError).
MeshTransformer object.WCS.WCS.caps to close hull with top- and bottom facesMeshDiagnose object for this mesh.Vec3 objects.Vec3 object.Vec3 instances, where all ngons which have more than max_vertex_count vertices gets subdivided.Vec3 instances, each face has no more vertices than the given max_vertex_count.MeshTransformer instance, where each face has no more vertices than the given max_vertex_count.MeshTransformer instances.MeshTransformer object with unified face normal vectors of all faces.MeshTransformer object with unified face normal vectors of all faces. New helper class ezdxf.render.MeshDiagnose
to analyze and detect errors of MeshBuilder objects.
New Helper class ezdxf.render.FaceOrientationDetector for face orientation and face normal vector detection.
New class ezdxf.math.ConstructionPolyline to measure, interpolate and divide anything that can be approximated or flattened into vertices.
New class ezdxf.math.ApproxParamT, an approximation tool for parametrized curves.
True if the bounding box is empty or the bounding box has a
size of 0 in any or all dimensions or is undefined.intersect() overlap()New class ezdxf.math.rtree.RTree: Immutable spatial search tree loosely based on R-Trees.
The new ezdxf.acis sub-package
provides some ACIS data management tools for curious and experienced users.
These tools cannot replace the official ACIS SDK due to the complexity of the
data structures and the absence of an ACIS kernel in ezdxf.
The new info command show info and optional stats of DXF files.
C:\> ezdxf info gear.dxf
Filename: ".\gear.dxf"
Format: ASCII
Release: R2013
DXF Version: AC1027
Codepage: ANSI_1252
Encoding: utf-8
Created by ezdxf: 0.18b6 @ 2022-07-06T14:21:18.530488+00:00
Written by ezdxf: 0.18b6 @ 2022-07-06T14:21:18.530488+00:00
The new browse-acis command can show and export the SAT or SAB content of
ACIS entities.
C:\> ezdxf browse-acis 3dsolid.dxf

For more information read the launcher documentation.
drawing add-ondrawing add-on got basic VIEWPORT rendering (only top-views),
supported by the PyQtBackend and the PillowBackend ezdxf.render.forms.turtle() function to create 2D polyline vertices by
turtle-graphic like commandsezdxf pillow to draw and convert DXF files by Pillowezdxf.path.triangulate(), tessellate (nested) paths into triangle-facesclip_polygon_2d(), by clipping the classes
ClippingPolygon2d() and ClippingRect2d() Vec2() was not immutable at inplace
operations +=, -=, *= and /= like the Cython implementationLinePrimitive()$FINGERPRINTGUID and $VERSIONGUID handlingadd_angular_dim_2l(), add_angular_dim_3p(), add_angular_dim_cra(),
add_angular_dim_arc() add_arc_dim_3p(), add_arc_dim_cra(), add_arc_dim_arc()add_ordinate_dim(), add_ordinate_x_dim(), add_ordinate_y_dim()EntityQuery classezdxf.tools.text.is_upside_down_text_angle() in WCSezdxf.tools.text.upright_text_angle() in WCSezdxf.math.ConstructionPolyline to measure, interpolate and
divide polylines and anything that can be approximated or flattened into
verticesezdxf.math.ApproxParamT()BoundingBox(2d).intersection(other), returns the 3D/2D bbox of the intersection spaceBoundingBox(2d).has_intersection(other) replaces deprecated method intersect() BoundingBox(2d).has_overlap(other) replaces deprecated method overlap() BoundingBox(2d).intersect() will be removed in v1.0.0BoundingBox(2d).overlap() will be removed in v1.0.0BoundingBox(2d).is_empty is True for bounding boxes with a size
of 0 in any dimension or has no dataezdxf.gfxattribs.GfxAttribs() class, docsTextEntityAlignment enum replaces the string based alignment definitionText.get_placement(), replaces get_pos() Text.set_placement(), replaces set_pos() Text.get_align_enum(), replaces get_align()Text.set_align_enum(), replaces set_align()MText.dxf.text, adds compatibility to other text
based entities: TEXT, ATTRIB, ATTDEFezdxf info FILE [FILE ...], show info and optional stats of DXF filesezdxf.appsettings, docsezdxf.addons.binpacking, a simple solution for the bin-packing problem
in 2D and 3D, docsheight and rotationfor factory methods add_text() and add_attdef()size_inches in function ezdxf.addons.drawing.matplotlib.qsave()ezdxf.addons.odafc.convert()ezdxf.addons.meshex: STL, OFF, and OBJ mesh loader
and STL, OFF, OBJ, PLY, OpenSCAD and IFC4 mesh exporter, docsezdxf.addons.openscad add-on as interface to OpenSCAD,
docs acis module, a toolbox to handle ACIS data, docsadd_helix() to create new HELIX entitiesezdxf.math.trianglation for polygon triangulation with hole supportezdxf.math.rtree.RTree ezdxf.math.clustering for DBSCAN and K-means clustering dxfattribs for factory methods add_text() and add_attdef()recover module - recovered integer and float values are logged as severe errorsPath.all_lines_to_curve3 replaced by function path.lines_to_curve3()Path.all_lines_to_curve4 replaced by function path.lines_to_curve4()flatten and segments by argument fast of tool
function Path.bbox() flatten by argument fast in the ezdxf.bbox moduleezdxf.math sub-packageBezier4P and Bezier3P classesEOF tag fast_plain_mtext() 3DSOLID export for DXF R2004 has no subclass AcDb3dSolid