Microgen documentation

Microgen logo

microgen is a Python library designed to facilitate microstructure generation and meshing. Here are its core features:

  • Repeated cells: Generation of lattice structures such as octet trusses and honeycombs.

  • Triply Periodic Minimal Surfaces (TPMS): TPMS-based lattice generation known for favorable physical (mechanical, thermal, …) properties like low density and large surface area.

  • Virtual composites microstructures: Generation of basic reinforcement geometries, including spheres, cylinders, ellipsoids, and more.

  • 3D Voronoi tessellation: Simulation of granular materials and polycrystalline metals.

  • Meshing: Regular and periodic meshing using Gmsh, remeshing using Mmg.

Generation of 3D objects is achievable through functions that utilize Open CASCADE (via cadquery-ocp-novtk, the direct OCCT Python binding) or VTK (using PyVista). Neper offers tools for 3D tessellation, while Gmsh handles the generation of both regular and periodic meshes, with Mmg handling remeshing tasks.

The CAD path (.generate_cad() on shapes, Phase, fuse_shapes, periodic split, lattice CAD) is optional — install with pip install 'microgen[cad]'. The default pip install microgen gives you mesh + implicit-field (F-rep) workflows only, which is sufficient for many applications and has a much lighter dependency footprint (no OCCT, no VTK version pin).

Gyroid TPMS

PyPI package

PyPI

Conda forge package

Conda

Documentation

Documentation

Status

Status

Citation

DOI

License

License

Website

Website

Binder

Binder

Installation

Core (mesh + implicit-field / F-rep, no CAD kernel) — lighter, works with VTK 9.4+:

pip install microgen

With CAD capabilities (OCCT via cadquery-ocp-novtk, enables .generate_cad(), Phase, fuse_shapes, periodic split, lattice CAD):

pip install 'microgen[cad]'

With conda:

conda install conda-forge::microgen          # core
conda install conda-forge::microgen ocp      # core + CAD

Python version notes: Python 3.10 to 3.14 is supported on Linux, macOS (Apple Silicon), and Windows, for both core and [cad], on both PyPI and conda-forge.

What you can do in each mode:

Core install

[cad] install

Shape.generate_surface_mesh() (viz)

Implicit fields, TPMS F-rep, booleans

Shape.generate_cad() (OCCT BREP)

Phase, fuse_shapes, cut_*

Periodic split, lattice CAD export

VTK 9.4+


To modify the sources, clone this repository and install microgen:

git clone https://github.com/3MAH/microgen.git
cd microgen
pip install -e .[all]
pre-commit install

The -e or --editable option allows to modify the sources without having to reinstall the package and [all] installs the optional development dependencies.

Run tests with pytest:

pytest tests -n auto

Examples

Click on the image to be redirected to the corresponding example on microgen’s documentation

Basic shapes

Repeated cells

Strut-based Lattices

Triply Periodic Minimal Surfaces (TPMS)

3D operations

Mesh

Citation

If you use microgen in academic work, please cite it using the concept DOI, which always resolves to the latest archived version on Zenodo:

A BibTeX entry suitable for the latest release:

@software{microgen,
  author    = {Marchais, Kevin and
               Chemisky, Yves and
               Legerstee, Yasmin and
               Guevara Garban, Manuel Ricardo},
  title     = {{microgen: microstructure generation and meshing}},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.6793573},
  url       = {https://doi.org/10.5281/zenodo.6793573}
}

To cite a specific release instead of the concept, follow the concept DOI to its Zenodo page and pick the version DOI for the release you used. Machine-readable metadata is also available in CITATION.cff.

Authors and contributors

microgen is developed by the 3MAH group and external collaborators.

Authors

  • Kevin Marchais

  • Yves Chemisky

  • Yasmin Legerstee

  • Manuel Ricardo Guevara Garban

Contributors

  • Louise Le Barbenchon

  • Karim Haffar

  • Romain d’Esparbès

  • Sudeep Kumar Sahoo

Table of contents

Documentation

Indices and tables