Mesh class

Mesh class

A mesh is made of many n-sided polygons.

Inheritance: MeshGeometryEntitySceneObjectA3DObject

The Mesh type exposes the following members:

Constructors

ConstructorDescription
__init__(self)Initializes a new instance of the Mesh class.
__init__(self, height_map)Construct a mesh using specified height map,
if the height map’s pixel format contains multiple components, the first(usually the red) component will be used as the height value(z)
The control point’s x and y components are normalized pixel coordinate.
__init__(self, height_map, transform)Construct a mesh using specified height map,
if the height map’s pixel format contains multiple components, the first(usually the red) component will be used as the height value(z)
The control point’s x and y components are normalized pixel coordinate.
__init__(self, height_map, tri_mesh, transform)Construct a mesh using specified height map,
if the height map’s pixel format contains multiple components, the first(usually the red) component will be used as the height value(z)
The control point’s x and y components are normalized pixel coordinate.
__init__(self, name)Initializes a new instance of the Mesh class.

Properties

PropertyDescription
nameGets or sets the name.
propertiesGets the collection of all properties.
sceneGets the scene that this object belongs to
parent_nodesGets all parent nodes, an entity can be attached to multiple parent nodes for geometry instancing
excludedGets or sets whether to exclude this entity during exporting.
parent_nodeGets or sets the first parent node, if set the first parent node, this entity will be detached from other parent nodes.
visibleGets or sets if the geometry is visible
deformersGets all deformers associated with this geometry.
cast_shadowsGets or sets whether this geometry can cast shadow
receive_shadowsGets or sets whether this geometry can receive shadow.
vertex_elementsGets all vertex elements
polygon_countGets the count of polygons
polygonsGets the polygons definition of the mesh

Methods

MethodDescription
remove_property(self, property)Removes a dynamic property.
remove_property(self, property)Remove the specified property identified by name
create_element(self, type)Creates a vertex element with specified type and add it to the geometry.
create_element(self, type, mapping_mode, reference_mode)Creates a vertex element with specified type and add it to the geometry.
create_element_uv(self, uv_mapping)Creates a VertexElementUV with given texture mapping type.
create_element_uv(self, uv_mapping, mapping_mode, reference_mode)Creates a VertexElementUV with given texture mapping type.
create_polygon(self, indices, offset, length)Creates a new polygon with all vertices defined in indices.
To create polygon vertex by vertex, please use PolygonBuilder.
create_polygon(self, indices)Creates a new polygon with all vertices defined in indices.
To create polygon vertex by vertex, please use PolygonBuilder.
create_polygon(self, v1, v2, v3, v4)Create a polygon with 4 vertices(quad)
create_polygon(self, v1, v2, v3)Create a polygon with 3 vertices(triangle)
optimize(self, vertex_elements)Optimize the mesh’s memory usage by eliminating duplicated control points
optimize(self, vertex_elements, tolerance_control_point, tolerance_normal, tolerance_uv)Optimize the mesh’s memory usage by eliminating duplicated control points
get_property(self, property)Get the value of specified property
set_property(self, property, value)Sets the value of specified property
find_property(self, property_name)Finds the property.
It can be a dynamic property (Created by CreateDynamicProperty/SetProperty)
or native property(Identified by its name)
get_bounding_box(self)Gets the bounding box of current entity in its object space coordinate system.
get_entity_renderer_key(self)Gets the key of the entity renderer registered in the renderer
get_element(self, type)Gets a vertex element with specified type
get_vertex_element_of_uv(self, texture_mapping)Gets a VertexElementUV instance with given texture mapping type
add_element(self, element)Adds an existing vertex element to current geometry
get_polygon_size(self, index)Gets the vertex count of the specified polygon.
to_mesh(self)Gets the Mesh instance from current entity.
do_boolean(, op, a, transform_a, b, transform_b)
triangulate(self)Return triangulated mesh

Example

To add a polygon in mesh:

from aspose.threed.entities import Mesh

mesh = Mesh()
indices = [0, 1, 2]
mesh.create_polygon(indices)

Travel through all polygons in mesh:

from aspose.threed.entities import Mesh

mesh = Mesh()
for polygon in mesh:
    pass

See Also