Skip to main content

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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pythonscad_stl_generator-0.1.2.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pythonscad_stl_generator-0.1.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file pythonscad_stl_generator-0.1.2.tar.gz.

File metadata

  • Download URL: pythonscad_stl_generator-0.1.2.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for pythonscad_stl_generator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 958bfed0d235c96da0a0cb4d43c3e13fcd2dbba1c5b29c53fbb600094bc07573
MD5 7c4ae7a42e94af2321a9b329d0b04894
BLAKE2b-256 994d542329ea548666699b68088b4f2fed9c2d09488fed5adff42379e7e2c789

See more details on using hashes here.

Provenance

The following attestation bundles were made for pythonscad_stl_generator-0.1.2.tar.gz:

Publisher: publish-to-pypi.yml on nomike/pythonscad-stl-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pythonscad_stl_generator-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pythonscad_stl_generator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 86e259d24e94b7bcb47f77011f226968de967cfedc5d021095448a76ec9f8bda
MD5 5d50d15160fe34b3f65b77907b9298ce
BLAKE2b-256 66e2f8909ab4b9690e8727ee4345db2ee2ccfab9d0a1b9546206044e4ad34136

See more details on using hashes here.

Provenance

The following attestation bundles were made for pythonscad_stl_generator-0.1.2-py3-none-any.whl:

Publisher: publish-to-pypi.yml on nomike/pythonscad-stl-generator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page