From 42c0724886017a064c8e2c9ee698bfd74e698216 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Tue, 17 Aug 2021 16:42:06 +0200 Subject: [PATCH] workplane.move in current direction --- libsrc/occ/python_occ_shapes.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index ec6cd378..c9645513 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -201,6 +201,14 @@ public: return shared_from_this(); } + auto Move(double len) + { + gp_Dir2d dir = localpos.Direction(); + gp_Pnt2d oldp = localpos.Location(); + auto newp = oldp.Translated(len*dir); + return MoveTo(newp.X(), newp.Y()); + } + auto Direction (double h, double v) { localpos.SetDirection(gp_Dir2d(h,v)); @@ -1272,6 +1280,8 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) BRepOffsetAPI_MakePipeShell builder(spine); builder.SetMode (auxspine, Standard_True); builder.Add (profile); + builder.Build(); + builder.MakeSolid(); return builder.Shape(); } catch (Standard_Failure & e) @@ -1532,6 +1542,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) py::class_> (m, "WorkPlane") .def(py::init(), py::arg("axis")=gp_Ax3(), py::arg("pos")=gp_Ax2d()) .def("MoveTo", &WorkPlane::MoveTo) + .def("Move", &WorkPlane::Move) .def("Direction", &WorkPlane::Direction) // .def("LineTo", &WorkPlane::LineTo) .def("LineTo", [](WorkPlane&wp, double x, double y, optional name) { return wp.LineTo(x, y, name); },