diff --git a/src/BRepFill/BRepFill_Pipe.cxx b/src/BRepFill/BRepFill_Pipe.cxx index 034fcf247a..aa1f80b868 100644 --- a/src/BRepFill/BRepFill_Pipe.cxx +++ b/src/BRepFill/BRepFill_Pipe.cxx @@ -53,6 +53,7 @@ #include #include #include +#include #include #include @@ -60,11 +61,42 @@ #include #include +#include + #ifdef DRAW #include static Standard_Boolean Affich = 0; #endif +static void ReverseModifiedEdges(TopoDS_Shape& aShape, + TopTools_MapOfShape& Emap) +{ + TopExp_Explorer Explo(aShape, TopAbs_FACE); + BRep_Builder BB; + for (; Explo.More(); Explo.Next()) + { + TopoDS_Shape aFace = Explo.Current(); + TopoDS_Iterator itf(aFace); + for (; itf.More(); itf.Next()) + { + TopoDS_Shape aWire = itf.Value(); + TopTools_SequenceOfShape ModEdges; + TopoDS_Iterator itw(aWire); + for (; itw.More(); itw.Next()) + { + TopoDS_Shape anEdge = itw.Value(); + if (Emap.Contains(anEdge)) + ModEdges.Append(anEdge); + } + aWire.Free(Standard_True); + for (Standard_Integer ii = 1; ii <= ModEdges.Length(); ii++) + { + BB.Remove(aWire, ModEdges(ii)); + BB.Add(aWire, ModEdges(ii).Reversed()); + } + } + } +} static void UpdateTolFromTopOrBottomPCurve(const TopoDS_Face& aFace, TopoDS_Edge& anEdge) @@ -237,6 +269,18 @@ void BRepFill_Pipe::Perform(const TopoDS_Wire& Spine, myFirst = BRepBuilderAPI_Transform(myProfile, fila, Standard_True); //copy } + ShapeUpgrade_RemoveLocations RemLoc; + RemLoc.Remove(myFirst); + myFirst = RemLoc.GetResult(); + TopLoc_Location theLoc = myFirst.Location(); + if (!theLoc.IsIdentity()) + { + TopoDS_Shape NewMyFirst = BRepBuilderAPI_Copy(myFirst); + TopLoc_Location theIdentity; + NewMyFirst.Location(theIdentity); + myFirst = BRepBuilderAPI_Transform(NewMyFirst, theLoc.Transformation()); + } + myLoc->Law(myLoc->NbLaw())->GetDomain(first, last); myLoc->Law(myLoc->NbLaw())->D0(last,M, V); // try { // Not good, but there are no other means to test SetValues @@ -256,6 +300,18 @@ void BRepFill_Pipe::Perform(const TopoDS_Wire& Spine, else { myLast = myFirst; } + + RemLoc.Remove(myLast); + myLast = RemLoc.GetResult(); + theLoc = myLast.Location(); + if (!theLoc.IsIdentity()) + { + TopoDS_Shape NewMyLast = BRepBuilderAPI_Copy(myLast); + TopLoc_Location theIdentity; + NewMyLast.Location(theIdentity); + myLast = BRepBuilderAPI_Transform(NewMyLast, theLoc.Transformation()); + } + #if DRAW if (Affich) { DBRep::Set("theprof", TheProf); @@ -595,6 +651,9 @@ TopoDS_Shape BRepFill_Pipe::MakeShape(const TopoDS_Shape& S, MkSw.Build( myReversedEdges, myTapes, BRepFill_Modified, myContinuity, GeomFill_Location, myDegmax, mySegmax ); result = MkSw.Shape(); + //Correct and + ReverseModifiedEdges(myFirst, myReversedEdges); + ReverseModifiedEdges(myLast, myReversedEdges); // Labeling of elements if (mySections.IsNull()) { diff --git a/src/BRepFill/BRepFill_Sweep.cxx b/src/BRepFill/BRepFill_Sweep.cxx index 09907ffc48..c2d13574e5 100644 --- a/src/BRepFill/BRepFill_Sweep.cxx +++ b/src/BRepFill/BRepFill_Sweep.cxx @@ -2066,26 +2066,6 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section, Standard_Boolean exuv, singu, singv; Handle(Geom_Surface) S; - // Preprocessing: correct if the profile is shell - if (!ReversedEdges.IsEmpty()) - { - TopTools_SequenceOfShape EdgesToReverse; - TopoDS_Iterator itw(FirstShape); - for (; itw.More(); itw.Next()) - { - const TopoDS_Shape& anEdge = itw.Value(); - if (ReversedEdges.Contains(anEdge)) - EdgesToReverse.Append(anEdge); - } - FirstShape.Free(Standard_True); - for (Standard_Integer i = 1; i <= EdgesToReverse.Length(); i++) - { - B.Remove(FirstShape, EdgesToReverse(i)); - EdgesToReverse(i).Reverse(); - B.Add(FirstShape, EdgesToReverse(i)); - } - } - // (2.0) return preexisting Edges and vertices TopoDS_Edge E; TColStd_Array1OfBoolean IsBuilt(1, NbLaw); @@ -2296,6 +2276,7 @@ BRepFill_Sweep::BRepFill_Sweep(const Handle(BRepFill_SectionLaw)& Section, // ---------- Creation of Vertex and edge ------------ + ReversedEdges.Clear(); for (ipath=1, IPath=IFirst; ipath<=NbPath; ipath++, IPath++) { for (isec=1; isec <=NbLaw; isec++) { diff --git a/tests/bugs/modalg_5/bug24586 b/tests/bugs/modalg_5/bug24586 new file mode 100755 index 0000000000..b3e7033c6e --- /dev/null +++ b/tests/bugs/modalg_5/bug24586 @@ -0,0 +1,24 @@ +puts "============" +puts "OCC24586" +puts "============" +puts "" +####################################################################### +# Pipe construction is failed +####################################################################### + +restore [locate_data_file bug24586_base.brep] base +restore [locate_data_file bug24586_path.brep] path + +pipe result path base + +set nb_v_good 164 +set nb_e_good 379 +set nb_w_good 240 +set nb_f_good 240 +set nb_sh_good 24 +set nb_sol_good 24 +set nb_compsol_good 0 +set nb_compound_good 1 +set nb_shape_good 1072 + +set 2dviewer 1