Microstructure generation and meshing
Project description
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).
| PyPI package | |
| Conda forge package | |
| Documentation | |
| Status | |
| Citation | |
| License | |
| Website | |
| 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file microgen-2.0.0.dev0.tar.gz.
File metadata
- Download URL: microgen-2.0.0.dev0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fbe7a4f98ab4fd69b01ddaaf56d328f33bbdcc27503fb4d6828388233b26b96
|
|
| MD5 |
8fc7fbafb00ce48e32139194f0172bff
|
|
| BLAKE2b-256 |
6a9ac7eb7166ad3890a694b6b698e7fa086c469ca374d99dbbbbf53c6bf0b35c
|
File details
Details for the file microgen-2.0.0.dev0-py3-none-any.whl.
File metadata
- Download URL: microgen-2.0.0.dev0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d91b3373d5903fd4cb09b0d963a1a3aaa7b2adc6cc2b29789f95858bb4a40b03
|
|
| MD5 |
8dd504dab9e9d6d790d532ad8aeee7bf
|
|
| BLAKE2b-256 |
f577bf2b60554d7e255af5fa4c1786b656e2e7998489181c93f07b6500a82dba
|