This project provides a lightweight, robust, and high-efficiency generator for creating Triply Periodic Minimal Surface (TPMS) based porous solid structures. It is specifically designed to overcome the limitations of conventional 3D Boolean operations in CAD software, such as slow computation and low stability.
Our approach leverages the unique mathematical properties of TPMS implicit equations to significantly accelerate the generation of watertight, high-quality solid meshes, making it ideal for applications in materials science, manufacturing engineering, and biomimetic design.
- High-Efficiency Boolean Algorithm: Instead of performing computationally expensive 3D mesh Booleans, our algorithm transforms the problem into a 2D boundary meshing task. This reduces computational complexity by an order of magnitude compared to standard libraries like VTK.
- Precise Watertight Meshes: We employ a novel "binary-encoding-based" strategy to adaptively generate triangular facets that perfectly seal boundaries, guaranteeing geometrically integral and watertight final models.
- Support for Multiple TPMS Types: The generator supports nine typical TPMS structures, including both Shell-type (e.g., Gyroid, Diamond, Schwarz) and Skeletal-type (e.g., Schoen Gyroid, Schwarz Primitive).
- User-Friendly Interface: A simple graphical interface built with Python allows for intuitive control over key parameters such as dimensions, unit cell size, grid resolution, and type-specific values (e.g., thickness).
- Lightweight and Robust: The core logic is implemented in C for maximum performance, while being seamlessly integrated with a Python front-end, creating a fast and reliable tool.
TPMS structures are increasingly used for creating artificial porous materials due to their smooth surfaces and highly interconnected architectures. However, generating these complex structures using traditional CAD Boolean operations is often slow and error-prone. This project addresses these challenges by specializing the Boolean intersection algorithm for TPMS, resulting in a dramatic improvement in both speed and quality.
For a detailed explanation of the theory and algorithm, please refer to our paper: "Application and Optimization of TPMS in CAD Modeling" by Yiduo Jia, Deli Meng, and Yongqi Long.
Our algorithm demonstrates significant performance gains over the standard vtkBooleanOperationPolyDataFilter from the VTK library.
- For Shell-type TPMS (e.g., Gyroid): Our algorithm is, on average, ~9.1 times faster (reducing execution time to ~10.97% of VTK's).
- For Skeletal-type TPMS (e.g., Schoen Gyroid): Our algorithm is, on average, ~11.1 times faster (reducing execution time to ~8.98% of VTK's).
| Shell-TPMS Gyroid Performance | Skeletal-TPMS Schoen Gyroid Performance |
![]() |
![]() |
-
Prepare the environment:
pip install -r requirements.txt
-
Launch the application:
run.bat
or
gcc -shared -o processor.dll processor.c python tpmsgen.py
-
Using the GUI:
- Select the desired TPMS Type from the dropdown list.
- Define the Overall cubic dimensions and Unit cell size.
- Adjust the Grid resolution (a higher value results in a more detailed mesh but takes longer).
- Set type-specific parameters like thickness
tor level-set valuec. - Click the "Generate Mesh" button to start the process.
- Once generated, you can export the model as an STL file.
This generator includes mathematical expressions for the following TPMS types:
Shell-type:
- Gyroid
- Diamond
- Lidinoid
- Split-P
- Schwarz
| Shell-TPMS Lidinoid | Shell-TPMS Schwarz |
![]() |
![]() |
Skeletal-type:
- Schoen Gyroid
- Schwarz Diamond
- Schwarz Primitive
- Body Diagonals with Nodes
| Skeletal-TPMS Schoen gyroid | Skeletal-TPMS Schwarz diamond |
![]() |
![]() |
For the exact implicit equations, please refer to Table 1 in our research paper.
.png)
.png)




