/* OCP.Geom — the analytic curves and surfaces behind the topology. The app imports only three of these, but it *receives* the two abstract bases: BRep_Tool.Surface_s hands back a Handle(Geom_Surface), and GC_MakeArcOfCircle a Handle(Geom_TrimmedCurve), both of which then travel into BRepBuilderAPI_MakeEdge/MakeFace. So the bases have to be registered for those returns to convert, and the concrete leaves for the constructors the app calls. Deliberately partial: the concrete subclasses OCCT may hand back (Geom_Plane, Geom_Circle, ...) are not registered, so such a return arrives as its static type, Geom_Surface. That is fine here — the app reads surface *kinds* off BRepAdaptor_Surface, never off the Geom object, and no call site does DownCast or isinstance on one. Add a leaf the day one does. Surface_s returns the face's live surface when the location is identity, a transformed copy otherwise; the handle caster wraps whatever OCCT gives back without copying, which is upstream's behaviour too. */ #include "../common/occt_module.h" #include "../common/occt_policies.h" #include "../common/occt_transient.h" #include #include #include #include #include #include #include #include #include #include #include void register_Geom(nb::module_ &root) { nb::module_ m = ocp_submodule(root, "Geom"); // ------------------------------------------------------------ curves -- nb::class_(m, "Geom_Curve") .def("FirstParameter", &Geom_Curve::FirstParameter) .def("LastParameter", &Geom_Curve::LastParameter) .def("IsClosed", &Geom_Curve::IsClosed) .def("IsPeriodic", &Geom_Curve::IsPeriodic) .def("Value", &Geom_Curve::Value, "U"_a, OCP_RETURN_COPY); nb::class_(m, "Geom_TrimmedCurve"); nb::class_(m, "Geom_BSplineCurve") .def(ocp_new(), "Poles"_a, "Knots"_a, "Multiplicities"_a, "Degree"_a, "Periodic"_a = Standard_False) .def("Degree", &Geom_BSplineCurve::Degree) .def("NbPoles", &Geom_BSplineCurve::NbPoles) .def("NbKnots", &Geom_BSplineCurve::NbKnots); // ---------------------------------------------------------- surfaces -- nb::class_(m, "Geom_Surface") .def("Value", &Geom_Surface::Value, "U"_a, "V"_a, OCP_RETURN_COPY) .def("IsUPeriodic", &Geom_Surface::IsUPeriodic) .def("IsVPeriodic", &Geom_Surface::IsVPeriodic) .def("IsUClosed", &Geom_Surface::IsUClosed) .def("IsVClosed", &Geom_Surface::IsVClosed); nb::class_(m, "Geom_BSplineSurface"); nb::class_(m, "Geom_CylindricalSurface") .def(ocp_new(), "A3"_a, "Radius"_a) .def("Radius", &Geom_CylindricalSurface::Radius); nb::class_(m, "Geom_OffsetSurface") .def(ocp_new &, const Standard_Real, const Standard_Boolean>(), "S"_a, "Offset"_a, "isNotCheckC0"_a = Standard_False) .def("Offset", &Geom_OffsetSurface::Offset) .def("BasisSurface", &Geom_OffsetSurface::BasisSurface); }