From bcea256296644861412583c3c9f9f7d9df1dafd6 Mon Sep 17 00:00:00 2001 From: skv Date: Fri, 9 Nov 2012 06:14:12 +0000 Subject: [PATCH] 0021263: EDF 1868: Several use cases fail (regressions) 0021568: EDF GEOM: PipeTShape with Fillet and prepared for hexa mesh cannot be built --- src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx index 7fc3b43bc..70f0ab20e 100644 --- a/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx +++ b/src/GEOMImpl/GEOMImpl_IAdvancedOperations.cxx @@ -56,6 +56,7 @@ #include #include #include +#include #include #include @@ -70,6 +71,7 @@ #include #include #include +#include #include #include // 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); -- 2.39.2