mmgpy¶
Python bindings for the MMG remeshing library.
Features¶
| 3D Volume Meshing | Tetrahedral remeshing |
| 2D Meshing | Triangular remeshing for planar domains |
| Surface Meshing | 3D surface remeshing and optimization |
| Local Sizing | Sphere, box, cylinder, and point-based refinement |
| Anisotropic Metrics | Custom metric tensors for directional adaptation |
| Level-Set | Extract isosurfaces from implicit functions |
| Lagrangian Motion | Remesh while preserving displacement fields |
| PyVista Integration | Seamless conversion for visualization |
| 40+ File Formats | VTK, STL, OBJ natively; GMSH and more via pyvista[io] |
Quick Start¶
import pyvista as pv
import mmgpy # noqa: F401 -- registers the Medit reader/writer + .mmg accessor
# Load a mesh from any supported format (mmgpy registers a Medit plugin)
mesh = pv.read("input.mesh")
# Remesh with target edge size (returns a fresh dataset)
remeshed = mesh.mmg.remesh(hmax=0.1)
# Save the result
remeshed.save("output.vtk")
Installation¶
Gallery¶
Surface remeshing of a mechanical part
Smooth surface mesh optimization
3D volumetric mesh quality improvement
Learn More¶
- Quick Start — Get started in 5 minutes
- Tutorials — Step-by-step guides
- API Reference — Complete documentation
- Examples — Real-world use cases