The new command line script ezdxf launches various sub-commands:
pp the previous dxfpp command, the DXF pretty printeraudit DXF filesdraw and convert DXF files by the Matplotlib backend view DXF files by the PyQt viewerbrowse PyQt DXF structure browser for DXF debugging and curios people (v0.16.4)strip Strip comments and THUMBNAILIMAGE section from DXF files (v0.16.4)The help option -h is supported by the main script and all sub-commands:
C:\> ezdxf -h
usage: ezdxf [-h] [-V] [-v] [--log LOG] {pp,audit,draw,view} ...
Command launcher for the Python package "ezdxf": https://pypi.org/project/ezdxf/
positional arguments:
{pp,audit,draw,view}
pp pretty print DXF files as HTML file
audit audit and repair DXF files
draw draw and convert DXF files by Matplotlib
view view DXF files by the PyQt viewer
optional arguments:
-h, --help show this help message and exit
-V, --version show version and exit
-v, --verbose give more output
--log LOG path to a verbose appending log
This is the only executable script installed on the user system, if installed
by pip, the dxfpp script is not included anymore.
Pretty print the DXF text content as HTML file and open the file in the default web browser:
C:\> ezdxf pp -o gear.dxf

Audit and recover the DXF file gear.dxf and save the recovered version
as gear.rec.dxf:
C:\> ezdxf audit -s gear.dxf
auditing file: gear.dxf
No errors found.
Saved recovered file as: gear.rec.dxf
Convert the DXF file gear.dxf into a SVG file by the Matplotlib backend:
C:\> ezdxf draw -o gear.svg gear.dxf
The gear.svg created by the Matplotlib backend:
Show all output formats supported by the Matplotlib backend on your system. This output may vary:
C:\> ezdxf draw --formats
eps: Encapsulated Postscript
jpg: Joint Photographic Experts Group
jpeg: Joint Photographic Experts Group
pdf: Portable Document Format
pgf: PGF code for LaTeX
png: Portable Network Graphics
ps: Postscript
raw: Raw RGBA bitmap
rgba: Raw RGBA bitmap
svg: Scalable Vector Graphics
svgz: Scalable Vector Graphics
tif: Tagged Image File Format
tiff: Tagged Image File Format
View the DXF file gear.dxf by the PyQt backend:
C:\> ezdxf view gear.dxf

Show the ezdxf version and configuration:
C:\> ezdxf -Vv
ezdxf v0.16b2 @ d:\source\ezdxf.git\src\ezdxf
Python version: 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, ...
using C-extensions: yes
using Matplotlib: yes
font cache directory: internal
default text style: OpenSans
default dimension text style: OpenSansCondensed-Light
load proxy graphic: yes
store proxy graphic: yes
log unprocessed tags: yes
filter invalid XDATA group codes: no
EZDXF_DISABLE_C_EXT=
EZDXF_TEST_FILES=D:\Source\dxftest
EZDXF_FONT_CACHE_DIRECTORY=
EZDXF_AUTO_LOAD_FONTS=
EZDXF_PRESERVE_PROXY_GRAPHICS=
EZDXF_LOG_UNPROCESSED_TAGS=
EZDXF_FILTER_INVALID_XDATA_GROUP_CODES=
bboxThis module provides methods to calculate axis aligned bounding boxes.
The module can handle nested block reference structures,
see also the description of the new disassamble support module below.
The bbox.extents() function calculates a single bounding box for
multiple DXF entities. This example draws a rectangle around the cog wheel:
import ezdxf
from ezdxf import bbox
doc = ezdxf.readfile("gear.dxf")
msp = doc.modelspace()
box = bbox.extents(msp)
# draw a rectangle around the cog wheel
p1 = box.extmin
p2 = box.extmax
msp.add_lwpolyline([p1, (p2.x, p1.y), p2, (p1.x, p2.y)], close=True)
# draw an inner hole
diameter = min(box.size.x, box.size.y)
radius = diameter / 2 * 0.7
msp.add_circle(box.center, radius)
doc.saveas("gear_with_bbox.dxf")

For more information see the documentation
zoomSet the active viewport of a layout to the bounding box of all DXF entities in this layout or a subset of these entities. This module solves a problem of many beginners, to find the content of a DXF file in the DXF viewer.
Set the active viewport to the extents of the model space:
import ezdxf
from ezdxf import zoom
doc = ezdxf.new()
msp = doc.modelspace()
msp.add_circle((1000, 1000), radius=2)
zoom.extents(msp)
doc.saveas("circle.dxf")
For more information see the documentation
disassembleThis module provides tools for the recursive decomposition of nested block
reference structures into a flat stream of DXF entities and
converting DXF entities into geometric primitives as Path and MeshBuilder
objects encapsulated into intermediate Primitive classes. These primitives
give unified access to the entity vertices or even the shape as Path or
MeshBuilder objects. Text objects are represented by their bounding box as a
Path object.
For more information see the documentation
text2path Add-onAdd-on to convert text strings and text based DXF entities into Path objects.
These tools depend on the optional Matplotlib package.
import ezdxf
from ezdxf import path, zoom
from ezdxf.tools import fonts
from ezdxf.addons import text2path
doc = ezdxf.new()
msp = doc.modelspace()
# convert a text string into Path() objects
ff = fonts.FontFace(family="Times New Roman")
paths = text2path.make_paths_from_str("text outline as splines", ff)
# add Path() objects to the model space as SPLINE and POLYLINE entities
path.render_splines_and_polylines(msp, paths)
zoom.extents(msp)
doc.saveas('text2path.dxf')

For more information see the documentation
path sub-packageThe usability of the Path class expanded by the introduction
of the reverse conversion from Path to DXF entities (LWPOLYLINE,
POLYLINE, LINE), and many other tools in this release of ezdxf.
To emphasize this new usability, the Path class has got its own
sub-package ezdxf.path.
Path objects from DXF entities, vertices,
Matplotlib or PyQt pathsPath objects Path objects as DXF entities into layoutsPath objects like circles or rectanglesFor more information see the documentation
BSpline construction toolezdxf.math.Bezier3P class is an optimized quadratic Bézier curve
construction tool. ezdxf.math.quadratic_to_cubic_bezier() function converts Bezier3P to
Bezier4P objects.ezdxf.math.bezier_to_bspline() function convert multiple Bézier curves
into a single cubic BSpline objects. The Bézier curves should have at
least G1 continuity at the connection points, to get good results.ezdxf.math.clip_polygon_2d() function implements the Sutherland–Hodgman
algorithm for clipping 2D polygons.ezdxf.math.basic_transformation() function returns a combined
transformation matrix for translation, scaling and rotation about the z-axis.ezdxf.math.best_fit_normal() function returns the normal vector of
flat spatial planes. This function tolerates imperfect plane vertices.ezdxf.entity.Text getter/setter properties is_backward and is_upside_downezdxf.entity.TextStyle getter/setter properties is_backward,
is_upside_down and is_vertical_stacked MPOLYGON support for the drawing add-onMPOLYGON support for the geo add-onfast argument for method MText.plain_text()ATTRIB and ATTDEF entities in DXF R2018 Auditor removes invalid DXF entities from layouts, blocks and the
OBJECTS sectionAuditor removes standalone ATTRIB entities from layouts and blocksDrawing.layers.add() factory method to create new layersDrawing.styles.add() factory method to create new text stylesDrawing.linetypes.add() factory method to create new line typesRenderContext.current_layer to RenderContext.current_layer_properties RenderContext.current_block_reference to RenderContext.current_block_reference_properties GROUPBaseLayout.add_attrib() factory method to add standalone ATTRIB
entities. ATTRIB entities cannot exist as standalone entities.ARC_DIMENSIONArc.flattening() always have to return Vec3 instancesACAD_PROXY_ENTITYMTEXT entities for the drawing add-on.typing_extensionsezdxf.tools.rgb by ezdxf.colorsoptions module renamed to _options; this eliminates the confusion
between the options module and the global object ezdxf.optionsezdxf config command to manage config filesezdxf.path.have_close_control_vertices(a, b), test for close control
vertices of two Path objects EZDXF_AUTO_LOAD_FONTSEZDXF_FONT_CACHE_DIRECTORYEZDXF_PRESERVE_PROXY_GRAPHICSEZDXF_LOG_UNPROCESSED_TAGSEZDXF_FILTER_INVALID_XDATA_GROUP_CODESezdxf.options.default_text_style, was not used ezdxf.options.auto_load_fonts, disabling auto load has no advantageVector alias for Vec3get_acis_data(), set_acis_data() and context manager edit_data()
from ACIS based entities, use acis_data property instead as List[str] or
List[bytes] Spline.construction_tool() recognizes start- and end tangents for
B-splines from fit points if defined dxf2code add-on: function black() and method Code.black_code_str()
returns the code string formatted by Blackezdxf.upright module to flip inverted extrusion vectors, for more
information read the docs PolylinePath.type and EdgePath.type as ezdxf.entities.BoundaryPathType enum LineEdge.type, ArcEdge.type, EllipseEdge.type and SplineEdge.type
as ezdxf.entities.EdgeType enumPath.all_lines_to_curve3(), convert all LINE_TO commands into linear
CURVE3_TO commands Path.all_lines_to_curve4(), convert all LINE_TO commands into linear
CURVE4_TO commandsEZDXF when saving a DXF file by ezdxf CADViewer classGEODATA version 1, perhaps data is incorrect,
logged as warningHATCH spline edge from fit points require start- and end tangentsdisassemble.make_primitive() transform LWPOLYLINE including width
values into WCSHATCH edge paths Dimension.dxf.insert attributemove_to() command and multi-path support for the ezdxf.path.Path class MPOLYGON load/write/create supportezdxf browse FILE, PyQt DXF structure browserezdxf strip FILE [FILE ...], remove comment tags (999) and the
THUMBNAILIMAGE sectionezdxf.tools.text.MTextEditor class, extracted from the MText classMText.set_bg_color(), new argument text_frame to add a text frameMText constants to MTextEditor classMText.set_font() to MTextEditor.change_font()MText.set_color() to MTextEditor.change_color()MText.append_stacked_text() to MTextEditor.stacked_text()drawing add-on, true color values always override ACI colorsdrawing add-on, handle SOLID as OCS entity like TRACEVec2/3.__eq__() (== operator) compares
all components with the full floating point precision, use Vec2/3.isclose()
to take floating point imprecision into account.
This is an annoying but necessary change!Vec2/3.isclose(other, *, rel_tol=1e-9, abs_tol=1e-12),
new argument rel_tol, arguments rel_tol and abs_tol are keyword onlyezdxf.path.add_bezier4p(), add linear Bézier curve segments as LINE_TO commandsezdxf.path.add_bezier3p(), add linear Bézier curve segments as LINE_TO commands$FINGERPRINTGUID matches AutoCAD pattern {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}$VERSIONGUID matches AutoCAD pattern {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}have_bezier_curves_g1_continuity()disassemble.recursive_decompose() was not recursive Frontend font resolver uses XDATA if no regular font file is defined $XCLIPFRAME INSERT (block reference) transformation ezdxf command line launcher, supported commands:pp the previous dxfpp command, the DXF pretty printeraudit DXF filesdraw and convert DXF files by the Matplotlib backend view DXF files by the PyQt viewer text2path add-on to create Path objects from text strings and text
entities, see docsbbox module to detect the extents (bounding boxes) of DXF entities,
see docszoom module to reset the active viewport of layouts,
see docspath sub-package, an extended version of the previous ezdxf.render.path
module, see docsdisassemble, see docsMatplotlib package by default for better font
metric calculation and font rendering if available.EZDXF_AUTO_LOAD_FONTS=False, if this slows down the
interpreter startup too much.Layout.reset_extents(), reset layout extents to the given values,
or the AutCAD default values Layout.reset_limits(), reset layout limits to the given values,
or the AutCAD default values Paperspace.reset_main_viewport(), reset the main viewport of a paper
space layout to custom- or default values Path() classezdxf.entity.Text getter/setter properties is_backward and
is_upside_downezdxf.entity.TextStyle getter/setter properties is_backward,
is_upside_down and is_vertical_stacked ezdxf.math.Bezier3P, optimized quadratic Bézier curve construction tool ezdxf.math.quadratic_to_cubic_bezier(), Bezier3P to Bezier4P converter ezdxf.math.bezier_to_bspline(), Bézier curves to B-spline converterezdxf.math.clip_polygon_2d(), clip polygon by a convex clipping polygon ezdxf.math.basic_transformation(), returns a combined transformation
matrix for translation, scaling and rotation about the z-axisezdxf.math.best_fit_normal(), returns the normal vector of flat spatial planesfit_points_to_cubic_bezier() creates a visual equal SPLINE from fit
points without end tangents like BricsCAD, but only for short B-splines.fit_points_to_cad_cv(), removed unused arguments degree and method ezdxf.render.nesting content moved into the ezdxf.path packageMeshBuilder.render() to MeshBuilder.render_mesh()ezdxf.math.BSpline is immutable, all methods return a new BSpline objectBSplineU() class by factory function ezdxf.math.open_uniform_bspline() BSplineClosed() class by factory function ezdxf.math.closed_uniform_bspline() rational_spline_from_arc() to rational_bspline_from_arc() rational_spline_from_ellipse() to rational_bspline_from_ellipse() ezdxf.math.rational_bspline_from_ellipse() invalid parameter
conversion ezdxf.render.path module, replaced by ezdxf.path packagePath.from_lwpolyline(), replaced by factory path.make_path()Path.from_polyline(), replaced by factory path.make_path()Path.from_spline(), replaced by factory path.make_path()Path.from_ellipse(), replaced by factory path.make_path()Path.from_arc(), replaced by factory path.make_path()Path.from_circle(), replaced by factory path.make_path()Path.add_curve(), replaced by function path.add_bezier4p()Path.add_ellipse(), replaced by function path.add_ellipse()Path.add_spline(), replaced by function path.add_spline()Path.from_vertices(), replaced by factory path.from_vertices()Path.from_hatch_boundary_path(), replaced by factory path.from_hatch()Path.from_hatch_polyline_path()Path.from_hatch_edge_path()BlocksSection.purge(), unsafe operationdxfpp command, replaced by ezdxf pp ...Layout.add_closed_spline(), broken and nobody noticed itLayout.add_closed_rational_spline(), broken and nobody noticed it