0022514: [CEA 1071] FuseCollinearEdgesWithinWire fails

This commit is contained in:
skv 2014-04-10 12:48:43 +04:00
parent c2e6c12db3
commit dd223ab63f

View File

@ -674,7 +674,6 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
TColStd_SequenceOfReal TolSeq; TColStd_SequenceOfReal TolSeq;
GeomAbs_CurveType CurType; GeomAbs_CurveType CurType;
TopoDS_Vertex FirstVertex, LastVertex; TopoDS_Vertex FirstVertex, LastVertex;
Standard_Boolean FinalReverse = Standard_False;
BRepTools_WireExplorer wexp(theWire) ; BRepTools_WireExplorer wexp(theWire) ;
for (; wexp.More(); wexp.Next()) for (; wexp.More(); wexp.Next())
@ -706,8 +705,6 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
LparSeq.Append(lpar); LparSeq.Append(lpar);
CurType = aType; CurType = aType;
FirstVertex = wexp.CurrentVertex(); FirstVertex = wexp.CurrentVertex();
if (anEdge.Orientation() == TopAbs_REVERSED)
FinalReverse = Standard_True;
} }
else else
{ {
@ -910,10 +907,8 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
LastVertex = wexp.CurrentVertex(); LastVertex = wexp.CurrentVertex();
TolSeq.Append(BRep_Tool::Tolerance(LastVertex)); TolSeq.Append(BRep_Tool::Tolerance(LastVertex));
TopoDS_Vertex FirstVtx_final = (FinalReverse)? LastVertex : FirstVertex; FirstVertex.Orientation(TopAbs_FORWARD);
FirstVtx_final.Orientation(TopAbs_FORWARD); LastVertex.Orientation(TopAbs_REVERSED);
TopoDS_Vertex LastVtx_final = (FinalReverse)? FirstVertex : LastVertex;
LastVtx_final.Orientation(TopAbs_REVERSED);
if (!CurveSeq.IsEmpty()) if (!CurveSeq.IsEmpty())
{ {
@ -982,7 +977,7 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
Standard_ConstructionError::Raise("Construction aborted : The given Wire has sharp bends between some Edges, no valid Edge can be built"); Standard_ConstructionError::Raise("Construction aborted : The given Wire has sharp bends between some Edges, no valid Edge can be built");
} }
ResEdge = BRepLib_MakeEdge(concatcurve->Value(concatcurve->Lower()), ResEdge = BRepLib_MakeEdge(concatcurve->Value(concatcurve->Lower()),
FirstVtx_final, LastVtx_final, FirstVertex, LastVertex,
concatcurve->Value(concatcurve->Lower())->FirstParameter(), concatcurve->Value(concatcurve->Lower())->FirstParameter(),
concatcurve->Value(concatcurve->Lower())->LastParameter()); concatcurve->Value(concatcurve->Lower())->LastParameter());
} }
@ -996,14 +991,11 @@ TopoDS_Edge GEOMImpl_ShapeDriver::MakeEdgeFromWire(const TopoDS_Shape& aWire,
aNewCurve->Transform(LocSeq(1).Location().Transformation()); aNewCurve->Transform(LocSeq(1).Location().Transformation());
ResEdge = BRepLib_MakeEdge(aNewCurve, ResEdge = BRepLib_MakeEdge(aNewCurve,
FirstVtx_final, LastVtx_final, FirstVertex, LastVertex,
FparSeq(1), LparSeq(1)); FparSeq(1), LparSeq(1));
} }
} }
if (FinalReverse)
ResEdge.Reverse();
return ResEdge; return ResEdge;
} }