]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Changes for bug 0019761 from Mantis.
authorskl <skl@opencascade.com>
Tue, 8 Jul 2008 12:42:09 +0000 (12:42 +0000)
committerskl <skl@opencascade.com>
Tue, 8 Jul 2008 12:42:09 +0000 (12:42 +0000)
src/GEOMImpl/GEOMImpl_BooleanDriver.cxx
src/GEOMImpl/GEOMImpl_FilletDriver.cxx
src/GEOMImpl/GEOMImpl_PartitionDriver.cxx

index c419cd6d5f93adbc78297384662cad6e3a0c762f..39d625d5460c172e043c58f744d06d0d68079f57 100644 (file)
@@ -38,6 +38,9 @@
 #include <TopTools_ListOfShape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <Precision.hxx>
+#include <BRepCheck_Analyzer.hxx>
+#include <ShapeFix_ShapeTolerance.hxx>
+#include <ShapeFix_Shape.hxx>
 
 #include <Standard_ConstructionError.hxx>
 #include <StdFail_NotDone.hxx>
@@ -405,9 +408,24 @@ Standard_Integer GEOMImpl_BooleanDriver::Execute(TFunction_Logbook& log) const
   }
 
   if (aShape.IsNull()) return 0;
-  if (!BRepAlgo::IsValid(aShape)) {
-    Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result");
+
+  // 08.07.2008 skl for bug 19761 from Mantis
+  BRepCheck_Analyzer ana (aShape, Standard_True);
+  ana.Init(aShape);
+  if (!ana.IsValid()) {
+    ShapeFix_ShapeTolerance aSFT;
+    aSFT.LimitTolerance(aShape, Precision::Confusion(),
+                        Precision::Confusion(), TopAbs_SHAPE);
+    Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
+    aSfs->Perform();
+    aShape = aSfs->Shape();
+    ana.Init(aShape);
+    if (!ana.IsValid())
+      Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result");
   }
+  //if (!BRepAlgo::IsValid(aShape)) {
+  //  Standard_ConstructionError::Raise("Boolean operation aborted : non valid shape result");
+  //}
 
   aFunction->SetValue(aShape);
 
index e662d4cac496318b54bf15169f35c3b349d0fe4f..44ba9b2249f943c8d86832040d701d8c18c76f00 100644 (file)
@@ -36,6 +36,9 @@
 #include <TopAbs.hxx>
 #include <TopExp_Explorer.hxx>
 
+#include <ShapeFix_ShapeTolerance.hxx>
+#include <ShapeFix_Shape.hxx>
+
 #include <Precision.hxx>
 #include <gp_Pnt.hxx>
 #include <StdFail_NotDone.hxx>
@@ -128,7 +131,16 @@ Standard_Integer GEOMImpl_FilletDriver::Execute(TFunction_Logbook& log) const
   // Check shape validity
   BRepCheck_Analyzer ana (aShape, false);
   if (!ana.IsValid()) {
-    StdFail_NotDone::Raise("Fillet algorithm have produced an invalid shape result");
+    // 08.07.2008 added by skl during fixing bug 19761 from Mantis
+    ShapeFix_ShapeTolerance aSFT;
+    aSFT.LimitTolerance(aShape, Precision::Confusion(),
+                        Precision::Confusion(), TopAbs_SHAPE);
+    Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
+    aSfs->Perform();
+    aShape = aSfs->Shape();
+    ana.Init(aShape);
+    if (!ana.IsValid())
+      StdFail_NotDone::Raise("Fillet algorithm have produced an invalid shape result");
   }
 
   aFunction->SetValue(aShape);
index b681770981346109afa803f8a847d5c356b30871..6ef13f5d83fade11f34d0ffbb909b40a800a6725 100644 (file)
@@ -46,6 +46,9 @@
 #include <TopTools_MapOfShape.hxx>
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 
+#include <ShapeFix_ShapeTolerance.hxx>
+#include <ShapeFix_Shape.hxx>
+
 #include <TColStd_ListIteratorOfListOfInteger.hxx>
 #include <TColStd_ListOfInteger.hxx>
 #include <Standard_NullObject.hxx>
@@ -258,7 +261,15 @@ Standard_Integer GEOMImpl_PartitionDriver::Execute(TFunction_Logbook& log) const
   if (aShape.IsNull()) return 0;
 
   if (!BRepAlgo::IsValid(aShape)) {
-    Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
+    // 08.07.2008 added by skl during fixing bug 19761 from Mantis
+    ShapeFix_ShapeTolerance aSFT;
+    aSFT.LimitTolerance(aShape, Precision::Confusion(),
+                        Precision::Confusion(), TopAbs_SHAPE);
+    Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
+    aSfs->Perform();
+    aShape = aSfs->Shape();
+    if (!BRepAlgo::IsValid(aShape))
+      Standard_ConstructionError::Raise("Partition aborted : non valid shape result");
   }
 
   aFunction->SetValue(aShape);