A Python package to create/manipulate DXF drawings.
Project description
ezdxf
Abstract
A Python package to create and modify DXF drawings, independent from the DXF version. You can open/save every DXF file without losing any content (except comments), Unknown tags in the DXF file will be ignored but preserved for saving. With this behavior it is possible to open also DXF drawings that contains data from 3rd party applications.
Quick-Info
- ezdxf is a Python package to create new DXF files and read/modify/write existing DXF files
- the intended audience are developers
- requires at least Python 3.6
- OS independent
- tested with CPython & pypy3 on Windows 10 & ubuntu-latest by GitHub Actions
- additional required packages: pyparsing and for testing geomdl (aka NURBS-Python)
- MIT-License
- read/write/new support for DXF versions: R12, R2000, R2004, R2007, R2010, R2013 and R2018
- additional read support for DXF versions R13/R14 (upgraded to R2000)
- additional read support for older DXF versions than R12 (upgraded to R12)
- read/write support for ASCII DXF and Binary DXF
- preserves third-party DXF content
Included Extensions
- The
drawing
add-on is a translation layer to send DXF data to a render backend, interfaces to matplotlib, which can export images as png, pdf or svg, and PyQt5 are implemented. r12writer
add-on to write basic DXF entities direct and fast into a DXF R12 file or streamiterdxf
add-on to iterate over DXF entities of the modelspace of really big (> 5GB) DXF files which do not fit into memoryImporter
add-on to import entities, blocks and table entries from another DXF documentdxf2code
add-on to generate Python code for DXF structures loaded from DXF documents as starting point for parametric DXF entity creation- Plot Style Files (CTB/STB) read/write add-on
A simple example:
import ezdxf
# Create a new DXF document.
doc = ezdxf.new(dxfversion='R2010')
# Create new table entries (layers, linetypes, text styles, ...).
doc.layers.new('TEXTLAYER', dxfattribs={'color': 2})
# DXF entities (LINE, TEXT, ...) reside in a layout (modelspace,
# paperspace layout or block definition).
msp = doc.modelspace()
# Add entities to a layout by factory methods: layout.add_...()
msp.add_line((0, 0), (10, 0), dxfattribs={'color': 7})
msp.add_text(
'Test',
dxfattribs={
'layer': 'TEXTLAYER'
}).set_pos((0, 0.2), align='CENTER')
# Save DXF document.
doc.saveas('test.dxf')
Example for the r12writer, which writes a simple DXF R12 file without in-memory structures:
from random import random
from ezdxf.addons import r12writer
MAX_X_COORD = 1000
MAX_Y_COORD = 1000
with r12writer("many_circles.dxf") as doc:
for _ in range(100000):
doc.add_circle((MAX_X_COORD*random(), MAX_Y_COORD*random()), radius=2)
The r12writer supports only the ENTITIES section of a DXF R12 drawing, no HEADER, TABLES or BLOCKS section is present, except FIXED-TABLES are written, than some additional predefined text styles and line types are available.
Installation
Install with pip for Python 3.6 and later:
pip install ezdxf
Install latest development version with pip from GitHub:
pip install git+https://github.com/mozman/ezdxf.git@master
or from source:
python setup.py install
Website
Documentation
Documentation of development version at https://ezdxf.mozman.at/docs
Documentation of latest release at http://ezdxf.readthedocs.io/
Contribution
The source code of ezdxf can be found at GitHub, target your pull requests to the master
branch:
http://github.com/mozman/ezdxf.git
Feedback
Questions and feedback at Google Groups:
https://groups.google.com/d/forum/python-ezdxf
Questions at Stack Overflow:
Post questions at stack overflow and use the tag dxf
or ezdxf
.
Issue tracker at GitHub:
http://github.com/mozman/ezdxf/issues
Contact
Please post questions at the forum or stack overflow to make answers available to other users as well.
Feedback is greatly appreciated.
Manfred
News
Version 0.14b1 - dev
- Release notes: https://ezdxf.mozman.at/release-v0-14.html
- NEW: DXF attribute setter validation, some special and undocumented Autodesk
table names may raise
ValueError()
exceptions, please report this table names (layers, linetypes, styles, ...). - NEW:
addons.drawing.Frontend()
supports width attributes of LWPOLYLINE and 2D POLYLINE entities - NEW:
TraceBuilder()
a render tool to generate quadrilaterals (TRACE, SOLID or 3DFACE), from LWPOLYLINE or 2D POLYLINE with width information, see docs - NEW:
Path()
a render tool for paths build of lines and cubic Bezier curves, used for faster rendering of LWPOLYLINE, POLYLINE and SPLINE entities for render back-ends, see docs - NEW:
Arc.construction_tool()
returns the 2DConstructionArc()
- NEW:
Arc.apply_construction_tool()
apply parameters fromConstructionArc()
- NEW:
Leader.virtual_entities()
yields 'virtual' DXF primitives - NEW:
Leader.explode()
explode LEADER as DXF primitives into target layout - NEW:
LWPolyline.has_width
property isTrue
if any width attribute is set - NEW:
Polyline.has_width
property isTrue
if any width attribute is set - NEW:
Polyline.audit()
extended verify and repair support - NEW:
DXFVertex.format()
support for user defined point format - NEW:
Drawing.blocks.purge()
delete all unused blocks but protect modelspace- and paperspace layouts, special arrow blocks and DIMENSION and ACAD_TABLE blocks in use, but see also warning in the docs - NEW:
Insert.explode()
support for MINSERT (multi insert) - NEW:
Insert.virtual_entities()
support for MINSERT (multi insert) - NEW:
Insert.mcount
property returns multi insert count - NEW:
Insert.multi_insert()
yields a virtual INSERT entity for each grid element of a MINSERT entity - NEW:
Layout.add_wipeout()
interface to create WIPEOUT entities - NEW:
Image.boundary_path_wcs()
, returns boundary path in WCS coordinates - NEW:
Wipeout.boundary_path_wcs()
, returns boundary path in WCS coordinates - NEW:
Wipeout.set_masking_area()
- NEW:
BSpline.is_clamped
property isTrue
for a clamped (open) B-spline - NEW:
UCS.transform()
general transformation interface - NEW:
Bezier4P.transform()
general transformation interface - NEW:
Bezier4P.reverse()
returns object with reversed control point order - NEW:
Bezier.transform()
general transformation interface - NEW:
Bezier.reverse()
returns object with reversed control point order - NEW:
has_clockwise_orientation(vertices)
returnsTrue
if the closed polygon of 2D vertices has clockwise orientation - NEW:
Path.control_vertices()
returns all control vertices in consecutive order - NEW:
Path.has_clockwise_orientation()
returnsTrue
if 2D path has clockwise orientation - NEW:
Path.reversed()
returns a new reversed path - NEW:
Path.clockwise()
returns a new clockwise oriented path - NEW:
Path.counter_clockwise()
returns a new counter-clockwise oriented path - NEW:
DXFEntity.new_extension_dict()
, create explicit a new extension dictionary - NEW:
ezdxf.reorder
, support module to implement modified entities redraw order - NEW:
ezdxf.recover
, module to load DXF Documents with structural flaws - NEW: get DXF test file path from environment variable
EZDXF_TEST_FILES
, imported automatically asezdxf.EZDXF_TEST_FILES
- CHANGE:
DXFEntity.get_extension_dict()
, raisesAttributeError
if entity has no extension dictionary - CHANGE:
DXFEntity.has_extension_dict
is now a property not a method - CHANGE:
linspace()
usesDecimal()
for precise calculations, but still returns an iterable offloat
- CHANGE:
Drawing.blocks.delete_all_blocks()
, unsafe mode is disabled and argumentsafe
is deprecated, will be removed in v0.16 - CHANGE: Dictionary raise
DXFValueError
for adding invalid handles - CHANGE:
BaseLayout.add_entity()
will bind entity automatically to doc/db if possible - CHANGE: handle all layout names as case insensitive strings:
Model == MODEL
- DEPRECATED:
legacy_mode
inezdxf.read()
andezdxf.readfile()
, use theezdxf.recover
module to load DXF Documents with structural flaws - REMOVE: Alias
DXFEntity.drawing
- REMOVE:
DXFEntity.entitydb
- REMOVE:
DXFEntity.dxffactory
- REMOVE:
DXFInvalidLayerName
, replaced byDXFValueError
- REMOVE:
Image.get_boundary_path()
, replaced by propertyImage.boundary_path
- REMOVE:
Image.get_image_def()
, replaced by propertyImage.image_def
- REMOVE:
filter_stack
argument inezdxf.read()
andezdxf.readfile()
Version 0.13.1 - 2020-07-18
- Release notes: https://ezdxf.mozman.at/release-v0-13.html
- BUGFIX: remove white space from structure tags like
"SECTION "
- BUGFIX:
MeshBuilder.from_polyface()
processing error of POLYMESH entities
Version 0.13 - 2020-07-04
- Release notes: https://ezdxf.mozman.at/release-v0-13.html
- NEW: general transformation interface:
DXFGraphic.transform(m)
, transform entity by a transformation matrixm
inplace - NEW: specialized entity transformation interfaces:
DXFGraphic.translate(dx, dy, dz)
DXFGraphic.scale(sx, sy, sz)
DXFGraphic.scale_uniform(s)
DXFGraphic.rotate_axis(axis, angle)
DXFGraphic.rotate_x(angle)
DXFGraphic.rotate_y(angle)
DXFGraphic.rotate_z(angle)
- NEW: drawing add-on by Matt Broadway is a translation layer to send DXF data to a render backend, supported backends for now: matplotlib and PyQt5, both packages are optional and not required to install ezdxf.
- NEW:
DXFGraphic.unlink_from_layout()
to unlink entity from associated layout - NEW:
Arc.angles(num)
, yieldsnum
angles from start- to end angle in counter clockwise order - NEW:
Circle.to_ellipse()
, convert CIRCLE/ARC to ELLIPSE entity - NEW:
Circle.to_spline()
, convert CIRCLE/ARC to SPLINE entity - NEW:
Ellipse.params(num)
, yieldsnum
params from start- to end param in counter clockwise order - NEW:
Ellipse.construction_tool()
, return ellipse data asConstructionEllipse()
- NEW:
Ellipse.apply_construction_tool()
, applyConstructionEllipse()
data - NEW:
Ellipse.to_spline()
, convert ELLIPSE to SPLINE entity - NEW:
Ellipse.from_arc()
, create a new ELLIPSE entity from CIRCLE or ARC entity (constructor) - NEW:
Spline.construction_tool()
, return spline data asezdxf.math.BSpline()
- NEW:
Spline.apply_construction_tool()
, applyezdxf.math.BSpline()
data - NEW:
Spline.from_arc()
, create a new SPLINE entity from CIRCLE, ARC or ELLIPSE entity (constructor) - NEW:
Hatch.set_pattern_scale()
to set scaling of pattern definition - NEW:
Hatch.set_pattern_angle()
to set rotation angle of pattern definition - NEW:
Hatch.paths.polyline_to_edge_path()
convert polyline paths with bulge values to edge paths with lines and arcs - NEW:
Hatch.paths.arc_edges_to_ellipse_edges()
convert arc edges to ellipse edges - NEW:
Hatch.paths.ellipse_edges_to_spline_edges()
convert ellipse edges to spline edges - NEW:
Hatch.paths.all_to_spline_edges()
convert all curves to approximated spline edges - NEW:
Hatch.paths.all_to_line_edges()
convert all curves to approximated line edges - NEW:
Text.plain_text()
returns text content without formatting codes - NEW:
ezdxf.math.ConstructionEllipse()
- NEW:
ezdxf.math.linspace()
likenumpy.linspace()
- NEW:
ezdxf.math.global_bspline_interpolation()
supports start- and end tangent constraints - NEW:
ezdxf.math.estimate_tangents()
curve tangent estimator for given fit points - NEW:
ezdxf.math.estimate_end_tangent_magnitude()
curve end tangent magnitude estimator for given fit points - NEW:
ezdxf.math.rational_spline_from_arc()
returns a rational B-spline for a circular arc - NEW:
ezdxf.math.rational_spline_from_ellipse()
returns a rational B-spline for an elliptic arc - NEW:
ezdxf.math.local_cubic_bspline_interpolation()
- NEW:
ezdxf.math.cubic_bezier_from_arc()
returns an approximation for a circular 2D arc by multiple cubic Bezier curves - NEW:
ezdxf.math.cubic_bezier_from_ellipse()
returns an approximation for an elliptic arc by multiple cubic Bezier curves - NEW:
ezdxf.math.cubic_bezier_interpolation()
returns an interpolation curve for arbitrary data points as multiple cubic Bezier curves - NEW:
ezdxf.math.LUDecomposition
linear equation solver, for more linear algebra tools see moduleezdxf.math.linalg
- NEW:
ezdxf.render.random_2d_path()
generate random 2D path for testing purpose - NEW:
ezdxf.render.random_3d_path()
generate random 3D path for testing purpose - NEW:
BSpline()
uses normalized knot vector for 'clamped' curves by default (open uniform knots) - NEW:
BSpline.points()
compute multiple points - NEW:
BSpline.derivative()
compute point and derivative up to n <= degree - NEW:
BSpline.derivatives()
compute multiple points and derivatives up to n <= degree - NEW:
BSpline.params()
return evenly spaced B-spline params from start- to end param - NEW:
BSpline.reverse()
returns a new reversed B-spline - NEW:
BSpline.from_arc()
B-spline from an arc, best approximation with a minimum number of control points - NEW:
BSpline.from_ellipse()
B-spline from an ellipse, best approximation with a minimum number of control points - NEW:
BSpline.from_fit_points()
B-spline from fit points - NEW:
BSpline.arc_approximation()
B-spline approximation from arc vertices as fit points - NEW:
BSpline.ellipse_approximation()
B-spline approximation from ellipse vertices as fit points - NEW:
BSpline.transform()
transform B-spline by transformation matrix inplace - NEW:
BSpline.transform()
transform B-spline by transformation matrix inplace - NEW:
BSpline.to_nurbs_python_curve()
andBSpline.from_nurbs_python_curve()
, interface to NURBS-Python,NURBS-Python
is now a testing dependency - NEW:
BSpline.bezier_decomposition()
decompose a non-rational B-spline into multiple Bezier curves - NEW:
BSpline.cubic_bezier_approximation()
approximate any B-spline by multiple cubic Bezier curves - NEW:
Bezier.points()
compute multiple points - NEW:
Bezier.derivative()
compute point, 1st and 2nd derivative for one parameter - NEW:
Bezier.derivatives()
compute point and derivative for multiple parameters - CHANGE:
Hatch
full support for rotated patterns. - CHANGE:
Hatch.set_pattern_definition()
added argumentangle
for pattern rotation. - CHANGE:
Hatch.path.add_arc
renamed argumentis_counter_clockwise
toccw
, typebool
andTrue
by default - CHANGE:
Hatch.path.add_ellipse
renamed argumentis_counter_clockwise
toccw
, typebool
andTrue
by default - CHANGE: renamed 2D
ConstructionXXX.move()
methods totranslate()
- CHANGE: renamed old
Insert.scale()
toInsert.set_scale()
, name conflict with transformation interface - CHANGE: renamed
Spline.set_periodic()
toSpline.set_closed()
- CHANGE: renamed
Spline.set_periodic_rational()
toSpline.set_closed_rational()
- CHANGE: renamed
ezdxf.math.bspline_control_frame()
toezdxf.math.global_bspline_interpolation()
- REMOVED:
ezdxf.math.Matrix33
class,UCS
andOCS
usesMatrix44
for transformations - REMOVED:
ezdxf.math.BRCS
class andInsert.brcs()
- REMOVED:
ezdxf.math.ConstructionTool
base class - REMOVED:
ezdxf.math.normalize_angle(angle)
, replace call by expression:angle % math.tau
- REMOVED:
ezdxf.math.DBSpline
, integrated asBSpline.derivatives()
- REMOVED:
ezdxf.math.DBSplineU
, integrated asBSplineU.derivatives()
- REMOVED:
ezdxf.math.DBSplineClosed
, integrated asBSplineClosed.derivatives()
- REMOVED:
ezdxf.math.DBezier
, integrated asBezier.derivatives()
- REMOVED:
BaseLayout.add_spline_approx()
, incorrect and nobody noticed it - so it's not really needed, if required use thegeomdl.fitting.approximate_curve()
function from the package NURBS-Python, see exampleusing_nurbs_python.py
- REMOVED:
ezdxf.math.bspline_control_frame_approx()
, incorrect and nobody noticed it - so it's not really needed - DEPRECATED:
DXFGraphic.transform_to_wcs(ucs)
, replace call byDXFGraphic.transform(ucs.matrix)
- DEPRECATED:
non_uniform_scaling
argument forInsert.explode()
- DEPRECATED:
non_uniform_scaling
argument forInsert.virtual_entities()
- DEPRECATED: getter and edit methods in
Hatch
for attributespaths
,gradient
,pattern
andseeds
- DEPRECATED:
Spline.edit_data()
all attributes accessible by properties - BUGFIX:
ezdxf.math.intersection_ray_ray_3d()
- BUGFIX:
Spline.set_periodic()
created invalid data for BricsCAD - misleading information by Autodesk
Version 0.12.5 - 2020-06-05
- BUGFIX: DXF export error for hatches with rational spline edges
Version 0.12.4 - 2020-05-22
- BUGFIX: structure validator for XRECORD
Version 0.12.3 - 2020-05-16
- BUGFIX: DXF R2010+ requires zero length tag 97 for HATCH/SplineEdge if no fit points exist (vshu3000)
- BUGFIX: Export order of XDATA and embedded objects (vshu3000)
- BUGFIX: ATTRIB and ATTDEF did not load basic DXF attributes
- NEW:
BlockLayout()
propertiescan_explode
andscale_uniformly
- NEW:
Hatch.remove_association()
Version 0.12.2 - 2020-05-03
- BUGFIX:
XData.get()
now raisesDXFValueError
for not existing appids, like all other methods of theXData()
class - BUGFIX:
Layer.description
returns an empty string for unknown XDATA structure inAcAecLayerStandard
- BUGFIX: Initialize/Load
Hatch
edge coordinates asVec2()
objects - BUGFIX: typo in 3 point angular dimension subclass marker (vshu3000)
- BUGFIX: HATCH/SplineEdge did export length tag 97 if no fit points exist, creates invalid DXF for AutoCAD/BricsCAD (vshu3000)
- BUGFIX: Ellipse handling in
virtual_block_reference_entities()
(Matt Broadway)
Version 0.12.1 - 2020-04-25
- BUGFIX: fixed uniform scaled ellipse handling in
explode.virtual_block_reference_entities()
- BUGFIX: fixed crash caused by floating point inaccuracy in
Vector.angle_between()
(Matt Broadway) - BUGFIX: fixed crash for axis transformation of nearly perpendicular ellipse axis
- BUGFIX: fixed
Hatch.has_critical_elements()
Version 0.12 - 2020-04-12
- Release notes: https://ezdxf.mozman.at/release-v0-12.html
- NEW:
Insert.block()
returns associatedBlockLayout()
orNone
if block not exist or is an XREF - NEW:
Insert.has_scaling
returnsTrue
if any axis scaling is applied - NEW:
Insert.has_uniform_scaling
returnsTrue
if scaling is uniform in x-, y- and z-axis. - NEW:
Insert.scale(factor)
set uniform scaling. - NEW:
Insert.virtual_entities()
yields 'virtual' entities of a block reference (experimental) - NEW:
Insert.explode()
explode block reference entities into target layout (experimental) - NEW:
Insert.add_auto_attribs()
add ATTRIB entities defined as ATTDEF in the block layout and fill tags with values defined by adict
(experimental) - NEW:
LWPolyline.virtual_entities()
yields 'virtual' LINE and ARC entities - NEW:
LWPolyline.explode()
explode LWPOLYLINE as LINE and ARC entities into target layout - NEW:
Polyline.virtual_entities()
yields 'virtual' LINE, ARC or 3DFACE entities - NEW:
Polyline.explode()
explode POLYLINE as LINE, ARC or 3DFACE entities into target layout - NEW:
Dimension.virtual_entities()
yields 'virtual' DXF entities - NEW:
Dimension.explode()
explode DIMENSION as basic DXF entities into target layout - NEW:
Dimension.transform_to_wcs()
support for UCS based entity transformation - NEW:
Dimension.override()
returnsDimStyleOverride()
object - NEW:
Dimension.render()
render graphical representation as anonymous block - NEW:
Block()
propertiesis_anonymous
,is_xref
andis_xref_overlay
- NEW:
R12FastStreamWriter.add_polyline_2d()
, add 2D POLYLINE with start width, end width and bulge value support - NEW:
Ellipse.minor_axis
property returns minor axis asVector
- NEW: Option
ezdxf.options.write_fixed_meta_data_for_testing
, writes always same timestamps and GUID - NEW: Support for loading and exporting proxy graphic encoded as binary data, by default disabled
- NEW:
ezdxf.proxygraphic.ProxyGraphic()
class to examine binary encoded proxy graphic (Need more example data for testing!) - NEW: Get/set hyperlink for graphic entities
- NEW:
odafc
add-on to use an installed ODA File Converter for reading and writing DWG files - NEW: Support for reading and writing Binary DXF files
- NEW: Binary DXF support for
r12writer
add-on - CHANGE:
R12FastStreamWriter.add_polyline()
, add 3D POLYLINE only, closed flag support - CHANGE: renamed
Insert.ucs()
toInsert.brcs()
which now returns aBRCS()
object - CHANGE:
Polyline.close()
,Polyline.m_close()
andPolyline.n_close()
can set and clear closed state. - BUGFIX:
Dimension.destroy()
should not not destroy associated anonymous block, because if DIMENSION is used in a block, the anonymous block may be used by several block references - BUGFIX: floating point precision error in
intersection_line_line_2d()
- BUGFIX: attribute error in
Polyline.transform_to_wcs()
for 2d polylines - BUGFIX: LWPOLYLINE was always exported with
const_width=0
- BUGFIX:
Face3d.set_edge_visibility()
set inverted state (visible <-> invisible) - BUGFIX: Load
AcDbEntity
group codes from base class
Version 0.11.2 - 2020-04-03
- BUGFIX: upgrade error from DXF R13/14 to R2000
Version 0.11.1 - 2020-02-29
- NEW:
Meshbuilder.from_polyface()
to interface toPOLYFACE
andPOLYMESH
- NEW:
Meshbuilder.render_polyface()
createPOLYFACE
objects - NEW:
MeshAverageVertexMerger()
an extended version ofMeshVertexMerger()
, location of merged vertices is the average location of all vertices with the same key - NEW:
ezdxf.addons.iterdxf
iterate over modelspace entities of really big DXF files (>1 GB) without loading them into memory - NEW:
ezdxf.addons.r12writer
supportsPOLYFACE
andPOLYMESH
entities - NEW:
Layout.add_foreign_entity()
copy/move simple entities from another DXF document or add unassigned DXF entities to a layout - NEW:
MText.plain_text()
returns text content without formatting codes - CHANGE: refactor Auditor() into a DXF document fixer, fixes will be applied automatically (work in progress)
- CHANGE: moved
r12writer
intoaddons
subpackage - CHANGE: moved
acadctb
intoaddons
subpackage
Version 0.11 - 2020-02-15
- Release notes: https://ezdxf.mozman.at/release-v0-11.html
- Using standard git branches:
master
: development statestable
: latest stable release
- Requires Python 3.6
- NEW:
Dimension.get_measurement()
supports angular, angular3p and ordinate dimensions - NEW:
Layout.add_radius_dim()
implemented - NEW: shortcut calls
Layout.add_radius_dim_2p()
andLayout.add_radius_dim_cra()
- NEW:
Layout.add_diameter_dim()
implemented - NEW: shortcut
Layout.add_diameter_dim_2p()
- NEW:
Circle.vertices(angles)
yields vertices for iterable angles in WCS - NEW:
Ellipse.vertices(params)
yields vertices for iterable params in WCS - NEW: Arc properties
start_point
andend_point
returns start- and end point of arc in WCS - NEW: Ellipse properties
start_point
andend_point
returns start- and end point of ellipse in WCS - NEW: user defined point format support for 2d POLYLINE entities:
add_polyline2d([(1, 2, 0.5), (3, 4, 0)], format='xyb')
- NEW:
Polyline.append_formatted_points()
with user defined point format support - NEW:
Drawing.set_modelspace_vport(height, center)
set initial view/zoom location for the modelspace - NEW: support for associating HATCH boundary paths to geometry entities
- NEW:
Drawing.output_encoding
returns required output encoding - NEW: User Coordinate System (UCS) based entity transformation, allows to work with UCS coordinates, which are
simpler if the UCS is chosen wisely, and transform them later into WCS coordinates. Entities which have a
transform_to_wcs(ucs)
method, automatically take advantage of the new UCS transformation methods, but not all entity types are supported, embedded ACIS entities like 3DSOLID, REGION, SURFACE and so on, do not expose their geometry. - NEW:
transform_to_wcs(ucs)
implemented for: 3DFACE, ARC, ATTDEF, ATTRIB, CIRCLE, ELLIPSE, HATCH, IMAGE, INSERT, LEADER, LINE, LWPOLYLINE, MESH, MTEXT, POINT, POLYLINE, RAY, SHAPE, SOLID, SPLINE, TEXT, TRACE, XLINE - NEW:
UCS.rotate(axis, angle)
returns a new UCS rotated around WCS vectoraxis
- NEW:
UCS.rotate_local_x(angle)
returns a new UCS rotated around local x-axis - NEW:
UCS.rotate_local_y(angle)
returns a new UCS rotated around local y-axis - NEW:
UCS.rotate_local_z(angle)
returns a new UCS rotated around local z-axis - NEW:
UCS.copy()
returns a new copy of UCS - NEW:
UCS.shift(delta)
shifts UCS inplace by vectordelta
- NEW:
UCS.moveto(location)
set new UCS origin tolocation
inplace - NEW:
size
andcenter
properties for bounding box classes - NEW:
Insert.ucs()
returns an UCS placed in block referenceinsert
location, UCS axis aligned to the block axis. - NEW:
Insert.reset_transformation()
reset block reference location, rotation and extrusion vector. - CHANGE: renamed
ezdxf.math.left_of_line
toezdxf.math.is_point_left_of_line
- NEW:
ezdxf.math.point_to_line_relation()
2D function returns-1
for left oft line,+1
for right oif line ,0
on the line - NEW:
ezdxf.math.is_point_on_line_2d()
test if 2D point is on 2D line - NEW:
ezdxf.math.distance_point_line_2d()
distance of 2D point from 2D line - NEW:
ezdxf.math.is_point_in_polygon_2d()
test if 2D point is inside of a 2D polygon - NEW:
ezdxf.math.intersection_line_line_2d()
calculate intersection for 2D lines - NEW:
ezdxf.math.offset_vertices_2d()
calculate 2D offset vertices for a 2D polygon - NEW:
ezdxf.math.normal_vector_3p()
returns normal vector for 3 points - NEW:
ezdxf.math.is_planar_face()
test if 3D face is planar - NEW:
ezdxf.math.subdivide_face()
linear subdivision for 2D/3D faces/polygons - NEW:
ezdxf.math.intersection_ray_ray_3d()
calculate intersection for 3D rays - NEW:
ezdxf.math.Plane()
3D plane construction tool - NEW:
ezdxf.render.MeshTransformer()
inplace mesh transformation class, subclass ofMeshBuilder()
- NEW:
MeshBuilder.render()
added UCS support - NEW:
MeshBuilder.render_normals()
render face normals as LINE entities, useful to check face orientation - NEW:
ezdxf.render.forms.cone_2p()
create 3D cone mesh from two points - NEW:
ezdxf.render.forms.cylinder_2p()
create 3D cylinder mesh from two points - NEW:
ezdxf.render.forms.sphere()
create 3D sphere mesh - NEW:
pycsg
add-on, a simple Constructive Solid Geometry (CSG) kernel created by Evan Wallace (Javascript) and Tim Knip (Python) - CHANGE: Changed predefined pattern scaling to BricsCAD and AutoCAD standard, set global option
ezdxf.options.use_old_predefined_pattern_scaling
to True, to use the old pattern scaling before v0.11 - CHANGE: removed
ezdxf.PATTERN
constant, usePATTERN = ezdxf.pattern.load()
instead, set argumentold_pattern=True
to use the old pattern scaling before v0.11 - CHANGE:
Table.key()
accepts only strings, therefore tables checkin
accepts also only strings likeentity.dxf.name
- NEW: load DXF comments from file (
ezdxf.comments.from_file
) or stream (ezdxf.comments.from_stream
) - BUGFIX: fixed incorrect HATCH pattern scaling
- BUGFIX: fixed base point calculation of aligned dimensions
- BUGFIX: fixed length extension line support for linear dimensions
- BUGFIX:
UCS.to_ocs_angle_deg()
andUCS.to_ocs_angle_rad()
- BUGFIX: check for unsupported DXF versions at
new()
- BUGFIX: fixed dxf2src error for the HATCH entity
- BUGFIX:
is_point_left_of_line()
algorithm was incorrect - BUGFIX: default
dimtxsty
isStandard
ifoptions.default_dimension_text_style
is not defined - BUGFIX: default arrows for minimal defined dimstyles are closed filled arrows
- BUGFIX: use
Standard
as default for undefined dimension styles, e.g.EZDXF
without setup
Version 0.10.4 - 2020-01-31
- BUGFIX: height group code (40) for TEXT, ATTRIB and ATTDEF is mandatory
Version 0.10.3 - 2020-01-29
- BUGFIX: min DXF version for VISUALSTYLE object is R2000
Version 0.10.2 - 2019-10-05
- NEW:
Dimension.get_measurement()
returns the actual dimension measurement in WCS units, no scaling applied; angular and ordinate dimension are not supported yet. - BUGFIX: ordinate dimension exports wrong feature location
- BUGFIX:
Hatch.set_pattern_fill()
did not set pattern scale, angle and double values
Version 0.10.1 - 2019-09-07
- BUGFIX: group code for header var $ACADMAINTVER is 90 for DXF R2018+ and 70 for previous DXF versions. This is a critical bug because AutoCAD 2012/2013 (and possibly earlier versions) will not open DXF files with the new group code 90 for header variable $ACADMAINTVER.
Version 0.10 - 2019-09-01
- Release notes: https://ezdxf.mozman.at/release-v0-10.html
- unified entity system for all DXF versions
- saving as later DXF version than the source DXF version is possible, but maybe data loss if saving as an older DXF version than source DXF version (ezdxf is not a DXF converter)
- templates no more needed and removed from package
- CHANGE:
DXFEntity
- renamed
DXFEntity.drawing
toDXFEntity.doc
DXFEntity.get_xdata()
keywordxdata_tag
renamed totags
DXFEntity.set_xdata()
keywordxdata_tag
renamed totags
- renamed
DXFEntity.remove_reactor_handle()
renamed toDXFEntity.discard_reactor_handle()
DXFEntity.get_extension_dict()
returnsExtensionDict
object instead of the raw DICTIONARY object- renamed
DXFEntity.supports_dxf_attrib()
toDXFEntity.is_supported_dxf_attrib()
- renamed
DXFEntity.dxf_attrib_exists()
toDXFEntity.has_dxf_attrib()
- renamed
- CHANGE:
Layer
entity- removed
Layer.dxf.line_weight
as synonym forLayer.dxf.lineweight
- renamed
Layer.dxf.plot_style_name
toLayer.dxf.plotstyle_handle
- renamed
Layer.dxf.material
toLayer.dxf.material_handle
- removed
- CHANGE: same treatment of
Viewport
entity for all DXF versions - CHANGE:
Polyline.vertices()
is now an attributePolyline.vertices
, implemented as regular Python list. - CHANGE:
Insert.attribs()
is now an attributeInsert.attribs
, implemented as regular Python list. - CHANGE: renamed
Viewport.dxf.center_point
toViewport.dxf.center
- CHANGE: renamed
Viewport.dxf.target_point
toViewport.dxf.target
- CHANGE: direct access to hatch paths (
Hatch.paths
), pattern (Hatch.pattern
) and gradient (Hatch.gradient
), context manager to edit this data is not needed anymore, but still available for backward compatibility - CHANGE: Options
- removed
template_dir
, no more needed - new
log_unprocessed_tags
to log unprocessed (unknown) DXF tags
- removed
- CHANGE:
Dimension()
removes associated anonymous dimension block at deletion - CHANGE: safe block deletion protects not explicit referenced blocks like anonymous dimension blocks and arrow blocks
- CHANGE:
Importer
add-on rewritten, API incompatible to previous ezdxf versions, but previous implementation was already broken - CHANGE: moved
add_attdef()
to generic layout interface, adding ATTDEF to model- and paperspace is possible - CHANGE: entity query - exclude DXF types from
'*'
search, by appending type name with a preceding '!' e.g. query for all entities except LINE ="* !LINE"
- CHANGE: entity query - removed regular expression support for type name match
- CHANGE: integration of
MTextData
methods intoMText
- CHANGE: removed
edit_data
,get_text
,set_text
methods fromMText
- restructured package, module and test file organization
- NEW: support for
Layer.dxf.true_color
andLayer.dxf.transparency
attributes (DXF R2004+, undocumented) - NEW:
Layer.rgb
,Layer.color
,Layer.description
andLayer.transparency
properties - NEW: renaming a
Layer
also renames references to this layer, but use with care - NEW: support for adding LEADER entities
- NEW:
Dimension.get_geometry_block()
, returns the associated anonymous dimension block orNone
- NEW:
EntityQuery()
gotfirst
andlast
properties, to get first or last entity orNone
if query result is empty - NEW: added
ngon()
,star()
andgear()
toezdxf.render.forms
- NEW: 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!
- NEW: support for named plot style files (STB)
- NEW: can open converted Gerber DXF files tagged as "Version 1.0, Gerber Technology."
- BUGFIX: fixed MTEXT and GEODATA text splitting errors (do not split at '^')
- BUGFIX: fixed some subclass errors, mostly DXF reference errors
- BUGFIX: VERTEX entity inherit
owner
andlinetype
attribute from POLYLINE entity - BUGFIX: MTEXT - replacement of
\n
by\P
at DXF export to avoid invalid DXF files. - tested with CPython 3.8
- removed batch files (.bat) for testing, use
tox
command instead
Version 0.9 - 2019-02-24
- Release notes: https://ezdxf.mozman.at/release-v0-9.html
- IMPORTANT: Python 2 support REMOVED, if Python 2 support needed: add
ezdxf<0.9
to yourrequirements.txt
- NEW: testing on Manjaro Linux in a VM by tox
- CHANGE: converted NEWS.rst to NEWS.md and README.rst to README.md
- CHANGE: moved
Importer()
fromezdxf.tools
toezdxf.addons
- internal structures of modern DXF files are too complex and too undocumented to support importing data in a reliable way - usingImporter()
may corrupt your DXF files or just don't work! - NEW: type annotations to core package and add-ons.
- NEW: argument
setup
inezdxf.new('R12', setup=True)
to setup default line types, text styles and dimension styles, this feature is disabled by default. - NEW: Duplicate table entries:
dwg.styles.duplicate_entry('OpenSans', new_name='OpenSansNew')
, this works for all tables, but is intended to duplicate STYLES and DIMSTYLES. - CHANGED: replaced proprietary fonts in style declarations by open source fonts
- NEW: open source fonts to download https://github.com/mozman/ezdxf/tree/master/fonts
- OpenSansCondensed-Light font used for default dimension styles
- NEW: subpackage
ezdxf.render
, because of DIMENSION rendering - NEW: support for AutoCAD standard arrows
- NEW: support for creating linear DIMENSION entities
- NEW: background color support for MTEXT
- CHANGE: DXF template cleanup, removed non standard text styles, dimension styles, layers and blocks
- CHANGE: text style STANDARD uses
txt
font - CHANGE: renamed subpackage
ezdxf.algebra
toezdxf.math
- CHANGE: moved
addons.curves
torender.curves
- CHANGE: moved
addons.mesh
torender.mesh
- CHANGE: moved
addons.r12spline
torender.r12spline
- CHANGE: moved
addons.forms
torender.forms
- CHANGE: renamed construction helper classes into Construction...()
Ray2D()
renamed toConstructionRay()
Circle()
renamed toConstructionCircle()
Arc()
renamed toConstructionArc()
- NEW: construction tools
ConstructionLine()
andConstructionBox()
- REMOVED:
almost_equal
usemath.isclose
- REMOVED:
almost_equal_points
useezdxf.math.is_close_points
- BUGFIX: closed LWPOLYLINE did not work in AutoCAD (tag order matters), introduced with v0.8.9 packed data structure
- BUGFIX:
UCS.to_ocs_angle_deg()
corrected
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.