Render PythonSCAD design scripts to STL files, including customizer presets.
Project description
PythonSCAD STL Generator
PythonSCAD STL Generator is a small command line tool for batch-rendering
PythonSCAD design files. It scans a directory for Python files that import
pythonscad, renders each design with the pythonscad executable from
PATH, and optionally renders once per customizer preset from a sibling JSON
file.
Installation
Install the published package with pipx:
pipx install pythonscad-stl-generator
Or install it into an existing environment with pip:
python -m pip install pythonscad-stl-generator
For development:
git clone https://github.com/nomike/pythonscad-stl-generator.git
cd pythonscad-stl-generator
python -m pip install -e ".[dev]"
PythonSCAD itself is not bundled. The tool expects a pythonscad executable to
be available on PATH, or you can point to it explicitly with
--pythonscad=/path/to/pythonscad.
Usage
From a directory containing PythonSCAD designs:
generate-pythonscad-stls
The command writes STL files to output/ by default. A Python file is treated
as a design when it imports pythonscad, for example:
from pythonscad import *
width = add_parameter("width", 20)
cube([width, width, width]).show()
Useful options:
generate-pythonscad-stls --output-dir stls
generate-pythonscad-stls --pythonscad ~/bin/pythonscad
generate-pythonscad-stls --format 3mf
generate-pythonscad-stls --dry-run --verbose
generate-pythonscad-stls --recursive
The generated PythonSCAD command includes --trust-python, because PythonSCAD
requires that flag for command-line execution of Python input files.
Customizer Presets
If box.py has a sibling box.json, the tool reads its top-level
parameterSets object and renders once per preset:
{
"parameterSets": {
"small": {
"width": "10"
},
"large": {
"width": "50"
}
},
"fileFormatVersion": "1"
}
This produces files like:
output/box-small.stl
output/box-large.stl
Without a sibling preset file, the design renders once to output/box.stl.
Up-To-Date Checks
Existing output files are skipped when they are newer than their inputs. For a
plain design, the input is the .py file. For preset renders, both the .py
file and the sibling .json preset file must be older than the output.
Use --force to render everything regardless of timestamps.
Development
Run tests:
python -m pytest
Run linting and formatting:
ruff check .
ruff format .
Run all pre-commit hooks:
pre-commit run --all-files
License
This project is licensed under the MIT License. See LICENSE.
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 pythonscad_stl_generator-0.1.1.tar.gz.
File metadata
- Download URL: pythonscad_stl_generator-0.1.1.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8ba8cffd11a8d32ec7fcb59ee0222ab07f82e890d721b381cc3287b97e6a151
|
|
| MD5 |
f52964ab07a9138b607b4aed2ed0b7ae
|
|
| BLAKE2b-256 |
4eee8a00dcaf2572d57bd24b16b4e069518fd9992a3ff7814fb882e43f589e13
|
Provenance
The following attestation bundles were made for pythonscad_stl_generator-0.1.1.tar.gz:
Publisher:
publish-to-pypi.yml on nomike/pythonscad-stl-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pythonscad_stl_generator-0.1.1.tar.gz -
Subject digest:
e8ba8cffd11a8d32ec7fcb59ee0222ab07f82e890d721b381cc3287b97e6a151 - Sigstore transparency entry: 2065368252
- Sigstore integration time:
-
Permalink:
nomike/pythonscad-stl-generator@e85a2faf093fc41dd472ddae6b5f660ddc1c7887 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/nomike
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@e85a2faf093fc41dd472ddae6b5f660ddc1c7887 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pythonscad_stl_generator-0.1.1-py3-none-any.whl.
File metadata
- Download URL: pythonscad_stl_generator-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cee28237a713157793be6f4521d4863936afb94c33e148abd227abedd8d7a838
|
|
| MD5 |
8d6da8f68b9fd2aae7e028e79b515b60
|
|
| BLAKE2b-256 |
50c905e7b1cb3edda000623fe55c8f5686f86a0cb5f1803a8f02e823e91dff5d
|
Provenance
The following attestation bundles were made for pythonscad_stl_generator-0.1.1-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on nomike/pythonscad-stl-generator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pythonscad_stl_generator-0.1.1-py3-none-any.whl -
Subject digest:
cee28237a713157793be6f4521d4863936afb94c33e148abd227abedd8d7a838 - Sigstore transparency entry: 2065368265
- Sigstore integration time:
-
Permalink:
nomike/pythonscad-stl-generator@e85a2faf093fc41dd472ddae6b5f660ddc1c7887 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/nomike
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@e85a2faf093fc41dd472ddae6b5f660ddc1c7887 -
Trigger Event:
release
-
Statement type: