Files
make-cad/src/cpp/bindings/python/bind_reactive_common.hpp
T
NiJingzhe 8971279494 feat: the geometry engine is C++ on OpenCASCADE, one package, prebuilt wheels
The modeling API (shapes, operators, sketches, products, queries, the reactive graph) is implemented in
C++20 on OpenCASCADE (src/cpp) and ships inside the wheel as simplecadapi._cpp.  The Python layers that stay
Python (runtime, build, artifacts, editor, inspect, exporter, translators, scene) run on it unchanged; the
previous Python test suite passes on the new engine.

Layout: src/cpp and src/simplecadapi side by side, one distribution built by scikit-build-core.
simplecadapi.core, .operators.*, .ql, .std.* and the other legacy modules are real forwarding modules; the
Python adapter layer is simplecadapi/_glue.  OCP is no longer a dependency and nothing imports it.

Release: .github/workflows/release.yml builds wheels for Linux x86_64 and aarch64, macOS arm64 and Windows
x86_64 (Python 3.10-3.13) against one static OCCT, runs the test suite on the Linux wheels and publishes to
GitHub and PyPI; ci.yml caches the static OCCT for the test jobs.

Errors: every message the library writes is English; the tag-validation and semantic-query errors render in
full with possible causes and fixes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 02:55:35 +08:00

43 lines
1.5 KiB
C++

// Helpers shared by the bind_reactive*.cpp files.
#pragma once
#include <string>
#include <string_view>
#include "bindings.hpp"
#include "scad/reactive/expr.hpp"
#include "scad/reactive/units.hpp"
#include "scad/topo/shape.hpp"
namespace scad::pybind::reactive {
// numbers.Real (kept alive for the life of the process).
const py::object& numbers_real();
// `_finite_scalar`: a real number (never a bool) that is finite. TypeError
// for anything else, ValueError for NaN / infinity / an int too large for a double.
double finite_real(const py::handle& value, std::string_view label);
// A real number that need not be finite (a unit scale is checked by Unit).
double real_number(const py::handle& value, std::string_view label);
// Mapping[str, float] | None -> Bindings (values must be real numbers).
scad::Bindings bindings_from(const py::object& mapping);
// A Python Unit/str -> Unit (get_unit).
scad::reactive::Unit unit_from(const py::object& value);
// The node of a Python scalar: Var/Const/Expr -> itself, a number -> a Const.
// TypeError for anything else (lift_scalar).
scad::reactive::ScalarPtr lift(const py::handle& value);
// A shape as the Python class of its kind (Solid, Face, ...).
py::object shape_to_python(const scad::Shape& shape);
void bind_reactive_units(py::module_& m);
void bind_reactive_exprs(py::module_& m);
void bind_reactive_graph(py::module_& m);
void bind_reactive_session(py::module_& m);
void bind_reactive_math(py::module_& m);
} // namespace scad::pybind::reactive