From: jfa Date: Mon, 13 Mar 2017 12:03:17 +0000 (+0300) Subject: 0023419 note (0021712). Simplify complex compounds. X-Git-Tag: SHAPER_2.7.0^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4947a3ae953aa7184c29bd595538b1b38ddead2a;p=modules%2Fgeom.git 0023419 note (0021712). Simplify complex compounds. --- diff --git a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx index 0affd3ca7..6c2e34a89 100644 --- a/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_BooleanDriver.cxx @@ -342,16 +342,30 @@ TopoDS_Shape GEOMImpl_BooleanDriver::makeCompoundShellFromFaces if (theShape.ShapeType() != TopAbs_COMPOUND) return theShape; + BRep_Builder B; + TopoDS_Compound aFaces; + B.MakeCompound(aFaces); + + // simplify compound structure for + // Mantis issue 0023419 (note 0021712) + TopExp_Explorer aExp; + TopTools_MapOfShape aMapFaces; + aExp.Init(theShape, TopAbs_FACE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Shape& aFace = aExp.Current(); + if (aMapFaces.Add(aFace)) { + B.Add(aFaces, aFace); + } + } + BOPCol_ListOfShape aListShapes; - BOPTools_AlgoTools::MakeConnexityBlocks(theShape, TopAbs_EDGE, TopAbs_FACE, aListShapes); + BOPTools_AlgoTools::MakeConnexityBlocks(aFaces, TopAbs_EDGE, TopAbs_FACE, aListShapes); if (aListShapes.IsEmpty()) return theShape; TopoDS_Compound aResult; - BRep_Builder B; B.MakeCompound(aResult); - TopExp_Explorer aExp; BOPCol_ListIteratorOfListOfShape anIter(aListShapes); for (; anIter.More(); anIter.Next()) {