pyvista/pymeshfix
Python Wrapper for MeshFix: easily repair holes in surface meshes
What it solves
PyMeshFix corrects common flaws in raw digitized 3D mesh models, such as holes, self-intersections, singularities, and degenerate elements. It takes a polygon mesh as input and produces a clean, watertight triangle mesh that bounds a solid object, while leaving defect-free regions untouched.
How it works
It wraps the C++ MeshFix library (v2.1) using Cython, combining C++ speed with Python ease of use. The input can be provided as files or as numpy arrays of vertices and faces. The repair process can be run through a high-level interface (MeshFix class) or a lower-level Cython wrapper (PyTMesh) that gives finer control over steps like filling small boundaries, joining close components, and cleaning self-intersections. Output can be saved to files or returned as arrays, and optionally visualized with PyVista.
Who it’s for
Developers and researchers working with polygon meshes, especially those dealing with raw scanned or digitized 3D data. It is useful for anyone who needs a closed, watertight mesh for further processing, analysis, or 3D printing. The optional PyVista integration makes it convenient for Python users who want plotting and VTK-based workflows.
Highlights
- Brings the speed of C++ MeshFix to Python with easy installation via pip.
- Supports both file-based and in-memory repair with numpy arrays.
- Provides two levels of use: a high-level MeshFix class and a low-level PyTMesh wrapper for fine-grained control.
- Includes examples and optional PyVista integration for direct plotting and mesh loading.
- Based on the award-winning MeshFix algorithm, with several quality-of-life fixes.
Related
- Project
- Project
- Project
- Project