0026553: Out of range exception in BRepFill_Pipe::FindEdge
authordbv <dbv@opencascade.com>
Thu, 20 Aug 2015 13:42:50 +0000 (16:42 +0300)
committerski <ski@opencascade.com>
Thu, 20 Aug 2015 13:43:39 +0000 (16:43 +0300)
Test case for issue CR26553
Warning fix

src/BRepFill/BRepFill_Pipe.cxx
src/QABugs/QABugs_19.cxx
tests/bugs/modalg_6/bug26553 [new file with mode: 0644]

index d8ab8d9..829110d 100644 (file)
@@ -799,14 +799,14 @@ Standard_Integer BRepFill_Pipe::FindEdge(const TopoDS_Shape& S,
          
   case TopAbs_WIRE :
     {
-      Standard_Integer ii = InitialLength+1;
       Handle(BRepFill_ShapeLaw) Section = 
-       new (BRepFill_ShapeLaw) (TopoDS::Wire(S), Standard_False);
-      InitialLength += Section->NbLaw();
-     
-      for (; (ii<=InitialLength) && (!result); ii++) {
-       if (E.IsSame(Section->Edge(ii)) ) result = ii;
+        new (BRepFill_ShapeLaw) (TopoDS::Wire(S), Standard_False);
+      Standard_Integer NbLaw = Section->NbLaw();
+
+      for (Standard_Integer ii = 1; (ii<=NbLaw) && (!result); ii++) {
+        if (E.IsSame(Section->Edge(ii)) ) result = InitialLength + ii;
       }
+      InitialLength += NbLaw;
       break;
     }
 
index 5002e19..2b3f6e2 100644 (file)
@@ -3876,6 +3876,53 @@ static Standard_Integer OCC26485 (Draw_Interpretor& theDI, Standard_Integer theA
   return 0;
 }
 
+//=======================================================================
+//function : OCC26553
+//purpose  :
+//=======================================================================
+#include <BRepBuilderAPI_MakeWire.hxx>
+
+static Standard_Integer OCC26553 (Draw_Interpretor& theDI, Standard_Integer theArgc, const char** theArgv)
+{
+  if (theArgc < 2)
+  {
+    theDI << "Error: path to file with shell is missing\n";
+    return 1;
+  }
+
+  BRep_Builder aBuilder;
+  TopoDS_Shape aShell;
+  BRepTools::Read(aShell, theArgv[1], aBuilder);
+
+  if (aShell.IsNull())
+  {
+    theDI << "Error: shell not loaded\n";
+    return 1;
+  }
+
+  TopoDS_Edge aPipeEdge = BRepBuilderAPI_MakeEdge (gp_Pnt (0, 0, 0), gp_Pnt (0, 0, 10));
+  TopoDS_Wire aPipeWire = BRepBuilderAPI_MakeWire(aPipeEdge).Wire();
+
+  BRepOffsetAPI_MakePipe aPipeBuilder(aPipeWire, aShell);
+  if (!aPipeBuilder.IsDone())
+  {
+    theDI << "Error: failed to create pipe\n";
+    return 1;
+  }
+
+  for (TopExp_Explorer aShapeExplorer(aShell, TopAbs_EDGE); aShapeExplorer.More(); aShapeExplorer.Next ()) {
+    const TopoDS_Shape& aGeneratedShape = aPipeBuilder.Generated(aPipeEdge, aShapeExplorer.Current());
+    if (aGeneratedShape.IsNull())
+    {
+      theDI << "Error: null shape\n";
+      return 1;
+    }
+  }
+
+  theDI << "History returned successfully\n";
+  return 0;
+}
+
 void QABugs::Commands_19(Draw_Interpretor& theCommands) {
   const char *group = "QABugs";
 
@@ -3951,5 +3998,6 @@ void QABugs::Commands_19(Draw_Interpretor& theCommands) {
   theCommands.Add ("OCC26448", "OCC26448: check method Prepend() of sequence", __FILE__, OCC26448, group);
   theCommands.Add ("OCC26407", "OCC26407 result_name", __FILE__, OCC26407, group);
   theCommands.Add ("OCC26485", "OCC26485 shape", __FILE__, OCC26485, group);
+  theCommands.Add ("OCC26553", "OCC26553 file_path", __FILE__, OCC26553, group);
   return;
 }
diff --git a/tests/bugs/modalg_6/bug26553 b/tests/bugs/modalg_6/bug26553
new file mode 100644 (file)
index 0000000..af50724
--- /dev/null
@@ -0,0 +1,11 @@
+puts "================"
+puts "OCC26553"
+puts "================"
+puts ""
+#######################################################################
+# Out of range exception in BRepFill_Pipe::FindEdge
+#######################################################################
+
+pload QAcommands
+
+OCC26553 [locate_data_file bug26553_wire.brep]