<commit_before>.. module:: ezdxf.render
    :noindex:

MeshBuilder
===========

The :class:`MeshBuilder` classes are helper tools to manage meshes buildup by
vertices and faces.
The vertices are stored in a vertices list as :class:`Vec3` instances.
The faces are stored as a sequence of vertex indices which is the location of
the vertex in the vertex list. A single :class:`MeshBuilder` class can contain
multiple separated meshes at the same time.

The method :meth:`MeshBuilder.render_mesh` renders the content as a single DXF
:class:`~ezdxf.entities.Mesh` entity, which supports ngons, ngons are polygons
with more than 4 vertices. This entity requires at least DXF R2000.

The method :meth:`MeshBuilder.render_polyface` renders the content as a single
DXF :class:`~ezdxf.entities.Polyface` entity, which supports only triangles and
quadrilaterals. This entity is supported by DXF R12.

The method :meth:`MeshBuilder.render_3dfaces` renders each face of the mesh as
a single  DXF :class:`~ezdxf.entities.Face3d` entity, which supports only
triangles and quadrilaterals. This entity is supported by DXF R12.

The :class:`MeshTransformer` class is often used as an interface object to
transfer mesh data between functions and moduls, like for the mesh exchange
add-on :mod:`~ezdxf.addons.meshex`.

The basic :class:`MeshBuilder` class does not support transformations.

.. class:: MeshBuilder

    .. attribute:: vertices

        List of vertices as :class:`~ezdxf.math.Vec3` or ``(x, y, z)`` tuple

    .. attribute:: faces

        List of faces as list of vertex indices,  where a vertex index is the
        index of the vertex in the :attr:`vertices` list. A face requires at
        least three vertices, :class:`~ezdxf.entities.Mesh` supports ngons,
        so the count of vertices is not limited.

    .. automethod:: copy

    .. automethod:: diagnose

    .. automethod:: faces_as_vertices

    .. automethod:: open_faces

    .. automethod:: add_vertices

    .. automethod:: add_face

    .. automethod:: add_mesh

    .. automethod:: has_none_planar_faces

    .. automethod:: render_mesh

    .. automethod:: render_polyface

    .. automethod:: render_3dfaces

    .. automethod:: render_normals

    .. automethod:: from_mesh

    .. automethod:: from_polyface

    .. automethod:: from_builder(other: MeshBuilder)

    .. automethod:: flip_normals

    .. automethod:: subdivide

    .. automethod:: merge_coplanar_faces

    .. automethod:: optimize_vertices

    .. automethod:: subdivide_ngons

    .. automethod:: tessellation

    .. automethod:: separate_meshes

    .. automethod:: normalize_faces

    .. automethod:: normals


.. autoclass:: ezdxf.render.mesh.EdgeStat

    .. attribute:: count

        how often the edge `(a, b)` is used in faces as `(a, b)` or `(b, a)`

    .. attribute:: balance

        count of edges `(a, b)` - count of edges `(b, a)` and should be 0 in
        "healthy" closed surfaces, if the balance is not 0, maybe doubled
        coincident faces exist or faces may have mixed clockwise and<commit_msg>sort docs of MeshBuilder methods alphabetical<commit_after>.. module:: ezdxf.render
    :noindex:

MeshBuilder
===========

The :class:`MeshBuilder` classes are helper tools to manage meshes buildup by
vertices and faces.
The vertices are stored in a vertices list as :class:`Vec3` instances.
The faces are stored as a sequence of vertex indices which is the location of
the vertex in the vertex list. A single :class:`MeshBuilder` class can contain
multiple separated meshes at the same time.

The method :meth:`MeshBuilder.render_mesh` renders the content as a single DXF
:class:`~ezdxf.entities.Mesh` entity, which supports ngons, ngons are polygons
with more than 4 vertices. This entity requires at least DXF R2000.

The method :meth:`MeshBuilder.render_polyface` renders the content as a single
DXF :class:`~ezdxf.entities.Polyface` entity, which supports only triangles and
quadrilaterals. This entity is supported by DXF R12.

The method :meth:`MeshBuilder.render_3dfaces` renders each face of the mesh as
a single  DXF :class:`~ezdxf.entities.Face3d` entity, which supports only
triangles and quadrilaterals. This entity is supported by DXF R12.

The :class:`MeshTransformer` class is often used as an interface object to
transfer mesh data between functions and moduls, like for the mesh exchange
add-on :mod:`~ezdxf.addons.meshex`.

The basic :class:`MeshBuilder` class does not support transformations.

.. class:: MeshBuilder

    .. attribute:: vertices

        List of vertices as :class:`~ezdxf.math.Vec3` or ``(x, y, z)`` tuple

    .. attribute:: faces

        List of faces as list of vertex indices,  where a vertex index is the
        index of the vertex in the :attr:`vertices` list. A face requires at
        least three vertices, :class:`~ezdxf.entities.Mesh` supports ngons,
        so the count of vertices is not limited.

    .. automethod:: add_face

    .. automethod:: add_mesh

    .. automethod:: add_vertices

    .. automethod:: copy

    .. automethod:: diagnose

    .. automethod:: faces_as_vertices

    .. automethod:: flip_normals

    .. automethod:: from_builder(other: MeshBuilder)

    .. automethod:: from_mesh

    .. automethod:: from_polyface

    .. automethod:: has_none_planar_faces

    .. automethod:: merge_coplanar_faces

    .. automethod:: normalize_faces

    .. automethod:: normals

    .. automethod:: open_faces

    .. automethod:: optimize_vertices

    .. automethod:: render_3dfaces

    .. automethod:: render_mesh

    .. automethod:: render_normals

    .. automethod:: render_polyface

    .. automethod:: separate_meshes

    .. automethod:: subdivide

    .. automethod:: subdivide_ngons

    .. automethod:: tessellation


.. autoclass:: ezdxf.render.mesh.EdgeStat

    .. attribute:: count

        how often the edge `(a, b)` is used in faces as `(a, b)` or `(b, a)`

    .. attribute:: balance

        count of edges `(a, b)` - count of edges `(b, a)` and should be 0 in
        "healthy" closed surfaces, if the balance is not 0, maybe doubled
        coincident faces exist or faces may have mixed clockwise and
{'fraction_non_alphanumeric': 0.09386164339071126, 'fraction_numerical': 0.005196492367651835, 'mean_word_length': 3.3618980169971673, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2104501', 'n_tokens_mistral': 1857, 'n_tokens_neox': 1736, 'n_words': 690}