TColStd_SequenceOfReal TolSeq;
GeomAbs_CurveType CurType;
TopoDS_Vertex FirstVertex, LastVertex;
+ Standard_Boolean FinalReverse = Standard_False;
BRepTools_WireExplorer wexp(theWire) ;
for (; wexp.More(); wexp.Next())
LparSeq.Append(lpar);
CurType = aType;
FirstVertex = wexp.CurrentVertex();
+ if (anEdge.Orientation() == TopAbs_REVERSED)
+ FinalReverse = Standard_True;
}
else
{
LastVertex = wexp.CurrentVertex();
TolSeq.Append(BRep_Tool::Tolerance(LastVertex));
+ TopoDS_Vertex FirstVtx_final = (FinalReverse)? LastVertex : FirstVertex;
+ FirstVtx_final.Orientation(TopAbs_FORWARD);
+ TopoDS_Vertex LastVtx_final = (FinalReverse)? FirstVertex : LastVertex;
+ LastVtx_final.Orientation(TopAbs_REVERSED);
+
if (!CurveSeq.IsEmpty())
{
Standard_Integer nb_curve = CurveSeq.Length(); //number of curves
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()),
- FirstVertex, LastVertex);
+ FirstVtx_final, LastVtx_final,
+ concatcurve->Value(concatcurve->Lower())->FirstParameter(),
+ concatcurve->Value(concatcurve->Lower())->LastParameter());
}
else
{
if (CurveSeq(1)->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
- CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(i))))->BasisCurve();
+ CurveSeq(1) = (*((Handle(Geom_TrimmedCurve)*)&(CurveSeq(1))))->BasisCurve();
CurveSeq(1)->Transform(LocSeq(1).Location().Transformation());
ResEdge = BRepLib_MakeEdge(CurveSeq(1),
- FirstVertex, LastVertex,
+ FirstVtx_final, LastVtx_final,
FparSeq(1), LparSeq(1));
}
}
+ if (FinalReverse)
+ ResEdge.Reverse();
+
aShape = ResEdge;
}
else if (aType == EDGE_CURVE_LENGTH) {
// Get the point by length
GeomAdaptor_Curve AdapCurve = GeomAdaptor_Curve(ReOrientedCurve);
- GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
+ GCPnts_AbscissaPoint anAbsPnt (AdapCurve, aLength, UFirst);
Standard_Real aParam = anAbsPnt.Parameter();
if (AdapCurve.IsClosed() && aLength < 0.0) {