Skip to main content

C++ OpenSCAD evaluator with Python bindings

Project description

openscad_cpp_evaluator

A C++20 port of openscad_evaluator (Python): an AST-walking geometry engine that takes a parsed OpenSCAD AST and produces Manifold CSG geometry, ready to export to STL/OBJ/OFF/3MF or hand off to a renderer.

Built on:

  • openscad_cpp_parser (git submodule) for lexing/parsing/AST/scope resolution.
  • Manifold v3.5.2 for the actual CSG boolean/mesh engine.
  • Boost.Polygon for roof()'s Voronoi-diagram construction.
  • nothings/stb (header-only) for surface()'s image loader and the built-in font provider's TrueType parsing/rasterization.

All fetched automatically via CMake FetchContent — no manual dependency installation beyond the toolchain below.

Status

All planned phases (0–9) are complete: the full primitive/transform/boolean/modifier/control-flow language surface, every builtin function, STL/OBJ/OFF/3MF import and export, hull()/minkowski()/ linear_extrude()/rotate_extrude()/roof()/offset()/surface()/DXF & SVG import/text(), an opt-in content-hash geometry cache, per-call-site profiling, and a gdb-style --debug REPL. See CLAUDE.md for the full phase-by-phase history and architecture notes.

Build

Requires:

  • CMake ≥ 3.24
  • A C++20 compiler (Clang, GCC, or MSVC — all three are covered by CI)
  • Bison ≥ 3.8 and Flex
    • macOS: brew install bison flex (the system bison is too old; CMake auto-detects Homebrew's)
    • Linux: sudo apt-get install bison flex
    • Windows: MSYS2's bison/flex (pacman -S bison flex) — GitHub's windows-latest runner ships MSYS2 pre-installed at C:\msys64; CMake auto-detects it there too

GoogleTest and every other C++ dependency are fetched automatically.

git clone --recurse-submodules <this-repo>
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j

(Omitting -DCMAKE_BUILD_TYPE=Release builds unoptimized — pass it explicitly for anything performance-sensitive.)

On Windows, CMake defaults to the multi-config Visual Studio generator, which ignores CMAKE_BUILD_TYPE; pass --config Release to cmake --build (and -C Release to ctest) instead.

Test

ctest --test-dir build --output-on-failure

Run a single binary or filter:

build/tests/oscad_eval_tests
build/tests/oscad_eval_tests --gtest_filter='FormatNumber.*'

The suite runs twice in CI — once with the bytecode VM on (the default) and once with it off (OSCAD_BYTECODE_VM=0) — so a regression in either the compiled or interpreted expression-eval path is caught.

CLI

build/tools/cli/openscad-cpp-evaluator <input.scad> -o <output.{stl,obj,off,3mf}> [--format stl|obj|off|3mf] [--debug]

The output format is inferred from -o's extension, or set explicitly with --format. --debug drops into a gdb-style REPL (break/run/continue/step/next/finish/print/ backtrace/set/list/quit/help) before and during evaluation.

build/tools/cli/openscad-cpp-evaluator model.scad -o model.stl

Architecture

See CLAUDE.md for the full per-file architecture map, the Python-reference cross-check history, and the rationale behind every non-obvious design choice (the two-pass resolve/generate CSG pipeline, the FontProvider injection seam, the closure-detection rule, etc.).

CI

GitHub Actions builds and tests on Linux, macOS, and Windows on every push/PR (.github/workflows/ci.yml).

Project details


Download files

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

Source Distribution

openscad_cpp_evaluator-0.4.0.tar.gz (612.3 kB view details)

Uploaded Source

Built Distributions

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

openscad_cpp_evaluator-0.4.0-cp312-abi3-win_amd64.whl (4.9 MB view details)

Uploaded CPython 3.12+Windows x86-64

openscad_cpp_evaluator-0.4.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (3.0 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

openscad_cpp_evaluator-0.4.0-cp312-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl (2.7 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.27+ ARM64manylinux: glibc 2.28+ ARM64

openscad_cpp_evaluator-0.4.0-cp312-abi3-macosx_13_0_x86_64.whl (2.0 MB view details)

Uploaded CPython 3.12+macOS 13.0+ x86-64

openscad_cpp_evaluator-0.4.0-cp312-abi3-macosx_13_0_arm64.whl (1.8 MB view details)

Uploaded CPython 3.12+macOS 13.0+ ARM64

File details

Details for the file openscad_cpp_evaluator-0.4.0.tar.gz.

File metadata

  • Download URL: openscad_cpp_evaluator-0.4.0.tar.gz
  • Upload date:
  • Size: 612.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for openscad_cpp_evaluator-0.4.0.tar.gz
Algorithm Hash digest
SHA256 16555180837cfa64aa8fc5a890cd0a94e44b0b79e84d40cdb465bd3de466328d
MD5 8296924bc1ba42b4ee4b17e462e01054
BLAKE2b-256 9b7a7a99a237f9270abc385152812be6f662466662b7994f166819b992141f9c

See more details on using hashes here.

File details

Details for the file openscad_cpp_evaluator-0.4.0-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for openscad_cpp_evaluator-0.4.0-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 ca779a618a354b9be7e6898141ebb6f5d274df7c31d0ddaaba2d981151e956ab
MD5 b0125b3083e0b0ed87d9f649daf14fe5
BLAKE2b-256 a99dafea47310aaf6a76babc94f7010305d2921934874d11bc15a5f9bc531a2a

See more details on using hashes here.

File details

Details for the file openscad_cpp_evaluator-0.4.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for openscad_cpp_evaluator-0.4.0-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b98b814c93a345c9f1cd62e61adaf52db9c3ac0dbc1b8a7a90d9542983a7f350
MD5 04f8a510411200ab6bb5b2968822f921
BLAKE2b-256 3605b15cba9b4090e18df24766ad029ac28ef5fe9d0ad259a9246671e11999b8

See more details on using hashes here.

File details

Details for the file openscad_cpp_evaluator-0.4.0-cp312-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for openscad_cpp_evaluator-0.4.0-cp312-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 715912f177da0cda8d1f7e3dc6c3117b448f0c19f73634ff465cbd2ac7199241
MD5 e25933628e04c84e4ad37c75c127a211
BLAKE2b-256 4640d4e3dfb4689a5d106569180d20b3d2834224a05c0a63e1bc7128e8d4906d

See more details on using hashes here.

File details

Details for the file openscad_cpp_evaluator-0.4.0-cp312-abi3-macosx_13_0_x86_64.whl.

File metadata

File hashes

Hashes for openscad_cpp_evaluator-0.4.0-cp312-abi3-macosx_13_0_x86_64.whl
Algorithm Hash digest
SHA256 e3202df764851d0ee25964e14d26e2b5f7714c6e441c1e080dd3eb04a55387de
MD5 30208663ff255b68efdaebf6f0d19f51
BLAKE2b-256 159e911b6cb78f0203a1a38be63432ef81f6fc820c44a66b8a3b75a57a719c7a

See more details on using hashes here.

File details

Details for the file openscad_cpp_evaluator-0.4.0-cp312-abi3-macosx_13_0_arm64.whl.

File metadata

File hashes

Hashes for openscad_cpp_evaluator-0.4.0-cp312-abi3-macosx_13_0_arm64.whl
Algorithm Hash digest
SHA256 3a207e38f5ae8fb02091aeacaf051257edb9673b193802c523a7fff3dcd5722f
MD5 9f3b8de1fe6d194a44f237a397a4c327
BLAKE2b-256 dc3b15dda22284009d2aedeece620bcb9f286985b920203065429dd834f5f2b0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page