IPAL19834: Incorrect result after make Partition of 2 objects. A fix by PKV.

This commit is contained in:
jfa 2008-08-18 07:49:03 +00:00
parent 282f749bf3
commit b568e77447
3 changed files with 163 additions and 10 deletions

View File

@ -251,6 +251,7 @@ static
TopTools_MapIteratorOfMapOfOrientedShape aItM; TopTools_MapIteratorOfMapOfOrientedShape aItM;
TopTools_IndexedDataMapOfShapeListOfShape aVEMap; TopTools_IndexedDataMapOfShapeListOfShape aVEMap;
TopTools_MapOfOrientedShape aMAdded; TopTools_MapOfOrientedShape aMAdded;
TopoDS_Iterator aItW;
BRep_Builder aBB; BRep_Builder aBB;
GEOMAlgo_WireEdgeSet aWES; GEOMAlgo_WireEdgeSet aWES;
GEOMAlgo_WESCorrector aWESCor; GEOMAlgo_WESCorrector aWESCor;
@ -278,6 +279,37 @@ static
const TopoDS_Shape& aW=aIt.Value(); const TopoDS_Shape& aW=aIt.Value();
myLoops.Append(aW); 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 // 2. Internal Wires
myLoopsInternal.Clear(); myLoopsInternal.Clear();
@ -302,7 +334,7 @@ static
aBB.MakeWire(aW); aBB.MakeWire(aW);
aBB.Add(aW, aEE); aBB.Add(aW, aEE);
// //
TopoDS_Iterator aItW (aW); aItW.Initialize(aW);
for (; aItW.More()&&bFlag; aItW.Next()) { for (; aItW.More()&&bFlag; aItW.Next()) {
const TopoDS_Edge& aE=TopoDS::Edge(aItW.Value()); const TopoDS_Edge& aE=TopoDS::Edge(aItW.Value());
// //

View File

@ -93,7 +93,10 @@ static
void MakeInternalShells(const TopTools_MapOfShape& , void MakeInternalShells(const TopTools_MapOfShape& ,
TopTools_ListOfShape& ); 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 : //function :
@ -228,6 +231,17 @@ static
myShapesToAvoid.Add(aF2); 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) { }// for (i=1; i<=aNbE; ++i) {
// //
if (!bFound) { if (!bFound) {
@ -246,14 +260,16 @@ static
// //
myLoops.Clear(); myLoops.Clear();
// //
Standard_Integer aNbLF, aNbOff, aNbFP; Standard_Integer aNbLF, aNbOff, aNbFP, aNbFA;
TopAbs_Orientation anOr; TopAbs_Orientation anOr;
TopoDS_Edge aEL; TopoDS_Edge aEL;
BRep_Builder aBB; BRep_Builder aBB;
NMTTools_CoupleOfShape aCSOff; NMTTools_CoupleOfShape aCSOff;
TopTools_MapOfOrientedShape AddedFacesMap; TopTools_MapOfOrientedShape AddedFacesMap;//, aMFP;
TopTools_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP; 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 (; aEdgeExp.More(); aEdgeExp.Next()) {
} //for (; aItAddedF.More(); aItAddedF.Next()) { } //for (; aItAddedF.More(); aItAddedF.Next()) {
//modified by NIZNHY-PKV Tue Aug 5 15:07:08 2008f
//myLoops.Append(aShell);
if (IsClosedShell(aShell)) {
myLoops.Append(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()) { } // 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 // 2.Internal Shells
// //
myLoopsInternal.Clear(); myLoopsInternal.Clear();
// //
Standard_Integer aNbFA;
TopTools_MapIteratorOfMapOfOrientedShape aItM;
//
aEFMap.Clear(); aEFMap.Clear();
AddedFacesMap.Clear(); AddedFacesMap.Clear();
// //
@ -730,7 +790,48 @@ Standard_Boolean IsGrowthShell(const TopoDS_Shape& theShell,
} }
return bRet; 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"); //BRepTools::Write(aFF, "ff");
// //
// ErrorStatus : // ErrorStatus :

View File

@ -360,6 +360,26 @@ static
aBF.SetFace(aFF); aBF.SetFace(aFF);
aBF.SetContext(aCtx); aBF.SetContext(aCtx);
const TopTools_ListOfShape& aSE=aWES.StartElements(); 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.SetShapes(aSE);
// //
aBF.Perform(); aBF.Perform();