Reputation: 131
I'm trying to load a mesh from an .obj file (from ShapeNet dataset) using Trimesh, and then use the repair.fix_winding(mesh)
function.
But when I load the mesh, via
trimesh.load('/path/to/file.obj')
or trimesh.load_mesh('/path/to/file.obj')
,
the object class returned is Scene, which is incompatible with repair.fix_winding(mesh)
, only Trimesh object are accepted.
How can I force it to load and return a Trimesh object or parse the Scene object to Trimesh object? Or any other way to fix winding of the triangles?
Using:
Python 3.6.5
Trimesh 3.0.14
MacOS 10.14.5
Upvotes: 2
Views: 6125
Reputation: 31
With the current trimesh version (3.9.42), you need to use trimesh.load
with force='mesh'
:
trimesh.load('/path/to/file.obj', force='mesh')
https://trimsh.org/trimesh.html?highlight=load#trimesh.load
Upvotes: 3
Reputation: 1
The load_mesh has an option to be passed as aa Trimesh constructor as explained in the documentation.
https://trimsh.org/trimesh.html?highlight=load_mesh#trimesh.load_mesh
here is an example code
mesh= t.load_mesh('./test.stl',process=False)
mesh.is_watertight
the second line ".is_watertight" is an attribute of Trimesh so you will get True if it is successfully imported as Trimesh.
Upvotes: 0
Reputation: 21
I have the same problem. You can access the "geometry" member of the scene, but I have no idea how the original mesh is split into multiple ones. Following.
Upvotes: 0