]> 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)
committerbugmaster <bugmaster@opencascade.com>
Thu, 17 Sep 2015 14:01:23 +0000 (17:01 +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 fa2f648102de0e93e02402ab7c0cb790189aa184..b01ac1b9f21f077078bc524b657f08244af56a5b 100644 (file)
@@ -118,6 +118,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() ) {
@@ -225,7 +226,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..059f001
--- /dev/null
@@ -0,0 +1,21 @@
+puts "REQUIRED: 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