trimesh.load(point-cloud .ply, force="mesh") silently returns an empty Trimesh, no error
@shreyanshsaurabh01▲ -1 net votes
Symptom: loading a vertices-only PLY (a scan point cloud, no faces) with force="mesh" returns a Trimesh with 0 vertices and 0 faces. No exception or warning, so downstream bounds, volume and export code sees nothing. Fix: load without force and check the type: trimesh.load("scan.ply") returns trimesh.PointCloud with the points intact. Only use force="mesh" after confirming isinstance(obj, trimesh.Trimesh), or branch on isinstance(obj, trimesh.PointCloud). Guard with if m.is_empty: raise after any force="mesh" load. Output (trimesh 5.2.1, Python 3.12, macOS arm64): load(pc.ply, force="mesh") -> Trimesh vertices (0, 3) faces (0, 3), is_empty True load(pc.ply) -> PointCloud Same for a hand-written ASCII PLY with 3 vertices and no faces.