From: skv Date: Wed, 23 Oct 2013 14:29:57 +0000 (+0000) Subject: 0022375: [CEA 973] UnionFaces shall not suppress an edge between 2 continuous faces... X-Git-Tag: BR_hydro_v_0_3_1~66 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ffb97fe743b2497336a1067a03fe7b8ede585213;p=modules%2Fgeom.git 0022375: [CEA 973] UnionFaces shall not suppress an edge between 2 continuous faces if this edge is shared with a 3rd incident face --- diff --git a/src/BlockFix/BlockFix_UnionFaces.cxx b/src/BlockFix/BlockFix_UnionFaces.cxx index 962a776ec..c2d0459f8 100644 --- a/src/BlockFix/BlockFix_UnionFaces.cxx +++ b/src/BlockFix/BlockFix_UnionFaces.cxx @@ -189,6 +189,50 @@ static Handle(Geom_Surface) ClearRts(const Handle(Geom_Surface)& aSurface) return aSurface; } +//======================================================================= +//function : IsFacesOfSameSolids +//purpose : auxilary +//======================================================================= +static Standard_Boolean IsFacesOfSameSolids + (const TopoDS_Face &theFace1, + const TopoDS_Face &theFace2, + const TopTools_IndexedDataMapOfShapeListOfShape &theMapFaceSolids) +{ + Standard_Boolean isSame = Standard_False; + + if (theMapFaceSolids.Contains(theFace1) && + theMapFaceSolids.Contains(theFace2)) { + const TopTools_ListOfShape& aList1 = theMapFaceSolids.FindFromKey(theFace1); + const TopTools_ListOfShape& aList2 = theMapFaceSolids.FindFromKey(theFace2); + + if (aList1.Extent() == aList2.Extent()) { + TopTools_ListIteratorOfListOfShape anIter1(aList1); + + isSame = Standard_True; + + for (; anIter1.More(); anIter1.Next()) { + const TopoDS_Shape &aSolid1 = anIter1.Value(); + TopTools_ListIteratorOfListOfShape anIter2(aList2); + + for (; anIter2.More(); anIter2.Next()) { + if (aSolid1.IsSame(anIter2.Value())) { + // Same solid is detected. Break the loop + break; + } + } + + if (!anIter2.More()) { + // No same solid is detected. Break the loop. + isSame = Standard_False; + break; + } + } + } + } + + return isSame; +} + //======================================================================= //function : Perform //purpose : @@ -198,6 +242,12 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) Handle(ShapeBuild_ReShape) myContext = new ShapeBuild_ReShape; TopoDS_Shape aResShape = myContext->Apply(Shape); + // Fill Map of faces as keys and list of solids as items. + TopTools_IndexedDataMapOfShapeListOfShape aMapFaceSolids; + + TopExp::MapShapesAndAncestors + (Shape, TopAbs_FACE, TopAbs_SOLID, aMapFaceSolids); + // processing each solid TopExp_Explorer exps; for (exps.Init(Shape, TopAbs_SOLID); exps.More(); exps.Next()) { @@ -265,6 +315,11 @@ TopoDS_Shape BlockFix_UnionFaces::Perform(const TopoDS_Shape& Shape) if (aProcessed.Contains(anCheckedFace)) continue; + // Check if faces belong to same solids. + if (!IsFacesOfSameSolids(aFace, anCheckedFace, aMapFaceSolids)) { + continue; + } + if (IsSameDomain(aFace,anCheckedFace)) { if (aList.Extent() != 2) {