]> OCCT Git - occt-copy.git/commitdiff
0026687: SIGSEGV in BRepBuilderAPI_MakeFace
authornbv <nbv@opencascade.com>
Thu, 17 Sep 2015 10:52:17 +0000 (13:52 +0300)
committerabv <abv@opencascade.com>
Fri, 18 Sep 2015 11:35:35 +0000 (14:35 +0300)
1. Check face location has been added.
2. Message, if mkplane command fails, has been added.
3. Test case for this issue has been created.

Changes in accordance with the remark.

Small correction of test case for issue CR26687

src/BRepLib/BRepLib_FindSurface.cxx
src/BRepTest/BRepTest_SurfaceCommands.cxx
tests/bugs/modalg_6/bug26687 [new file with mode: 0755]

index 5708e3e6e91b744b294803d3528bc2c1ae1008f5..7fff3126c9fe93b5f9ca509b454bd0436f849f1e 100644 (file)
@@ -117,6 +117,7 @@ static Standard_Boolean Is2DClosed(const TopoDS_Shape&         theShape,
 {
   try
   {
+    OCC_CATCH_SIGNALS
     // get a wire theShape 
     TopExp_Explorer aWireExp( theShape, TopAbs_WIRE );
     if ( !aWireExp.More() ) {
@@ -224,7 +225,7 @@ void BRepLib_FindSurface::Init(const TopoDS_Shape&    S,
           if (SS.IsNull()) {
             break;
           }
-          if (SS == mySurface) {
+          if ((SS == mySurface) && (L.IsEqual(myLocation))) {
             break;
           }
           SS.Nullify();
index 72ec47096c22c9bbcc8140be22fafeaf94de5fb4..d3efa41d2194e013af90d345da45f700d5ca41a3 100644 (file)
@@ -180,7 +180,7 @@ static Standard_Integer mksurface(Draw_Interpretor& , Standard_Integer n, const
 // mkplane
 //=======================================================================
 
-static Standard_Integer mkplane(Draw_Interpretor& , Standard_Integer n, const char** a)
+static Standard_Integer mkplane(Draw_Interpretor& theDI, Standard_Integer n, const char** a)
 {
   if (n < 3) return 1;
 
@@ -192,9 +192,30 @@ static Standard_Integer mkplane(Draw_Interpretor& , Standard_Integer n, const ch
     OnlyPlane =  !strcmp(a[3],"1");
   }
 
-  TopoDS_Face F = BRepBuilderAPI_MakeFace(TopoDS::Wire(S), OnlyPlane);
+  BRepBuilderAPI_MakeFace aMF(TopoDS::Wire(S), OnlyPlane);
+
+  switch(aMF.Error())
+  {
+  case BRepBuilderAPI_FaceDone:
+    DBRep::Set(a[1],aMF.Face());
+    break;
+  case BRepLib_NoFace:
+    theDI << "Error. mkplane has been finished with \"No Face\" status.\n";
+    break;
+  case BRepLib_NotPlanar:
+    theDI << "Error. mkplane has been finished with \"Not Planar\" status.\n";
+    break;
+  case BRepLib_CurveProjectionFailed:
+    theDI << "Error. mkplane has been finished with \"Fail in projection curve\" status.\n";
+    break;
+  case BRepLib_ParametersOutOfRange:
+    theDI << "Error. mkplane has been finished with \"Parameters are out of range\" status.\n";
+    break;
+  default:
+    theDI << "Error. Undefined status. Please check the code.\n";
+    break;
+  }
 
-  DBRep::Set(a[1],F);
   return 0;
 }
 
diff --git a/tests/bugs/modalg_6/bug26687 b/tests/bugs/modalg_6/bug26687
new file mode 100755 (executable)
index 0000000..23cdcdc
--- /dev/null
@@ -0,0 +1,21 @@
+puts "TODO 26687 ALL: Error. mkplane has been finished with \"Not Planar\" status."
+
+puts "========"
+puts "OCC26687"
+puts "========"
+puts ""
+#################################################
+# 0026687: SIGSEGV in BRepBuilderAPI_MakeFace
+#################################################
+
+restore [locate_data_file bug26687_w.brep] w
+
+#It is impossible to create a plane there is no any surface
+#which every edge has its p-cuve in.  
+
+mkplane f w
+
+smallview
+donly f
+fit
+xwd ${imagedir}/${test_image}.png