pyblenderSDIC.meshes.TriangleMesh3D.triangles#

property TriangleMesh3D.triangles: ndarray#

Get or set the indices of the mesh triangles.

The triangle indices are stored in the triangles attribute of the mesh and have shape (M, 3), where M is the number of triangles.

# Get the triangle indices
triangles = mesh.triangles  # shape (M, 3)

# Set the triangle indices
mesh.triangles = new_triangles
mesh.triangles[0, 0] = 42  # The first triangle's first vertex index is set to 42

Warning

This property uses numpy.asarray on the internal triangles array. As a result, any modification to the returned or setted array directly affects the mesh data. To avoid unintentional updates, assign a copy instead.

Parameters:

value (numpy.ndarray) – A NumPy array of shape (M, 3) representing M triangular triangles defined by vertex indices.