After installing PyMeshLab through pip:
import pymeshlab ms = pymeshlab.MeshSet()
You can load, save meshes and apply MeshLab filters:
ms.load_new_mesh('airplane.obj') ms.apply_filter('convex_hull') ms.save_current_mesh('convex_hull.ply')
You can list all the available filters and theirs parameters:
And apply filters with your parameters:
apply_filter function, most of the times, will return an empty dictionary. This is because the filter applied does not need to return anything.
Most of the MeshLab filters will change in some way the state of the MeshSet. The behaviour of how filters change the state is the same of what
happens when applying the same filter in MeshLab. However, some filters return values:
out_dict = ms.apply_filter('compute_geometric_measures') print(out_dict['surface_area'])
For further example usage of the libraries, check the Tutorials page, which provides several use case examples of PyMeshLab.
To run the PyMeshLab tests, you can use
pip3 install pytest pytest --pyargs pymeshlab