From fdf66b3e88f09fb9ec6a404ba06f279d7cfb812b Mon Sep 17 00:00:00 2001 From: Kurt Kremitzki Date: Wed, 2 Aug 2017 13:05:31 -0500 Subject: [PATCH] PDN: Check both parallel and antiparallel cases before trying Revolve --- src/Mod/PartDesign/App/FeatureRevolution.cpp | 6 +++++- src/Mod/PartDesign/App/FeatureSketchBased.cpp | 12 ++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/Mod/PartDesign/App/FeatureRevolution.cpp b/src/Mod/PartDesign/App/FeatureRevolution.cpp index 483e56372a..91a70de641 100644 --- a/src/Mod/PartDesign/App/FeatureRevolution.cpp +++ b/src/Mod/PartDesign/App/FeatureRevolution.cpp @@ -103,7 +103,11 @@ App::DocumentObjectExecReturn *Revolution::execute(void) } // update Axis from ReferenceAxis - updateAxis(); + try { + updateAxis(); + } catch (const Base::Exception& e) { + return new App::DocumentObjectExecReturn(e.what()); + } // get revolve axis Base::Vector3d b = Base.getValue(); diff --git a/src/Mod/PartDesign/App/FeatureSketchBased.cpp b/src/Mod/PartDesign/App/FeatureSketchBased.cpp index 741e3ac48b..120c548c92 100644 --- a/src/Mod/PartDesign/App/FeatureSketchBased.cpp +++ b/src/Mod/PartDesign/App/FeatureSketchBased.cpp @@ -971,19 +971,19 @@ void ProfileBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std dir = line->getDirection(); // Check that axis is perpendicular with sketch plane! - if (sketchplane.Axis().Direction().Angle(gp_Dir(dir.x, dir.y, dir.z))< Precision::Angular()) - throw Base::Exception("Rotation axis must not be perpendicular with the sketch plane"); + if (sketchplane.Axis().Direction().IsParallel(gp_Dir(dir.x, dir.y, dir.z), Precision::Angular())) + throw Base::Exception("Rotation axis must not be perpendicular with the sketch plane"); return; } if (pcReferenceAxis->getTypeId().isDerivedFrom(App::Line::getClassTypeId())) { const App::Line* line = static_cast(pcReferenceAxis); base = Base::Vector3d(0,0,0); - line->Placement.getValue().multVec (Base::Vector3d (1,0,0), dir); + line->Placement.getValue().multVec(Base::Vector3d (1,0,0), dir); // Check that axis is perpendicular with sketch plane! - if (sketchplane.Axis().Direction().Angle(gp_Dir(dir.x, dir.y, dir.z)) < Precision::Angular()) - throw Base::Exception("Rotation axis must not be perpendicular with the sketch plane"); + if (sketchplane.Axis().Direction().IsParallel(gp_Dir(dir.x, dir.y, dir.z), Precision::Angular())) + throw Base::Exception("Rotation axis must not be perpendicular with the sketch plane"); return; } @@ -1008,7 +1008,7 @@ void ProfileBased::getAxis(const App::DocumentObject *pcReferenceAxis, const std dir = Base::Vector3d(d.X(), d.Y(), d.Z()); // Check that axis is co-planar with sketch plane! // Check that axis is perpendicular with sketch plane! - if (sketchplane.Axis().Direction().Angle(d) < Precision::Angular()) + if (sketchplane.Axis().Direction().IsParallel(d, Precision::Angular())) throw Base::Exception("Rotation axis must not be perpendicular with the sketch plane"); return; } else {