MeshPy offers quality triangular and tetrahedral mesh generation for Python. Meshes of this type are chiefly used in finite-element simulation codes, but also have many other applications ranging from computer graphics to robotics.


The above picture shows a cutaway of a sample mesh generated for an electron gun at the Advanced Photon Source at Argonne National Labs in Illinois.

In order to generate these 2D and 3D meshes, MeshPy provides Python interfaces to two well-regarded mesh generators, Triangle by J. Shewchuk and TetGen by Hang Si. Both are included in the package in slightly modified versions.

MeshPy requires Boost.Python. Parts of this package were written as part of my Diplom thesis. In a former life, this package was called PyAngle.

Obtaining MeshPy

You may download releases from MeshPy’s Python Package Index page, browse the source or directly check out the very latest version using git:

git clone

Documentation and Support

MeshPy now has documentation available. If you still run into trouble, feel free to post to the mailing list. There also is a support forum, which by now only exists in read-only form for posterity.


MeshPy makes scripted mesh generation as easy as never before. This simple code suffices to generate an elementary mesh of a “brick”:

from meshpy.tet import MeshInfo, build

mesh_info = MeshInfo()
    (0,0,0), (2,0,0), (2,2,0), (0,2,0),
    (0,0,12), (2,0,12), (2,2,12), (0,2,12),
mesh = build(mesh_info)

The result of this short script is below: