]> OCCT Git - occt-copy.git/commitdiff
0027873: Exception is raised in BRepFill_Filling::FindExtremitiesOfHoles()
authornbv <nbv@opencascade.com>
Thu, 15 Sep 2016 14:53:06 +0000 (17:53 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 23 Sep 2016 06:57:52 +0000 (09:57 +0300)
The reason of exception has been eliminated.
Creation of the test case for this issue.
Correction of unstable test case.

Some test cases have been adjusted according to their new behavior.

src/BRepFill/BRepFill_Filling.cxx
src/GeomPlate/GeomPlate_BuildPlateSurface.cxx
src/QABugs/QABugs_11.cxx
tests/bugs/modalg_6/bug27873 [new file with mode: 0644]
tests/bugs/moddata_2/bug525
tests/bugs/step/bug11856

index d14fc3d81d48f2fca897c67cdca485ff011e7d66..3a8ff73d3a86cdbd51c0d031e77a3b7b24643d92 100644 (file)
@@ -479,11 +479,20 @@ void BRepFill_Filling::FindExtremitiesOfHoles(const TopTools_ListOfShape& WireLi
   theWire = TopoDS::Wire(WireSeq(1));
   WireSeq.Remove(1);
 
-  if (theWire.Closed())
+  if (BRep_Tool::IsClosed(theWire))
     return;
 
   TopoDS_Vertex Vfirst, Vlast;
   TopExp::Vertices( theWire, Vfirst, Vlast );
+
+  if (Vfirst.IsSame(Vlast))
+  {
+    // The Wire is closed indeed despite its 
+    // being not detected earlier.
+
+    return;
+  }
+
   gp_Vec FinVec = MakeFinVec( theWire, Vlast );
   TopoDS_Vertex theVertex = Vlast;
   VerSeq.Append( Vlast );
index 80e41859c6037d14fc8ad06d3485e2c573339bf2..492674a6308a3fd7b8c9fcd040a51984cd6718f6 100644 (file)
@@ -474,8 +474,14 @@ void GeomPlate_BuildPlateSurface::Perform()
   NTPntCont = myPntCont->Length(), NbBoucle=0;
   // La variable  NTPoint peut etre enlevee
   Standard_Boolean Fini=Standard_True;
-  if ((NTLinCont+NTPntCont)==0)
-    Standard_RangeError::Raise("GeomPlate : The number of constraints is null.");
+  if ((NTLinCont + NTPntCont) == 0)
+  {
+#ifdef OCCT_DEBUG
+    cout << "WARNING : GeomPlate : The number of constraints is null." << endl;
+#endif
+
+    return;
+  }
 
   //======================================================================   
   // Surface Initiale
@@ -504,6 +510,11 @@ void GeomPlate_BuildPlateSurface::Perform()
      }
  }
 
+  if (mySurfInit.IsNull())
+  {
+    return;
+  }
+
   Standard_Real u1,v1,u2,v2;
   mySurfInit->Bounds(u1,v1,u2,v2);
   GeomAdaptor_Surface aSurfInit(mySurfInit);
@@ -647,9 +658,16 @@ void GeomPlate_BuildPlateSurface::Perform()
          //Resolution de la surface
          //====================================================================
          myPlate.SolveTI(myDegree, ComputeAnisotropie());
-         if (!myPlate.IsDone())   
-           Standard_Failure::Raise("GeomPlate : abort calcul of Plate.");
-         myGeomPlateSurface = new GeomPlate_Surface(mySurfInit,myPlate);
+          if (!myPlate.IsDone())
+          {
+#ifdef OCCT_DEBUG
+            cout << "WARNING : GeomPlate : abort calcul of Plate." << endl;
+#endif
+
+            return;
+          }
+
+          myGeomPlateSurface = new GeomPlate_Surface(mySurfInit,myPlate);
          Standard_Real Umin,Umax,Vmin,Vmax; 
           myPlate.UVBox(Umin,Umax,Vmin,Vmax);
          myGeomPlateSurface->SetBounds(Umin,Umax,Vmin,Vmax);
@@ -674,9 +692,15 @@ void GeomPlate_BuildPlateSurface::Perform()
          //Resolution de la surface
          //====================================================================
          myPlate.SolveTI(myDegree, ComputeAnisotropie());
-         if (!myPlate.IsDone())   
-           Standard_Failure::Raise("GeomPlate : abort calcul of Plate.");
-         myGeomPlateSurface = new GeomPlate_Surface(mySurfInit,myPlate);
+          if (!myPlate.IsDone())
+          {
+#ifdef OCCT_DEBUG
+            cout << "WARNING : GeomPlate : abort calcul of Plate." << endl;
+#endif
+            return;
+          }
+
+          myGeomPlateSurface = new GeomPlate_Surface(mySurfInit,myPlate);
          Standard_Real Umin,Umax,Vmin,Vmax; 
           myPlate.UVBox(Umin,Umax,Vmin,Vmax);
          myGeomPlateSurface->SetBounds(Umin,Umax,Vmin,Vmax);
@@ -1550,7 +1574,14 @@ void GeomPlate_BuildPlateSurface::ComputeSurfInit()
       if (!CourbeJoint)
        myNbBounds = 0;
       GeomPlate_BuildAveragePlane BAP( Pts, NbPoint*myNbBounds, myTol3d/1000, popt, nopt );
-      if (!BAP.IsPlane()) Standard_Failure::Raise("the initial surface is not a plane.");
+      if (!BAP.IsPlane())
+      {
+#ifdef OCCT_DEBUG
+        cout << "WARNING : GeomPlate : the initial surface is not a plane." << endl;
+#endif
+
+        return;
+      }
       Standard_Real u1,u2,v1,v2;
       BAP.MinMaxBox(u1,u2,v1,v2);
       // On agrandit le bazar pour les projections
@@ -1688,8 +1719,13 @@ void GeomPlate_BuildPlateSurface::ComputeSurfInit()
       //Resolution de la surface
       //====================================================================
       myPlate.SolveTI(2, ComputeAnisotropie());
-      if (!myPlate.IsDone())   
-       Standard_Failure::Raise("GeomPlate : abort calcul of Plate.");
+      if (!myPlate.IsDone())
+      {
+#ifdef OCCT_DEBUG
+        cout << "WARNING : GeomPlate : abort calcul of Plate." << endl;
+#endif
+        return;
+      }
 
       myGeomPlateSurface = new GeomPlate_Surface( mySurfInit, myPlate );
 
index a746d1ea5ede1b8d650c487d647357794342dc49..fc6890bb7f62a0bc857b1da38b7b4e5bbd316169 100644 (file)
@@ -1419,16 +1419,18 @@ static Standard_Integer OCC524 (Draw_Interpretor& di, Standard_Integer argc, con
 //=======================================================================
 static Standard_Integer OCC525(Draw_Interpretor& di, Standard_Integer /*argc*/, const char ** /*argv*/)
 {
-  try
+  GeomPlate_BuildPlateSurface aBuilder;
+  aBuilder.Perform();
+
+  if (aBuilder.IsDone())
   {
-    OCC_CATCH_SIGNALS
-    GeomPlate_BuildPlateSurface aBuilder;
-    aBuilder.Perform();
+    di << "Error in OCC525. Null result is expected.\n";
+  }
+  else
+  {
+    di << "OCC525 OK \n";
   }
-  catch (Standard_RangeError) { di << "OCC525 Exception \n" ;return 0; }
-  //catch (...) { di << "OCC525 Exception \n" ;return 0; }
 
-  di << "OCC525 OK \n";
   return 0;
 }
 
diff --git a/tests/bugs/modalg_6/bug27873 b/tests/bugs/modalg_6/bug27873
new file mode 100644 (file)
index 0000000..941fae6
--- /dev/null
@@ -0,0 +1,18 @@
+puts "============"
+puts "OCC27873"
+puts "============"
+puts ""
+######################################################
+# Exception is raised in BRepFill_Filling::FindExtremitiesOfHoles()
+######################################################
+
+# Input data are true invalid.
+# 1. Non-manifold wire;
+# 2. The wire contains internal edge in its boundary (i.e. if we remove this edge we will obtain not-closed wire).
+
+restore [locate_data_file bug27873_filling.brep] a
+explode a
+
+if { ![regexp {filling failed} [filling result 11 0 0 a_1 0 a_2 0 a_3 0 a_4 0 a_5 0 a_6 0 a_7 0 a_8 0 a_9 0 a_10 0 a_11 0] ] } {
+  puts "Error: Null result is expected but is not returned."
+}
index f9ab7e5a94a486cc6f77963baed4e30fad676b81..ccf98679a31e221f869804c196cba789760cd100 100755 (executable)
@@ -1,4 +1,4 @@
-puts "REQUIRED All: OCC525 Exception"
+puts "REQUIRED All: Error in OCC525. Null result is expected."
 
 pload QAcommands
 
index 4aa23372bf0e14880e53fb9248271d65aa41bd58..3c6e6dea2dd8b5962caa792c73e95be96d7071df 100755 (executable)
@@ -1,4 +1,3 @@
-
 puts "============"
 puts "OCC11856"
 puts "============"
@@ -13,7 +12,7 @@ stepread [locate_data_file OCC11856.stp] a *
 
 tpcompound result
 
-checkprops result -s 611185 -eps 0.1
+checkprops result -s 653034
 checkshape result
 checknbshapes result -vertex 684 -edge 1222 -wire 519 -face 512 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 2940
 checkview -display result -2d -path ${imagedir}/${test_image}.png