cloudViewer.t.io.read_triangle_mesh#

cloudViewer.t.io.read_triangle_mesh(filename: os.PathLike | str | bytes, enable_post_processing: bool = False, print_progress: bool = False) cloudViewer.t.geometry.TriangleMesh#

The general entrance for reading a TriangleMesh from a file. The function calls read functions based on the extension name of filename. Supported formats are obj, ply, stl, off, gltf, glb, fbx.

The following example reads a triangle mesh with the .ply extension:: import cloudViewer as cv3d mesh = cv3d.t.io.read_triangle_mesh(‘mesh.ply’)

Args: filename (str): Path to the mesh file. enable_post_processing (bool): If True enables post-processing.

Post-processing will
  • triangulate meshes with polygonal faces

  • remove redundant materials

  • pretransform vertices

  • generate face normals if needed

For more information see ASSIMPs documentation on the flags aiProcessPreset_TargetRealtime_Fast, aiProcess_RemoveRedundantMaterials, aiProcess_OptimizeMeshes, aiProcess_PreTransformVertices.

Note that identical vertices will always be joined regardless of whether post-processing is enabled or not, which changes the number of vertices in the mesh.

The ply-format is not affected by the post-processing.

print_progress (bool): If True print the reading progress to the terminal.

Returns: Returns the mesh object. On failure an empty mesh is returned.