/* OCP.GeomAPI — point projection and surface fitting. Both compute in their constructor and expose no deferred Build(), so they are bound exactly as stock does. The no-executing-constructor rule targets the BRepAlgoAPI booleans, where a deferred SetX/Build form exists and the constructor silently duplicates it; it does not apply here (see adding-symbols.md). LowerDistanceParameters returns its two scalars as a tuple, which is how the app unpacks it. ProjectPointOnSurf keeps the GIL: it is measured in microseconds and runs inside per-face Python loops, where the release handshake would cost more than the call. */ #include "../common/occt_module.h" #include "../common/occt_policies.h" #include #include #include #include #include #include #include #include void register_GeomAPI(nb::module_ &root) { nb::module_ m = ocp_submodule(root, "GeomAPI"); nb::class_(m, "GeomAPI_ProjectPointOnSurf") // The Extrema_ExtAlgo overload is left out: binding it would drag in // the Extrema enum only to carry a default the app never overrides, // and an unregistered default argument fails at module-init time. .def(nb::init &>(), "P"_a, "Surface"_a) .def("IsDone", &GeomAPI_ProjectPointOnSurf::IsDone) .def("NbPoints", &GeomAPI_ProjectPointOnSurf::NbPoints) .def("LowerDistance", &GeomAPI_ProjectPointOnSurf::LowerDistance) .def("NearestPoint", &GeomAPI_ProjectPointOnSurf::NearestPoint, OCP_RETURN_COPY) .def("LowerDistanceParameters", [](const GeomAPI_ProjectPointOnSurf &self) { Standard_Real u = 0.0, v = 0.0; self.LowerDistanceParameters(u, v); return std::make_tuple(u, v); }); nb::class_(m, "GeomAPI_PointsToBSplineSurface") .def(nb::init<>()) .def(nb::init(), "Points"_a, "DegMin"_a = 3, "DegMax"_a = 8, "Continuity"_a = GeomAbs_C2, "Tol3D"_a = 1.0e-3, OCP_NOGIL) .def("IsDone", &GeomAPI_PointsToBSplineSurface::IsDone) .def("Surface", &GeomAPI_PointsToBSplineSurface::Surface); }