Reputation: 13
I tried the simplest sample of Pymeshlab but there is a Exception.
import pymeshlab
ms = pymeshlab.MeshSet()
ms.load_new_mesh('test.obj')
ms.generate_convex_hull()
ms.save_current_mesh('convex_hull.ply')
File "main.py", line 7, in <module>
ms.save_current_mesh('convex_hull.ply')
pymeshlab.pmeshlab.PyMeshLabException
The Exception is strange. It contains nothing.
My obj file is normal. My python version is 3.11.2
Can anyone tell me how to handle it?
Upvotes: 1
Views: 717
Reputation: 3240
I can confirm that this test case is working in my computer, so you can try this to debug your program.
print(ms.current_mesh().vertex_number(),'vertex')
print(ms.current_mesh().face_number(), 'faces')
before and after the call to ms.generate_convex_hull()
. This allows to check that the mesh has been correctly imported and built. Please, note that it is possible that your input mesh is somehow degenerated (for example, in your screenshot, every Z coordinate has the same value).
with open("convex_hull.txt", "w") as f:
print("Test file output", file=f)
print(ms.current_mesh().vertex_number(),'vertex', file=f)
print(ms.current_mesh().face_number(), 'faces', file=f)
Upvotes: 0