PyMeshFix is a Python library that provides bindings to the MeshFix C++ library, enabling robust repair of triangular meshes. It can fix common mesh issues such as holes, self-intersections, and non-manifold edges. The current version is 0.18.0, and it generally sees several releases per year, often aligning with updates to the broader PyVista ecosystem.
pip install pymeshfixVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import `MeshFix`, initialize it with NumPy arrays for vertices and faces, and perform a basic repair operation. Note that `pymeshfix` is typically used to fix complex meshes loaded from files, and this example uses a simple mesh to illustrate the API. The `repair` method can take various parameters to control the fixing process.
Ensure your build environment is compatible with Nanobind requirements if compiling from source. If using pre-built wheels, simply update `pymeshfix` and its dependencies.
When creating or loading face arrays, explicitly cast them to an integer type: `faces = np.array(..., dtype=np.int32)`.
Ensure you are using a Python interpreter version within the supported range (e.g., 3.10, 3.11, 3.12, 3.13, 3.14). Consider using a virtual environment manager like `conda` or `venv` to manage Python versions.
Review the GPL license terms carefully to understand its implications for your project before incorporating PyMeshFix.
Run `pip install pymeshfix` in your terminal to install the library.
Ensure your face array is explicitly cast to `numpy.int32` or `numpy.int64`. Example: `faces = np.array([[0, 1, 2]], dtype=np.int32)`.
Verify your Python version. PyMeshFix currently supports `Python >=3.10, <3.15`. Install a compatible Python version or use a virtual environment with a supported Python version.