Skip to content

Commit

Permalink
[breaking] Part: Revolve: fix forgotten check for reverseness of axis…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
DeepSOIC authored and wwmayer committed Sep 1, 2016
1 parent 6e284fc commit f3a3bd1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Mod/Part/App/FeatureRevolution.cpp
Expand Up @@ -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();
Expand All @@ -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;
Expand Down

0 comments on commit f3a3bd1

Please sign in to comment.