scadbatch
Batch export models from parametric OpenSCAD designs using CSV or Customizer JSON parameter sets.
One .scad model plus a list of parameter sets gives you one output file per set per output
format — in any format OpenSCAD can write, several at a time, with a machine-readable record of
what happened.
scadbatch export model.scad params.csv out/
No Python dependencies — just Python 3.10 or newer and OpenSCAD. The GUI additionally needs
tkinter, which some Linux distributions package separately (python3-tk on Debian and Ubuntu);
the standalone binaries bundle it.
Install
pip install scadbatch
Or download a standalone binary for Windows, macOS or Linux from Releases — no Python needed.
OpenSCAD itself is not bundled. Install it from openscad.org
and either put it on PATH, set $OPENSCAD, or pass --openscad-path.
Quick start
A parameter file, one row per model:
exported_filename,width,height,depth
cube_small,10,10,10
cube_medium,20,20,20
cube_large,30,30,30
Export every row:
scadbatch export examples/simpleCube/simpleCube.scad examples/simpleCube/simpleCube.csv out/
Three STLs in out/, named from the first column. A parameter the file does not mention keeps
the default from the .scad file, so list only what varies.
To see the OpenSCAD command line for each case without running anything, add --dry-run.
From Python
from scadbatch import batch_export, detect_engine
engine = detect_engine()
result = batch_export(
scad_file="examples/simpleCube/simpleCube.scad",
parameter_file="examples/simpleCube/simpleCube.csv",
output_folder="out",
openscad_path=engine.path,
export_format="binstl",
selection="0-1",
sequential=False,
formats=("stl",),
jobs=2,
)
for r in result.results:
print(f"{r.name:14} {r.format} ok={r.ok} {r.duration:.2f}s {r.output_path}")
print(f"failures={len(result.failures)} with_errors={len(result.with_errors)}")
cube_small stl ok=True 0.03s out/cube_small.stl
cube_medium stl ok=True 0.03s out/cube_medium.stl
failures=0 with_errors=0
The library configures no logging handlers of its own, so add logging.basicConfig() to see the
progress messages the CLI prints.
The GUI
scadbatch gui
Select the .scad file, the parameter file and an output folder; set the output formats, the
STL flavour, a selection range and the parameter file's encoding; watch the log; and convert
between CSV and JSON. The command line still covers dry runs, timeouts, parallelism, the run
summary, name templates and the image options.
Documentation
- docs/parameters.md — the CSV and JSON formats, what a blank cell means, how a cell becomes an OpenSCAD literal, how output files are named, and what is refused
- docs/execution.md — parallelism, formats, timeouts, skipping existing output, and the run summary JSON
- docs/related-tools.md — the other tools that do this, what each is good at, and when a shell loop is the right answer
Commands
| command | what it does |
|---|---|
scadbatch export <scad> <params> <out/> |
export one file per parameter set per output format |
scadbatch csv2json <csv> <json> |
CSV to a Customizer parameter-set file |
scadbatch json2csv <json> <csv> |
and back |
scadbatch gui |
the graphical interface |
scadbatch <command> --help lists every flag. The ones worth knowing early:
| flag | |
|---|---|
--format EXT |
stl, off, 3mf, png, csg, … Repeat for several at once |
--select |
which sets to export: 0-5, 1-3,7, every:2 in 0-10, from:5 |
-j N, --jobs N |
how many OpenSCAD processes at once |
--dry-run, -n |
print the commands, run nothing |
--timeout SECONDS |
kill a case that hangs, keep the batch going |
--summary run.json |
record the run for CI to assert against |
--name-template |
e.g. '{name}_d{diameter}', 'part_{index:03d}' |
The conversions read values with the same rules the exporter uses, so a cell means the same
thing either way. Converting to JSON is lossy for the types current OpenSCAD builds ignore in a
parameter-set file: only a flat vector of numbers survives, so a vector of strings or booleans, a
nested vector, a range and undef are each warned about by name. Export the CSV directly to
apply those.
Why this rather than a shell loop
For a few numeric parameters, a shell loop is fine, and docs/related-tools.md shows one. The reasons to reach for a tool are all the same reason: OpenSCAD exits 0 when it does the wrong thing.
- A misspelled parameter is simply never used, so a typo in a column name gives you a full set of outputs built at the defaults, exit 0, no message.
- Reading a parameter set, a value it cannot convert to the parameter's declared type is ignored and the default stands, silently.
-Dtakes an OpenSCAD expression, not a value, so-D msg=hellosetsmsgto undef.- Several
ERROR:conditions — an unreadable parameter file, a font file it cannot read — print an error and still exit 0. A missing font family prints nothing at all and substitutes.
So parameter files that OpenSCAD would misread are refused up front, with a message naming the
file and the place in it; values are serialised through one documented set of rules; and
--summary records per-case status plus counts.errors, which counts cases that printed an
error whatever the exit status, so CI has something to gate on.
Examples
examples/ has four projects, each with a .scad, a .csv and a .json:
simpleCube |
a cube in three sizes — the smallest thing that shows the idea |
candleStand |
from the OpenSCAD parametric examples |
sign |
adjustable message, size and resolution, same source |
gridfinity |
189 parameter sets, and the one that shows the point at scale. Needs gridfinity-rebuilt-openscad installed as an OpenSCAD library — see its own README |
Used by
Models and projects this has been used on:
- SnapTessSCAD
- Open Source Nasopharyngeal Swab and UV Curing System — HardwareX paper
- Customizable Christmas Name Ornament — after the original by Lyl3
- the
candleStandandsignparametric examples above
Contributing and support
Contributions are welcome, and a bug report with a reproduction is as useful as a patch.
- CONTRIBUTING.md — setting up, the checks to run, and how changes are organised: one issue, one branch, one pull request
- SUPPORT.md — where to ask, what to include, and what response to expect
- CODE_OF_CONDUCT.md — Contributor Covenant 2.1
- CHANGELOG.md — what changed in each release, with the pull request behind each entry
- docs/releasing.md — how a release is cut
Citing
CITATION.cff carries the metadata GitHub's "Cite this repository" button reads. A DOI will be added once a release is archived on Zenodo.
Prior art
This started as a Python port of OutwardBuckle/OpenSCAD-Bulk-Export, and also took ideas from 18107/OpenSCAD-batch-export-stl. docs/related-tools.md says what each does and when to prefer it.
License
AGPL v3. See LICENSE.
Metadata
Release files for scadbatch 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| scadbatch-2.0.0.tar.gz | 92.9 kB | With provenance | Details for scadbatch-2.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| scadbatch-2.0.0-py3-none-any.whl | Python 3 | none | any | Details for scadbatch-2.0.0-py3-none-any.whl |
Total release size: 147.2 kB
Release files / scadbatch-2.0.0.tar.gz
| Download URL | scadbatch-2.0.0.tar.gz |
|---|---|
| Size | 92.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9ceaa759fafbf56f4d99d4b79bbd25ad89ac81de754a6231e4c76dc9ecee3271
|
|
BLAKE2b-256 checksum How to use checksums |
67c4e660fa349a64a1f3e0db01ff99b10927a2e479cbf4f212b4f1dd3e612f73
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logRelease files / scadbatch-2.0.0-py3-none-any.whl
| Download URL | scadbatch-2.0.0-py3-none-any.whl |
|---|---|
| Size | 54.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2935433c8843ce91f95cfddaa921efab8b9b8af1cbf796a99419c5ce2c08a346
|
|
BLAKE2b-256 checksum How to use checksums |
ca44b72e1d137795ea718df2e8be43f4bba27a70d46f04fa2314f959f0d160a3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logSecurity for scadbatch 2.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for scadbatch-2.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 11, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.