This experimental Blender add-on, developed by ETS Lab, allows users to extract objects and their physics constraints from Blender and export them to JSON format. It also enables users to run PolyFem simulations directly within Blender.
Note: This plugin is tested with Blender 4.2. Compatibility with earlier versions is not guaranteed.
- Export objects and physics constraints to JSON.
- Supports mesh export in STL and MSH formats.
- Execute PolyFem simulations directly in Blender.
- Intuitive user interface integrated into Blender's sidebar.
To install the Blender Plugin Simulation to JSON:
-
Prepare the Plugin:
- Zip the entire
polyfem
directory, which contains the plugin's core files.
- Zip the entire
-
Install the Plugin:
- Open Blender and go to Edit > Preferences > Add-ons.
- Click Install and select the zip file created in step 1.
-
Activate the Plugin:
- Search for
PolyFEM
in the add-on preferences and activate it by checking the corresponding checkbox.
- Search for
In addition to Python dependencies, this plugin requires Docker Desktop for running TetWild
and PolyFem
simulations. Ensure that Docker Desktop is installed and running on your system.
The following Python packages are required:
tetgen==0.6.5
scipy==1.14.1
meshio==5.3.5
sympy==1.13.3
numpy==2.1.2
trimesh==4.4.9
noise==1.2.2
rich==13.9.1
Ensure Python 3.11 is installed. While the plugin manages dependencies automatically, developers may need to install these manually using pip
if modifying the plugin.
In addition to the Python dependencies, this plugin relies on Docker for running external simulations:
-
TetWild: Used for mesh generation and refinement.
- Docker Image:
yixinhu/tetwild:latest
- Docker Image:
-
PolyFem: Used for running simulations.
- Docker Image:
antoinebou12/polyfem:latest
- Docker Image:
-
Install Docker Desktop:
- Download and install Docker Desktop from here.
- Ensure Docker is running and configured to access your local file system.
-
Pull Docker Images:
- Open a terminal and run the following commands to pull the required Docker images:
docker pull yixinhu/tetwild:latest docker pull antoinebou12/polyfem:latest
- Open a terminal and run the following commands to pull the required Docker images:
-
Verify Docker Setup:
- Ensure Docker is working correctly by running:
docker --version
- Ensure Docker is working correctly by running:
polyfem/
├── __init__.py # Main plugin entry point
├── operators/
├── panels/
│ ├── poly_fem.py # UI panel for PolyFem simulation
├── properties/
│ ├── polyfem.py # Stores simulation settings
│ ├── physics_export_addon.py # Stores add-on preferences
Once installed and activated, the add-on creates a new sidebar panel in Blender's 3D Viewport:
- Physics: For exporting physics constraints and mesh data.
- PolyFem: For setting up and running PolyFem simulations.
To access these panels:
- Press
N
to open the sidebar. - Navigate to the relevant tab (e.g., PolyFem).
-
Configure the PolyFem Executable:
- In the PolyFem panel, set the path to the PolyFem executable and select a valid JSON configuration file for the simulation.
-
Set Project Path:
- Choose the path where the simulation output (meshes, JSON files) will be saved.
-
Start Simulation:
- Press Run PolyFem Simulation to start the simulation.
- Optionally, you can open the PolyFem documentation from the panel.
-
Configure Export Options:
- In the PolyFem panel, set the output directory, JSON filename, and choose between STL or MSH formats for mesh export.
-
Select Objects (Optional):
- To export specific objects, select them in the 3D Viewport and enable Export Selected Only.
-
Export to JSON:
- Click Create PolyFEM JSON to generate a JSON file with the object's physics constraints and properties.
- Some edge cases with mesh exporting may not be fully supported.
- PolyFem simulation crashes may occur with complex geometry or specific settings.
- Simulation Export: Support for exporting simulations and meshes.
- STL and MSH Export: Enhanced functionality for mesh formats.
- Integrated PolyFem and VTP Simulation: In-Blender support for PolyFem and VTP simulations.
This project is licensed under the GNU General Public License v3.0. For more details, check the LICENSE file.
- Antoine Boucher - Lead Developer and Maintainer
- ETS Lab - ETS Lab Homepage
For any inquiries, submit an issue on the GitHub Repository.