[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
This commit is contained in:
DeepSOIC 2016-08-25 19:33:59 +03:00 committed by wmayer
parent 6e284fc9ea
commit f3a3bd14fb

View File

@ -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;