From 5692604ab6ae6e9db27f0a145782320348a842af Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Tue, 21 Nov 2023 11:38:01 +0100 Subject: [PATCH] [occ] add name argument to arc in workplane --- libsrc/occ/python_occ_shapes.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index d03581e5..8096428c 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -424,7 +424,7 @@ public: return shared_from_this(); } - auto ArcTo (double h, double v, const gp_Vec2d t) + auto ArcTo (double h, double v, const gp_Vec2d t, optional name=nullopt) { gp_Pnt2d P1 = localpos.Location(); @@ -489,6 +489,8 @@ public: auto edge = BRepBuilderAPI_MakeEdge(curve2d, surf, lastvertex, endv).Edge(); lastvertex = endv; BRepLib::BuildCurves3d(edge); + if(name.has_value()) + OCCGeometry::GetProperties(edge).name = name; wire_builder.Add(edge); //compute angle of rotation @@ -509,7 +511,7 @@ public: return shared_from_this(); } - auto Arc(double radius, double angle) + auto Arc(double radius, double angle, optional name) { double newAngle = fmod(angle,360)*M_PI/180; @@ -540,7 +542,7 @@ public: cout << IM(6) << "t = (" << t.X() << ", " << t.Y() << ")" << endl; //add arc - return ArcTo (oldp.X(), oldp.Y(), t); + return ArcTo (oldp.X(), oldp.Y(), t, name); } auto Rectangle (double l, double w) @@ -2534,8 +2536,9 @@ degen_tol : double // .def("LineTo", &WorkPlane::LineTo) .def("LineTo", [](WorkPlane&wp, double x, double y, optional name) { return wp.LineTo(x, y, name); }, py::arg("h"), py::arg("v"), py::arg("name")=nullopt, "draw line to position (h,v)") - .def("ArcTo", &WorkPlane::ArcTo) - .def("Arc", &WorkPlane::Arc, py::arg("r"), py::arg("ang"), "draw arc tangential to current pos/dir, of radius 'r' and angle 'ang', draw to the left/right if ang is positive/negative") + .def("ArcTo", &WorkPlane::ArcTo, py::arg("h"), py::arg("v"), + py::arg("t"), py::arg("name")=nullopt) + .def("Arc", &WorkPlane::Arc, py::arg("r"), py::arg("ang"), py::arg("name")=nullopt, "draw arc tangential to current pos/dir, of radius 'r' and angle 'ang', draw to the left/right if ang is positive/negative") .def("Rotate", &WorkPlane::Rotate, py::arg("ang"), "rotate current direction by 'ang' degrees") .def("Line", [](WorkPlane&wp,double l, optional name) { return wp.Line(l, name); }, py::arg("l"), py::arg("name")=nullopt)