From: jfa Date: Fri, 11 Nov 2011 12:28:39 +0000 (+0000) Subject: Mantis issue 0021399: Cant' build an edge from a wire. A fix by JGV. X-Git-Tag: RELIQUAT_6x_15112011~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c9cbee8d012d530e704fd953aece39a58e3ecbef;p=modules%2Fgeom.git Mantis issue 0021399: Cant' build an edge from a wire. A fix by JGV. --- diff --git a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx index 332d11769..37f3937f0 100644 --- a/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_ShapeDriver.cxx @@ -495,6 +495,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const TColStd_SequenceOfReal TolSeq; GeomAbs_CurveType CurType; TopoDS_Vertex FirstVertex, LastVertex; + Standard_Boolean FinalReverse = Standard_False; BRepTools_WireExplorer wexp(theWire) ; for (; wexp.More(); wexp.Next()) @@ -526,6 +527,8 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const LparSeq.Append(lpar); CurType = aType; FirstVertex = wexp.CurrentVertex(); + if (anEdge.Orientation() == TopAbs_REVERSED) + FinalReverse = Standard_True; } else { @@ -728,6 +731,11 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const 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 @@ -795,20 +803,25 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const 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) { @@ -873,7 +886,7 @@ Standard_Integer GEOMImpl_ShapeDriver::Execute(TFunction_Logbook& log) const // 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) {