From 94c4cecb271a1de1eda0959ba7fe7c60bbaa9e0e Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Mon, 30 Jan 2017 16:29:36 +0800 Subject: [PATCH] Path.Area: fixed workplane orientation issue --- src/Mod/Path/App/Area.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Mod/Path/App/Area.cpp b/src/Mod/Path/App/Area.cpp index 161dfa19e382..b2f8bd92c0a0 100644 --- a/src/Mod/Path/App/Area.cpp +++ b/src/Mod/Path/App/Area.cpp @@ -475,6 +475,10 @@ bool Area::findPlane(const TopoDS_Shape &shape, int type, if (!planeFinder.Found()) continue; gp_Ax3 pos = GeomAdaptor_Surface(planeFinder.Surface()).Plane().Position(); + + //force plane to be right handed + if(!pos.Direct()) + pos = gp_Ax3(pos.Ax2()); gp_Dir dir(pos.Direction()); trsf.SetTransformation(pos); @@ -494,10 +498,17 @@ bool Area::findPlane(const TopoDS_Shape &shape, int type, trsf2.SetTranslationPart(gp_XYZ(0,0,origin.Z()-z)); trsf.Multiply(trsf2); } + gp_Pnt pt = origin.Transformed(TopLoc_Location(trsf)); + if(fabs(pt.X()) > Precision::Confusion() || + fabs(pt.Y()) > Precision::Confusion() || + fabs(pt.Z()) > Precision::Confusion()) { + Base::Console().Warning("wrong transformation %lf, %lf, %lf\n",pt.X(),pt.Y(),pt.Z()); + } + if(top_found && top_z > z) continue; top_found = true; - top_z = origin.Z(); + top_z = z; }else if(!dst.IsNull()) continue; dst = plane; @@ -619,7 +630,7 @@ std::vector > Area::makeSections( Part::CrossSection section(a,b,c,it.Current()); std::list wires = section.slice(-d); if(wires.empty()) { - Base::Console().Warning("Section return no wires\n"); + Base::Console().Log("Section returns no wires\n"); continue; }