]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Bug 0020043: EDF 865 GEOM: Object is non valid after translation. Fix object after...
authorjfa <jfa@opencascade.com>
Fri, 21 Nov 2008 11:55:24 +0000 (11:55 +0000)
committerjfa <jfa@opencascade.com>
Fri, 21 Nov 2008 11:55:24 +0000 (11:55 +0000)
src/GEOMImpl/GEOMImpl_TranslateDriver.cxx

index fba11c20900e81f0d425e22ca69145d93867d193..5854f6b71fb22bbc6da8c503f215ef1518cd574d 100644 (file)
 #include <GEOMImpl_ITranslate.hxx>
 #include <GEOMImpl_Types.hxx>
 #include <GEOM_Function.hxx>
-#include <gp_Trsf.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Vec.hxx>
-#include <BRepBuilderAPI_Transform.hxx>
+
+#include <ShapeFix_Shape.hxx>
+#include <ShapeFix_ShapeTolerance.hxx>
+
+#include <BRep_Tool.hxx>
 #include <BRep_Builder.hxx>
+#include <BRepCheck_Analyzer.hxx>
+#include <BRepBuilderAPI_Transform.hxx>
+
 #include <TopoDS.hxx>
 #include <TopoDS_Shape.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopExp.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopoDS_Edge.hxx>
-#include <BRep_Tool.hxx>
+
+#include <gp_Trsf.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Vec.hxx>
 
 //=======================================================================
 //function : GetID
@@ -237,9 +244,22 @@ Standard_Integer GEOMImpl_TranslateDriver::Execute(TFunction_Logbook& log) const
   }
   else return 0;
 
-
   if (aShape.IsNull()) return 0;
 
+  BRepCheck_Analyzer ana (aShape, Standard_True);
+  if (!ana.IsValid()) {
+    ShapeFix_ShapeTolerance aSFT;
+    aSFT.LimitTolerance(aShape,Precision::Confusion(),Precision::Confusion());
+    Handle(ShapeFix_Shape) aSfs = new ShapeFix_Shape(aShape);
+    aSfs->SetPrecision(Precision::Confusion());
+    aSfs->Perform();
+    aShape = aSfs->Shape();
+
+    ana.Init(aShape, Standard_False);
+    if (!ana.IsValid())
+      Standard_ConstructionError::Raise("Scaling aborted : algorithm has produced an invalid shape result");
+  }
+
   aFunction->SetValue(aShape);
 
   log.SetTouched(Label());