]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Changes for bug 0021699 from Mantis.
authorskl <skl@opencascade.com>
Fri, 23 Apr 2010 09:05:42 +0000 (09:05 +0000)
committerskl <skl@opencascade.com>
Fri, 23 Apr 2010 09:05:42 +0000 (09:05 +0000)
src/GEOMImpl/GEOMImpl_OffsetDriver.cxx

index 0bf2a926f196e405dc72a71006d7121ed3a216e5..edd84de19c8bc8c095ae7c31623de460d12f6896 100644 (file)
 #include <Precision.hxx>
 #include <gp_Pnt.hxx>
 
+#include <BRepCheck_Analyzer.hxx>
+#include <ShapeFix_ShapeTolerance.hxx>
+#include <ShapeFix_Shape.hxx>
+
+#include <Standard_ConstructionError.hxx>
 #include <StdFail_NotDone.hxx>
 
 //=======================================================================
@@ -91,7 +96,22 @@ Standard_Integer GEOMImpl_OffsetDriver::Execute(TFunction_Logbook& log) const
                                       aTol);
     if (MO.IsDone()) {
       aShape = MO.Shape();
-    } else {
+      // 23.04.2010 skl for bug 21699 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");
+      }
+    }
+    else {
       StdFail_NotDone::Raise("Offset construction failed");
     }
   } else {