ezdxf.transform
1.1
This module provides functions to apply transformations to multiple DXF entities inplace or to virtual copies of that entities in a convenient and safe way:
import math
import ezdxf
from ezdxf import transform
doc = ezdxf.readfile("my.dxf")
msp = doc.modelspace()
log = transform.inplace(msp, m=transform.Matrix44.rotate_z(math.pi/2))
# or more simple
log = transform.z_rotate(msp, math.pi/2)
All functions handle errors by collecting them in an logging object without raising an error. The input entities are an iterable of ~ezdxf.entities.DXFEntity
, which can be any layout, ~ezdxf.query.EntityQuery
or just a list/sequence of entities and virtual entities are supported as well.
inplace copies translate scale_uniform scale x_rotate y_rotate z_rotate axis_rotate
inplace
copies
translate
scale_uniform
scale
x_rotate
y_rotate
z_rotate
axis_rotate
MIN_SCALING_FACTOR
Minimal scaling factor: 1e-12
NONE
No error, same as a boolean False
, this allows check if error: ...
COPY_NOT_SUPPORTED
Entity without copy support.
TRANSFORMATION_NOT_SUPPORTED
Entity without transformation support.
NON_UNIFORM_SCALING_ERROR
Circular arcs (CIRCLE, ARC, bulges in POLYLINE and LWPOLYLINE entities) cannot be scaled non-uniformly.
INSERT_TRANSFORMATION_ERROR
INSERT entities cannot represent a non-orthogonal target coordinate system. Maybe exploding the INSERT entities (recursively) beforehand can solve this issue, see function ezdxf.disassemble.recursive_decompose
.
VIRTUAL_ENTITY_NOT_SUPPORTED
Transformation not supported for virtual entities e.g. non-uniform scaling for CIRCLE, ARC or POLYLINE with bulges
Logger
A Sequence
of errors as Logger.Entry
instances.
Named tuple representing a logger entry.
error
Error
enum
msg
error message as string
entity
DXF entity which causes the error
__len__
__getitem__
__iter__
messages