Mesh¶
The MESH entity (DXF Reference) is a 3D mesh similar to the Polyface
entity.
All vertices in WCS as (x, y, z) tuples
Changed in version 0.8.9: Mesh
stores vertices, edges, faces and creases as packed data.
Subclass of 

DXF type 

Factory function 

Inherited DXF attributes 

Required DXF version 
DXF R2000 ( 
See also
Tutorial for Mesh and helper classes: MeshBuilder
, MeshVertexMerger

class
ezdxf.entities.
Mesh
¶ 
dxf.
version
¶

dxf.
blend_crease
¶ 0
= off,1
= on

dxf.
subdivision_levels
¶ 0
for no smoothing else integer greater than0
.

vertices
¶ Vertices as list like
VertexArray
. (read/write)

creases
¶ Creases as
array.array
. (read/write)

edit_data
() → ezdxf.entities.mesh.MeshData¶ Context manager various mesh data, returns
MeshData
.Despite that vertices, edge and faces since ezdxf v0.8.9 are accessible as packed data types, the usage of
MeshData
by context manageredit_data()
is still recommended.

MeshData¶

class
ezdxf.entities.
MeshData
¶ 
vertices
¶ A standard Python list with (x, y, z) tuples (read/write)

faces
¶ A standard Python list with (v1, v2, v3,…) tuples (read/write)
Each face consist of a list of vertex indices (= index in
vertices
).

edges
¶ A standard Python list with (v1, v2) tuples (read/write)
Each edge consist of exact two vertex indices (= index in
vertices
).

edge_crease_values
¶ A standard Python list of float values, one value for each edge. (read/write)

add_face
(vertices: Iterable[Sequence[float]]) → Sequence[int]¶ Add a face by coordinates, vertices is a list of
(x, y, z)
tuples.

add_edge
(vertices: Sequence[Sequence[float]]) → Sequence[int]¶ Add an edge by coordinates, vertices is a list of two
(x, y, z)
tuples.

optimize
(precision: int = 6)¶ Tries to reduce vertex count by merging near vertices. precision defines the decimal places for coordinate be equal to merge two vertices.
