]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
0021263: EDF 1868: Several use cases fail (regressions) V6_6_0b1
authorskv <skv@opencascade.com>
Fri, 9 Nov 2012 06:14:12 +0000 (06:14 +0000)
committerskv <skv@opencascade.com>
Fri, 9 Nov 2012 06:14:12 +0000 (06:14 +0000)
0021568: EDF GEOM: PipeTShape with Fillet and prepared for hexa mesh cannot be built

src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx

index 7fc3b43bc8244e34515e913dfc6f2b228c915cd7..70f0ab20e47f65b52af6c5a2debe80302386a8ca 100644 (file)
@@ -56,6 +56,7 @@
 #include <TopoDS.hxx>
 #include <TopoDS_Vertex.hxx>
 #include <TopTools_IndexedMapOfShape.hxx>
+#include <TColStd_IndexedDataMapOfTransientTransient.hxx>
 
 #include <gp_Pnt.hxx>
 #include <gp_Vec.hxx>
@@ -70,6 +71,7 @@
 #include <TFunction_Driver.hxx>
 #include <TFunction_Logbook.hxx>
 #include <TDF_Tool.hxx>
+#include <TNaming_CopyShape.hxx>
 #include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx> // CAREFUL ! position of this file is critic : see Lucien PIGNOLONI / OCC
 
@@ -1138,6 +1140,11 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapeMirrorAndGlue(Handle(GEOM_Objec
     return false;
   }
 
+  // Copy source shape
+  TopoDS_Shape aShapeCopy;
+  TColStd_IndexedDataMapOfTransientTransient aMapTShapes;
+  TNaming_CopyShape::CopyTool(Te7->GetValue(), aMapTShapes, aShapeCopy);
+
   Handle(GEOM_Object) Te8 = myShapesOperations->MakeGlueFaces(Te7, 1e-7, true);
   if (Te8.IsNull()) {
     SetErrorCode("Impossible to glue faces of TShape");
@@ -1145,6 +1152,34 @@ bool GEOMImpl_IAdvancedOperations::MakePipeTShapeMirrorAndGlue(Handle(GEOM_Objec
   }
 
   TopoDS_Shape aShape = Te8->GetValue();
+  BRepCheck_Analyzer anAna (aShape, Standard_True);
+
+  if (!anAna.IsValid()) {
+    // Try to do gluing with the tolerance equal to maximal
+    // tolerance of vertices of the source shape.
+    Standard_Real aTolMax = -RealLast();
+
+    for (TopExp_Explorer ExV (aShapeCopy, TopAbs_VERTEX); ExV.More(); ExV.Next()) {
+      TopoDS_Vertex aVertex = TopoDS::Vertex(ExV.Current());
+      Standard_Real aTol = BRep_Tool::Tolerance(aVertex);
+
+      if (aTol > aTolMax) {
+        aTolMax = aTol;
+      }
+    }
+
+    // Perform gluing
+    Te7->GetLastFunction()->SetValue(aShapeCopy);
+    Te8 = myShapesOperations->MakeGlueFaces(Te7, aTolMax, true);
+
+    if (Te8.IsNull()) {
+      SetErrorCode("Impossible to glue faces of TShape");
+      return false;
+    }
+
+    aShape = Te8->GetValue();
+  }
+
 
   theShape->GetLastFunction()->SetValue(aShape);