From d6143de0a0b4b54b228e62771a1901ee65681086 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Sun, 15 Aug 2021 18:33:52 +0200 Subject: [PATCH] fix closing in WorkPlane --- libsrc/occ/python_occ_shapes.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index ce317db2..9d567630 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -219,6 +219,7 @@ public: bool closing = new2d.Distance(startpnt) < 1e-10; + cout << "lineto, oldp = " << occ2ng(oldp) << endl; cout << "lineto, newp = " << occ2ng(newp) << endl; gp_Pnt pfromsurf = surf->Value(new2d.X(), new2d.Y()); cout << "p from plane = " << occ2ng(pfromsurf) << endl; @@ -446,10 +447,17 @@ public: shared_ptr Close () { cout << "close called" << endl; + + if (startpnt.Distance(localpos.Location()) > 1e-10) + { + cout << "generate closing line" << endl; + LineTo (startpnt.X(), startpnt.Y()); + return shared_from_this(); + } + if (!startvertex.IsNull()) { cout << "I am actually closing" << endl; - LineTo (startpnt.X(), startpnt.Y()); wires.push_back (wire_builder.Wire()); wire_builder = BRepBuilderAPI_MakeWire(); startvertex.Nullify();