fix closing in WorkPlane

This commit is contained in:
Joachim Schoeberl 2021-08-15 18:33:52 +02:00
parent f105a9b3cc
commit d6143de0a0

View File

@ -219,6 +219,7 @@ public:
bool closing = new2d.Distance(startpnt) < 1e-10; bool closing = new2d.Distance(startpnt) < 1e-10;
cout << "lineto, oldp = " << occ2ng(oldp) << endl;
cout << "lineto, newp = " << occ2ng(newp) << endl; cout << "lineto, newp = " << occ2ng(newp) << endl;
gp_Pnt pfromsurf = surf->Value(new2d.X(), new2d.Y()); gp_Pnt pfromsurf = surf->Value(new2d.X(), new2d.Y());
cout << "p from plane = " << occ2ng(pfromsurf) << endl; cout << "p from plane = " << occ2ng(pfromsurf) << endl;
@ -446,10 +447,17 @@ public:
shared_ptr<WorkPlane> Close () shared_ptr<WorkPlane> Close ()
{ {
cout << "close called" << endl; 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()) if (!startvertex.IsNull())
{ {
cout << "I am actually closing" << endl; cout << "I am actually closing" << endl;
LineTo (startpnt.X(), startpnt.Y());
wires.push_back (wire_builder.Wire()); wires.push_back (wire_builder.Wire());
wire_builder = BRepBuilderAPI_MakeWire(); wire_builder = BRepBuilderAPI_MakeWire();
startvertex.Nullify(); startvertex.Nullify();