catalog: the meaning of a parameter is its type in the binding (Length, Angle, Point3, Direction3, Vector3); simplecadapi.catalog reads every operation from the signatures

Bindings declare scad::pybind::Length etc. (thin wrappers that convert to the Scalar the kernel takes, so binding bodies do not change);
pybind writes simplecadapi.types.Length into the signature, the stubs and the API pages show it, and simplecadapi.catalog parses the
signatures of every *_r<kind> operation (and the standard library's Python ones) into typed parameters. Box and cylinder are the
pilot; test_catalog.py keeps the list of operations that still take untyped parameters, which only shrinks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
NiJingzhe
2026-11-04 04:26:12 +08:00
parent 172120e43e
commit 99d34d9522
6 changed files with 546 additions and 2 deletions
@@ -19,6 +19,11 @@
namespace {
using namespace scad;
using scad::pybind::Angle;
using scad::pybind::Direction3;
using scad::pybind::Length;
using scad::pybind::Point3;
using scad::pybind::Vector3;
using namespace pybind11::literals;
// Defaults as Python tuples, so help() shows (0, 0, 1) like the Python SDK.
@@ -196,7 +201,7 @@ void bind_wires_and_faces(py::module_& m) {
void bind_primitives(py::module_& m) {
m.def(
"make_box_rsolid",
[](const Scalar& width, const Scalar& height, const Scalar& depth, const Scalar3& center,
[](const Length& width, const Length& height, const Length& depth, const Point3& center,
OptionalString tag_prefix, OptionalString result_tag, OptionalString bottom, OptionalString top,
OptionalString front, OptionalString back, OptionalString left, OptionalString right) {
return make_box_rsolid(width, height, depth, center,
@@ -231,7 +236,7 @@ void bind_primitives(py::module_& m) {
};
m.def(
"make_cylinder_rsolid",
[axial_tags](const Scalar& radius, const Scalar& height, const Scalar3& center, const Scalar3& axis,
[axial_tags](const Length& radius, const Length& height, const Point3& center, const Direction3& axis,
OptionalString tag_prefix, OptionalString result_tag, OptionalString start_face,
OptionalString end_face, OptionalString side_face, OptionalString start_edge,
OptionalString end_edge, OptionalString seam_edge) {