Standard_Boolean ShHealOper_RemoveFace::isReplace(const TopoDS_Shape& theShape, TopoDS_Shape& theNewShape) { Standard_Boolean isChange = Standard_False; TopTools_SequenceOfShape aSeqShapes; if(theShape.ShapeType() == TopAbs_COMPOUND || theShape.ShapeType() == TopAbs_COMPSOLID || theShape.ShapeType() == TopAbs_SOLID) { TopoDS_Iterator aEs(theShape); for( ; aEs.More(); aEs.Next()) { TopoDS_Shape aNewShell = aEs.Value(); if(aNewShell.ShapeType()!= TopAbs_SHELL) { aSeqShapes.Append(aNewShell); continue; } TopoDS_Shape as = getResultShell(TopoDS::Shell(aNewShell)); isChange = (as.IsNull() || (as.ShapeType() == TopAbs_FACE)); if(!as.IsNull()) { aSeqShapes.Append(as); } } } else if(theShape.ShapeType() == TopAbs_SHELL) { TopoDS_Shape aSh = getResultShell(TopoDS::Shell(theShape)); isChange = (aSh.IsNull() || (aSh.ShapeType() == TopAbs_FACE)); if(!aSh.IsNull()) aSeqShapes.Append(aSh); } else aSeqShapes.Append(theShape); if(aSeqShapes.IsEmpty()) return Standard_True; if(isChange) { if(aSeqShapes.Length() == 1) theNewShape = aSeqShapes.Value(1); else if (aSeqShapes.Length() > 1) { TopoDS_Compound aComp1; BRep_Builder aBB; aBB.MakeCompound(aComp1); Standard_Integer kk =1; for( ; kk <= aSeqShapes.Length(); kk++) aBB.Add(aComp1,aSeqShapes.Value(kk)); if(aSeqShapes.Length()) theNewShape = aComp1; } } else theNewShape = theShape; return isChange; }
Standard_Boolean ShHealOper_RemoveFace::Perform(const TopTools_SequenceOfShape& theRemoveFaces) { myDone = Standard_False; myErrorStatus = ShHealOper_NotError; if(myInitShape.IsNull()) { myErrorStatus = ShHealOper_InvalidParameters; return myDone; } if(theRemoveFaces.IsEmpty()) return Standard_False; myMapFaces.Clear(); Standard_Integer i=1; for( ; i <= theRemoveFaces.Length(); i++) myMapFaces.Add(theRemoveFaces.Value(i)); myDone = removeFaces(myInitShape,myResultShape); return myDone; }