From: jfa Date: Mon, 18 Aug 2008 07:49:03 +0000 (+0000) Subject: IPAL19834: Incorrect result after make Partition of 2 objects. A fix by PKV. X-Git-Tag: V5_1_0a1~22 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b568e7744737ad193de8a49b27a5769a4777d7fd;p=modules%2Fgeom.git IPAL19834: Incorrect result after make Partition of 2 objects. A fix by PKV. --- diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx index 724e9c77f..664e3e878 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderFace.cxx @@ -251,6 +251,7 @@ static TopTools_MapIteratorOfMapOfOrientedShape aItM; TopTools_IndexedDataMapOfShapeListOfShape aVEMap; TopTools_MapOfOrientedShape aMAdded; + TopoDS_Iterator aItW; BRep_Builder aBB; GEOMAlgo_WireEdgeSet aWES; GEOMAlgo_WESCorrector aWESCor; @@ -278,6 +279,37 @@ static const TopoDS_Shape& aW=aIt.Value(); myLoops.Append(aW); } + //modified by NIZNHY-PKV Tue Aug 5 15:09:29 2008f + // Post Treatment + TopTools_MapOfOrientedShape aMEP; + // + // a. collect all edges that are in loops + aIt.Initialize (myLoops); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aW=aIt.Value(); + aItW.Initialize(aW); + for (; aItW.More(); aItW.Next()) { + const TopoDS_Shape& aE=aItW.Value(); + aMEP.Add(aE); + } + } + // + // b. collect all edges that are to avoid + aItM.Initialize(myShapesToAvoid); + for (; aItM.More(); aItM.Next()) { + const TopoDS_Shape& aE=aItM.Key(); + aMEP.Add(aE); + } + // + // c. add all edges that are not processed to myShapesToAvoid + aIt.Initialize (myShapes); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aE=aIt.Value(); + if (!aMEP.Contains(aE)) { + myShapesToAvoid.Add(aE); + } + } + //modified by NIZNHY-PKV Tue Aug 5 15:09:35 2008t // // 2. Internal Wires myLoopsInternal.Clear(); @@ -302,7 +334,7 @@ static aBB.MakeWire(aW); aBB.Add(aW, aEE); // - TopoDS_Iterator aItW (aW); + aItW.Initialize(aW); for (; aItW.More()&&bFlag; aItW.Next()) { const TopoDS_Edge& aE=TopoDS::Edge(aItW.Value()); // diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx index 1701f3e38..cecfa38a8 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx @@ -93,7 +93,10 @@ static void MakeInternalShells(const TopTools_MapOfShape& , TopTools_ListOfShape& ); - +//modified by NIZNHY-PKV Tue Aug 5 15:06:50 2008f +static + Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell); +//modified by NIZNHY-PKV Tue Aug 5 15:06:57 2008t //======================================================================= //function : @@ -228,6 +231,17 @@ static myShapesToAvoid.Add(aF2); } } + //DEB + else { + TopTools_ListIteratorOfListOfShape aItLF; + // + aItLF.Initialize (aLF); + for (; aItLF.More(); aItLF.Next()) { + const TopoDS_Shape& aFx=aItLF.Value(); + int a=0; + } + } + //DEB }// for (i=1; i<=aNbE; ++i) { // if (!bFound) { @@ -246,14 +260,16 @@ static // myLoops.Clear(); // - Standard_Integer aNbLF, aNbOff, aNbFP; + Standard_Integer aNbLF, aNbOff, aNbFP, aNbFA; TopAbs_Orientation anOr; TopoDS_Edge aEL; BRep_Builder aBB; NMTTools_CoupleOfShape aCSOff; - TopTools_MapOfOrientedShape AddedFacesMap; + TopTools_MapOfOrientedShape AddedFacesMap;//, aMFP; TopTools_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP; - TopTools_ListIteratorOfListOfShape aItF; + TopTools_ListIteratorOfListOfShape aItF, aIt; + TopTools_MapIteratorOfMapOfOrientedShape aItM; + TopoDS_Iterator aItS; // //================================================= // @@ -366,17 +382,61 @@ static } } // for (; aEdgeExp.More(); aEdgeExp.Next()) { } //for (; aItAddedF.More(); aItAddedF.Next()) { - myLoops.Append(aShell); + //modified by NIZNHY-PKV Tue Aug 5 15:07:08 2008f + //myLoops.Append(aShell); + if (IsClosedShell(aShell)) { + myLoops.Append(aShell); + } + /* + else { + TopoDS_Iterator aItS; + aItS.Initialize(aShell); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aFs=aItS.Value(); + aMFP.Add(aFs); + } + } + */ + //modified by NIZNHY-PKV Tue Aug 5 15:07:30 2008t } // for (; aItF.More(); aItF.Next()) { + //modified by NIZNHY-PKV Tue Aug 5 15:07:35 2008f + // + // Post Treatment + TopTools_MapOfOrientedShape aMP; + // + // a. collect all edges that are in loops + aIt.Initialize (myLoops); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + aItS.Initialize(aS); + for (; aItS.More(); aItS.Next()) { + const TopoDS_Shape& aF=aItS.Value(); + aMP.Add(aF); + } + } + // + // b. collect all edges that are to avoid + aItM.Initialize(myShapesToAvoid); + for (; aItM.More(); aItM.Next()) { + const TopoDS_Shape& aF=aItM.Key(); + aMP.Add(aF); + } + // + // c. add all edges that are not processed to myShapesToAvoid + aIt.Initialize (myShapes); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aF=aIt.Value(); + if (!aMP.Contains(aF)) { + myShapesToAvoid.Add(aF); + } + } + //modified by NIZNHY-PKV Tue Aug 5 15:07:44 2008t //================================================= // // 2.Internal Shells // myLoopsInternal.Clear(); // - Standard_Integer aNbFA; - TopTools_MapIteratorOfMapOfOrientedShape aItM; - // aEFMap.Clear(); AddedFacesMap.Clear(); // @@ -730,7 +790,48 @@ Standard_Boolean IsGrowthShell(const TopoDS_Shape& theShell, } return bRet; } - +//modified by NIZNHY-PKV Tue Aug 5 15:07:50 2008f +//======================================================================= +//function : IsClosedShell +//purpose : +//======================================================================= +Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell) +{ + Standard_Integer aNbE; + Standard_Boolean bRet; + TopoDS_Iterator aIt; + TopExp_Explorer aExp; + TopTools_MapOfShape aM; + // + bRet=Standard_False; + aIt.Initialize(theShell); + for(; aIt.More(); aIt.Next()) { + const TopoDS_Face& aF=TopoDS::Face(aIt.Value()); + aExp.Init(aF, TopAbs_EDGE); + for (; aExp.More(); aExp.Next()) { + const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current()); + if (BRep_Tool::Degenerated(aE)) { + continue; + } + if (BRep_Tool::IsClosed(aE, aF)) { + continue; + } + if (aE.Orientation()==TopAbs_INTERNAL) { + continue; + } + if (!aM.Add(aE)) { + aM.Remove(aE); + } + } + } + // + aNbE=aM.Extent(); + if (!aNbE) { + bRet=!bRet; + } + return bRet; +} +//modified by NIZNHY-PKV Tue Aug 5 15:08:07 2008t //BRepTools::Write(aFF, "ff"); // // ErrorStatus : diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx index 92e9e2cc8..2da08b5f6 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx @@ -360,6 +360,26 @@ static aBF.SetFace(aFF); aBF.SetContext(aCtx); const TopTools_ListOfShape& aSE=aWES.StartElements(); + // + //DEB f + /* + { + TopoDS_Compound aCx; + BRep_Builder aBBx; + TopTools_ListIteratorOfListOfShape aItx; + // + aBBx.MakeCompound(aCx); + aBBx.Add(aCx, aFF); + aItx.Initialize(aSE); + for (; aItx.More(); aItx.Next()) { + TopoDS_Shape& aEx=aItx.Value(); + aBBx.Add(aCx, aEx); + } + int a=0; + } + */ + //DEB t + // aBF.SetShapes(aSE); // aBF.Perform();