Skip to main content

Microstructure generation and meshing

Project description

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() 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(), 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_vtk() (mesh output)
Implicit fields, TPMS F-rep, booleans
Shape.generate() (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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microgen-2.0.0.dev1.tar.gz (114.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microgen-2.0.0.dev1-py3-none-any.whl (119.2 kB view details)

Uploaded Python 3

File details

Details for the file microgen-2.0.0.dev1.tar.gz.

File metadata

  • Download URL: microgen-2.0.0.dev1.tar.gz
  • Upload date:
  • Size: 114.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for microgen-2.0.0.dev1.tar.gz
Algorithm Hash digest
SHA256 5d03c339f61a6209ed08ff3e33d4e01622f423baf46e411ad930764c69d7c9c4
MD5 d8d4989b4e8bd8c253a5f644744ecf70
BLAKE2b-256 ae482505396403b301b9380dd45dc8528a8c7dfa5d665ca261ea918bc6b200d8

See more details on using hashes here.

File details

Details for the file microgen-2.0.0.dev1-py3-none-any.whl.

File metadata

  • Download URL: microgen-2.0.0.dev1-py3-none-any.whl
  • Upload date:
  • Size: 119.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for microgen-2.0.0.dev1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef6a285d20d3a3f8072f839058c003f60cccc04701866d0a56a01d08da7c970e
MD5 b9b41c3a98aa2d019914af0dd7d46b32
BLAKE2b-256 105e68a342c0bf41111567f0acb23ee3e51481fcd80d955c276ebb6e993ed6ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page