From f3a3bd14fb1ad541d78e1cf8baeb6e2bacdfdf50 Mon Sep 17 00:00:00 2001 From: DeepSOIC Date: Thu, 25 Aug 2016 19:33:59 +0300 Subject: [PATCH] [breaking] Part: Revolve: fix forgotten check for reverseness of axis link I didn't know BRepAdaptor_Curve does not take shape orientation (reverseness) into account. The commit can break existing projects. If revolution feature was created with axis linked to reversed edge, and angle span is not 360, the revolution direction will now swap. The chances of this situation are pretty low, and revolution supports axis linkage for not long yet. So I hope it won't cause any noticeable trouble. --DeepSOIC --- src/Mod/Part/App/FeatureRevolution.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Mod/Part/App/FeatureRevolution.cpp b/src/Mod/Part/App/FeatureRevolution.cpp index 66408b10dc8e..16024f3ad089 100644 --- a/src/Mod/Part/App/FeatureRevolution.cpp +++ b/src/Mod/Part/App/FeatureRevolution.cpp @@ -106,8 +106,9 @@ bool Revolution::fetchAxisLink(const App::PropertyLinkSub &axisLink, BRepAdaptor_Curve crv(TopoDS::Edge(axEdge)); gp_Pnt base; gp_Dir occdir; + bool reversed = axEdge.Orientation() == TopAbs_REVERSED; if (crv.GetType() == GeomAbs_Line){ - base = crv.Value(crv.FirstParameter()); + base = crv.Value(reversed ? crv.FirstParameter() : crv.LastParameter()); occdir = crv.Line().Direction(); } else if (crv.GetType() == GeomAbs_Circle) { base = crv.Circle().Axis().Location(); @@ -116,6 +117,8 @@ bool Revolution::fetchAxisLink(const App::PropertyLinkSub &axisLink, } else { throw Base::TypeError("AxisLink edge is neither line nor arc of circle."); } + if (reversed) + occdir.Reverse(); center.Set(base.X(), base.Y(),base.Z()); dir.Set(occdir.X(), occdir.Y(), occdir.Z()); return true;