Release v0.16.6

By mozman, So 18 Juli 2021, in category Release

bbox, bspline, launcher, path, release, text2path, zoom


The new command line script ezdxf launches various sub-commands:

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":

positional arguments:
    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

Bounding Box Module bbox

This 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(, radius)



For more information see the documentation

Module zoom

Set 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 =
msp = doc.modelspace()
msp.add_circle((1000, 1000), radius=2)


For more information see the documentation

Support Module disassemble

This 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-on

Add-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 import fonts
from ezdxf.addons import text2path

doc =
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)



For more information see the documentation

Extended path sub-package

The 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.

For more information see the documentation

Math Tools

DXF Entity Enhancements

Change Log

Version 0.16.6 - 2021-08-28

Version 0.16.5 - 2021-07-18

Version 0.16.4 - 2021-06-20

Version 0.16.3 - 2021-05-22

Version 0.16.2 - 2021-04-24

Version 0.16.1 - 2021-04-10

Version 0.16 - 2021-03-27