From: skv Date: Tue, 10 Dec 2013 16:00:37 +0000 (+0000) Subject: Fix of geom/bugs_12/M2 test case X-Git-Tag: V7_3_0~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=2c88eef4afd62d14b07f1d928b2a3f483db1d39b;p=modules%2Fgeom.git Fix of geom/bugs_12/M2 test case --- diff --git a/src/BlockFix/BlockFix_UnionFaces.cxx b/src/BlockFix/BlockFix_UnionFaces.cxx index 292286276..34f0e2faf 100644 --- a/src/BlockFix/BlockFix_UnionFaces.cxx +++ b/src/BlockFix/BlockFix_UnionFaces.cxx @@ -233,6 +233,41 @@ static Standard_Boolean IsFacesOfSameSolids return isSame; } +//======================================================================= +//function : IsEdgeValidToMerge +//purpose : Edge is valid if it is not seam or if it is a seam and the face +// has another seam edge. +//======================================================================= +static Standard_Boolean IsEdgeValidToMerge(const TopoDS_Edge &theEdge, + const TopoDS_Face &theFace) +{ + Standard_Boolean isValid = Standard_True; + + if (BRep_Tool::IsClosed(theEdge, theFace)) { + // This is a seam edge. Check if there are another seam edges on the face. + TopExp_Explorer anExp(theFace, TopAbs_EDGE); + + for (; anExp.More(); anExp.Next()) { + const TopoDS_Shape &aShEdge = anExp.Current(); + + // Skip same edge. + if (theEdge.IsSame(aShEdge)) { + continue; + } + + // Check if this edge is a seam. + TopoDS_Edge anEdge = TopoDS::Edge(aShEdge); + + if (BRep_Tool::IsClosed(anEdge, theFace)) { + isValid = Standard_False; + break; + } + } + } + + return isValid; +} + //======================================================================= //function : Perform //purpose : @@ -302,7 +337,7 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) Standard_Integer i; for (i = 1; i <= edges.Length(); i++) { TopoDS_Edge edge = TopoDS::Edge(edges(i)); - if (BRep_Tool::Degenerated(edge) || BRep_Tool::IsClosed(edge, aFace)) + if (BRep_Tool::Degenerated(edge) || !IsEdgeValidToMerge(edge, aFace)) continue; const TopTools_ListOfShape& aList = aMapEdgeFaces.FindFromKey(edge); @@ -315,7 +350,7 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) if (aProcessed.Contains(anCheckedFace)) continue; - if (BRep_Tool::IsClosed(edge, anCheckedFace)) { + if (!IsEdgeValidToMerge(edge, anCheckedFace)) { // Skip seam edge. continue; }