0024840: Exception in BRepOffsetAPI_MakePipe
authorjgv <jgv@opencascade.com>
Mon, 21 Apr 2014 11:47:53 +0000 (15:47 +0400)
committerabv <abv@opencascade.com>
Thu, 24 Apr 2014 11:43:26 +0000 (15:43 +0400)
Test cases for issues CR24840 and CR24849

src/BRepFill/BRepFill_Pipe.cxx
tests/bugs/modalg_5/bug24840 [new file with mode: 0644]
tests/bugs/modalg_5/bug24849_1 [new file with mode: 0644]
tests/bugs/modalg_5/bug24849_2 [new file with mode: 0644]

index 8620b0e..5e0dc6c 100644 (file)
@@ -55,6 +55,7 @@
 #include <BRepBuilderAPI_Transform.hxx>
 #include <BRepBuilderAPI_Copy.hxx>
 #include <TopTools_SequenceOfShape.hxx>
+#include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <BRepLib.hxx>
 
 #include <Geom2dAdaptor_HCurve.hxx>
@@ -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 (file)
index 0000000..721673c
--- /dev/null
@@ -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 (file)
index 0000000..0d264a8
--- /dev/null
@@ -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 (file)
index 0000000..e201da8
--- /dev/null
@@ -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