An AST evaluator for the OpenSCAD language, producing Manifold CSG geometry from a parsed AST.
Project description
openscad_evaluator
An AST evaluator for the OpenSCAD language, producing Manifold CSG geometry from a parsed AST.
Overview
openscad_evaluator takes an OpenSCAD AST — as produced by
openscad_lalr_parser — and walks it to
produce Manifold meshes: a two-pass resolve (AST walk,
no CSG calls) then generate (bottom-up Manifold/CrossSection construction) pipeline, with
$fn/$fa/$fs, full built-in coverage (primitives, transforms, boolean ops, 2D geometry,
text(), surface(), DXF/3MF import, roof()), and a content-hash geometry cache
(ManifoldCache) so repeated renders/debugger pauses skip unchanged Manifold work.
It's GUI- and toolkit-agnostic: the only way it talks back to a caller is a handful of optional
callback parameters on Evaluator.__init__ (echo_fn, debug_hook, error_break_fn,
return_hook) — no QObject, no signals, no direct rendering. This is the evaluator that powers
BelfrySCAD.
See docs/evaluator.md for the full architecture reference: scope
processing, assignment order, the built-ins table, 2D/3D geometry handling, error format,
$variables scoping, include/use, and the Manifold provenance / AST-to-geometry-ID mapping
used for WYSIWYG picking.
Installation
pip install openscad-evaluator
For DXF import support:
pip install openscad-evaluator[dxf]
From Source
git clone https://github.com/BelfrySCAD/openscad_evaluator.git
cd openscad_evaluator
pip install -e ".[dev]"
Quick Start
from openscad_lalr_parser import getASTfromString, build_scopes
from openscad_evaluator import Evaluator
nodes = getASTfromString("cube([10, 10, 10]);")
root_scope = build_scopes(nodes)
ev = Evaluator()
bodies, id_to_node = ev.evaluate(nodes, root_scope)
for body in bodies:
print(body.body.num_tri(), "triangles")
Development
uv sync --all-extras
uv run pytest
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 openscad_evaluator-1.0.0.tar.gz.
File metadata
- Download URL: openscad_evaluator-1.0.0.tar.gz
- Upload date:
- Size: 272.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73b38775543c779614a680f904b09d77743217223e5768fe8739328dceef04a4
|
|
| MD5 |
7ab628933fa44407ec40cd6755602d96
|
|
| BLAKE2b-256 |
fbad1877e8cd6eb82290f0adeb3b33ce738cdb0ce13c4df2e9dc8556ce06f503
|
Provenance
The following attestation bundles were made for openscad_evaluator-1.0.0.tar.gz:
Publisher:
publish.yml on BelfrySCAD/openscad_evaluator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openscad_evaluator-1.0.0.tar.gz -
Subject digest:
73b38775543c779614a680f904b09d77743217223e5768fe8739328dceef04a4 - Sigstore transparency entry: 2204749543
- Sigstore integration time:
-
Permalink:
BelfrySCAD/openscad_evaluator@8719f9b63633c9292d244b9603b2f0fa43d8d0eb -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/BelfrySCAD
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8719f9b63633c9292d244b9603b2f0fa43d8d0eb -
Trigger Event:
release
-
Statement type:
File details
Details for the file openscad_evaluator-1.0.0-py3-none-any.whl.
File metadata
- Download URL: openscad_evaluator-1.0.0-py3-none-any.whl
- Upload date:
- Size: 273.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
236cd728964b2d468a4421646a0c9d0381ff6040abf62d54537af4194be91808
|
|
| MD5 |
8295a6b20fb3b124d5e38608b25d2d1d
|
|
| BLAKE2b-256 |
e5ab34b1960d7e55f3b57debf0d6a95b07174a0a6bc3887520e383874a872159
|
Provenance
The following attestation bundles were made for openscad_evaluator-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on BelfrySCAD/openscad_evaluator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
openscad_evaluator-1.0.0-py3-none-any.whl -
Subject digest:
236cd728964b2d468a4421646a0c9d0381ff6040abf62d54537af4194be91808 - Sigstore transparency entry: 2204749552
- Sigstore integration time:
-
Permalink:
BelfrySCAD/openscad_evaluator@8719f9b63633c9292d244b9603b2f0fa43d8d0eb -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/BelfrySCAD
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8719f9b63633c9292d244b9603b2f0fa43d8d0eb -
Trigger Event:
release
-
Statement type: