diff --git a/src/BRepFill/BRepFill_Pipe.cxx b/src/BRepFill/BRepFill_Pipe.cxx index 8620b0e7b5..5e0dc6c492 100644 --- a/src/BRepFill/BRepFill_Pipe.cxx +++ b/src/BRepFill/BRepFill_Pipe.cxx @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -73,6 +74,7 @@ static void ReverseModifiedEdges(TopoDS_Shape& aShape, { TopExp_Explorer Explo(aShape, TopAbs_FACE); BRep_Builder BB; + for (; Explo.More(); Explo.Next()) { TopoDS_Shape aFace = Explo.Current(); @@ -80,19 +82,22 @@ static void ReverseModifiedEdges(TopoDS_Shape& aShape, for (; itf.More(); itf.Next()) { TopoDS_Shape aWire = itf.Value(); - TopTools_SequenceOfShape ModEdges; + TopTools_ListOfShape Ledges; TopoDS_Iterator itw(aWire); for (; itw.More(); itw.Next()) - { - TopoDS_Shape anEdge = itw.Value(); - if (Emap.Contains(anEdge)) - ModEdges.Append(anEdge); - } + Ledges.Append(itw.Value()); + aWire.Free(Standard_True); - for (Standard_Integer ii = 1; ii <= ModEdges.Length(); ii++) + TopTools_ListIteratorOfListOfShape itl(Ledges); + for (; itl.More(); itl.Next()) + BB.Remove(aWire, itl.Value()); + + for (itl.Initialize(Ledges); itl.More(); itl.Next()) { - BB.Remove(aWire, ModEdges(ii)); - BB.Add(aWire, ModEdges(ii).Reversed()); + TopoDS_Shape anEdge = itl.Value(); + if (Emap.Contains(anEdge)) + anEdge.Reverse(); + BB.Add(aWire, anEdge); } } } @@ -276,9 +281,11 @@ void BRepFill_Pipe::Perform(const TopoDS_Wire& Spine, if (!theLoc.IsIdentity()) { TopoDS_Shape NewMyFirst = BRepBuilderAPI_Copy(myFirst); + RemLoc.Remove(NewMyFirst); + NewMyFirst = RemLoc.GetResult(); TopLoc_Location theIdentity; NewMyFirst.Location(theIdentity); - myFirst = BRepBuilderAPI_Transform(NewMyFirst, theLoc.Transformation()); + myFirst = BRepBuilderAPI_Transform(NewMyFirst, theLoc.Transformation(), Standard_True); } myLoc->Law(myLoc->NbLaw())->GetDomain(first, last); @@ -307,9 +314,11 @@ void BRepFill_Pipe::Perform(const TopoDS_Wire& Spine, if (!theLoc.IsIdentity()) { TopoDS_Shape NewMyLast = BRepBuilderAPI_Copy(myLast); + RemLoc.Remove(NewMyLast); + NewMyLast = RemLoc.GetResult(); TopLoc_Location theIdentity; NewMyLast.Location(theIdentity); - myLast = BRepBuilderAPI_Transform(NewMyLast, theLoc.Transformation()); + myLast = BRepBuilderAPI_Transform(NewMyLast, theLoc.Transformation(), Standard_True); } #if DRAW diff --git a/tests/bugs/modalg_5/bug24840 b/tests/bugs/modalg_5/bug24840 new file mode 100644 index 0000000000..721673c19e --- /dev/null +++ b/tests/bugs/modalg_5/bug24840 @@ -0,0 +1,24 @@ +puts "============" +puts "OCC24840" +puts "============" +puts "" +####################################################################### +# Exception in BRepOffsetAPI_MakePipe +####################################################################### + +restore [locate_data_file bug24840_comp.brep] c +explode c + +pipe result c_1 c_2 1 + +set nb_v_good 56 +set nb_e_good 134 +set nb_w_good 99 +set nb_f_good 99 +set nb_sh_good 24 +set nb_sol_good 24 +set nb_compsol_good 1 +set nb_compound_good 0 +set nb_shape_good 437 + +set 2dviewer 1 diff --git a/tests/bugs/modalg_5/bug24849_1 b/tests/bugs/modalg_5/bug24849_1 new file mode 100644 index 0000000000..0d264a8663 --- /dev/null +++ b/tests/bugs/modalg_5/bug24849_1 @@ -0,0 +1,30 @@ +puts "================" +puts "CR24849" +puts "================" +puts "" +############################################### +## Crash on Pipe creation +############################################### + +pload DCAF + +Open [locate_data_file bug24849_Study1_GEOM.sgd] D + +GetShape D 0:1:465:1:1:2 f +GetShape D 0:1:283:1:1:2 w +explode w e +wire ww w_1 + +pipe result ww f 2 + +set nb_v_good 4 +set nb_e_good 8 +set nb_w_good 7 +set nb_f_good 7 +set nb_sh_good 2 +set nb_sol_good 2 +set nb_compsol_good 0 +set nb_compound_good 1 +set nb_shape_good 31 + +set 2dviewer 1 diff --git a/tests/bugs/modalg_5/bug24849_2 b/tests/bugs/modalg_5/bug24849_2 new file mode 100644 index 0000000000..e201da8a2c --- /dev/null +++ b/tests/bugs/modalg_5/bug24849_2 @@ -0,0 +1,30 @@ +puts "================" +puts "CR24849" +puts "================" +puts "" +############################################### +## Crash on Pipe creation +############################################### + +pload DCAF + +Open [locate_data_file bug24849_Study1_GEOM.sgd] D + +GetShape D 0:1:465:1:1:2 f +GetShape D 0:1:283:1:1:2 w +explode w e +wire ww w_2 + +pipe result ww f 2 + +set nb_v_good 4 +set nb_e_good 8 +set nb_w_good 7 +set nb_f_good 7 +set nb_sh_good 2 +set nb_sol_good 2 +set nb_compsol_good 0 +set nb_compound_good 1 +set nb_shape_good 31 + +set 2dviewer 1