open3d.t.io.read_triangle_mesh#
- open3d.t.io.read_triangle_mesh(filename: os.PathLike, enable_post_processing: bool = False, print_progress: bool = False) open3d.cpu.pybind.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 open3d as o3d mesh = o3d.t.io.read_triangle_mesh(‘mesh.ply’)
- Parameters:
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.