Convert STEP CAD files to rendered PNG images using Blender.
- Blender 5.0+ (with Python 3.11)
- pythonocc-core 7.7.2+
# macOS with Homebrew
brew install --cask miniconda
conda init zsh # or: conda init bash
# Restart your terminal after this# Create environment and install pythonocc-core
conda create -n pythonocc python=3.11
conda activate pythonocc
conda install -c conda-forge pythonocc-core
# Copy OCC folder to step2image directory
cp -r $CONDA_PREFIX/lib/python3.11/site-packages/OCC /path/to/step2image/Copy step2image.py to your desired location along with the OCC/ folder.
pip install pythonocc-core
# Then copy the OCC folder from your site-packagesblender --background --python step2image.py -- input.step output.pngblender --background --python step2image.py -- ./step_files/ ./renders/blender --background --python step2image.py -- input.step output.png \
--resolution 1920 1080 \
--samples 64 \
--detail 100 \
--view isometric \
--background "#FFFFFF" \
--engine CYCLES| Option | Default | Description |
|---|---|---|
input |
required | STEP file or folder of STEP files |
output |
required | Output PNG file or folder |
--resolution |
1920 1080 | Image width and height |
--samples |
64 | Render samples (quality) |
--detail |
100 | Mesh tessellation detail (1-500) |
--view |
isometric | Camera preset |
--background |
#EEEEEE | Background hex color |
--transparent |
false | Use transparent background |
--engine |
CYCLES | Render engine (CYCLES or EEVEE) |
isometric- Standard isometric view (default)front- Front viewback- Back viewtop- Top viewbottom- Bottom viewright- Right viewleft- Left view
blender --background --python step2image.py -- part.step render.png \
--resolution 3840 2160 \
--samples 256 \
--detail 200blender --background --python step2image.py -- part.step preview.png \
--resolution 800 600 \
--samples 16 \
--engine EEVEEblender --background --python step2image.py -- part.step render.png \
--transparentblender --background --python step2image.py -- ./cad_models/ ./images/GPL-3.0
Based on STEPmac by Tommi Hyppanen and theeko. Uses pythonocc-core (OpenCASCADE Python bindings).