Skip to content

mmgpy

Python bindings for the MMG remeshing library.

Get Started API Reference


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, GMSH, and more via meshio

Quick Start

import mmgpy

# Load a mesh from any supported format
mesh = mmgpy.read("input.mesh")

# Remesh with target edge size
result = mesh.remesh(hmax=0.1)
print(f"Quality: {result.quality_mean_before:.2f}{result.quality_mean_after:.2f}")

# Save the result
mesh.save("output.vtk")

Installation

pip install mmgpy
uv pip install mmgpy
# or: uv add mmgpy (project dependency)
# or: uv tool install mmgpy (mmg2d_O3, mmg3d_O3, mmgs_O3 globally)

Mechanical piece remeshing Surface remeshing of a mechanical part

Smooth surface remeshing Smooth surface mesh optimization

3D mesh quality improvement 3D volumetric mesh quality improvement

Learn More