//======================================================================= // function: FillIn2DParts // purpose: //======================================================================= void GEOMAlgo_Builder::FillIn2DParts() { const NMTDS_ShapesDataStructure& aDS=*myPaveFiller->DS(); NMTTools_PaveFiller* pPF=myPaveFiller; NMTDS_InterfPool* pIP=pPF->IP(); BOPTools_CArray1OfSSInterference& aFFs=pIP->SSInterferences(); NMTTools_CommonBlockPool& aCBP=pPF->ChangeCommonBlockPool(); // Standard_Integer j, nSpIn, nSpSc, aNbCurves; Standard_Integer aNbS, nF, aNbCBP, n1, n2, aNbFFs, aNbSpIn; TopTools_MapOfShape aMFence; TopTools_ListOfShape aLSpIn; TopoDS_Face aF; NMTTools_ListIteratorOfListOfCommonBlock aItCB; BOPTools_ListIteratorOfListOfPaveBlock aItPB; // myInParts.Clear(); // aNbFFs=aFFs.Extent(); aNbCBP=aCBP.Extent(); // aNbS=aDS.NumberOfShapesOfTheObject(); for (nF=1; nF<=aNbS; ++nF) { if (aDS.GetShapeType(nF)!=TopAbs_FACE) { continue; } // aF=TopoDS::Face(aDS.Shape(nF)); // aMFence.Clear(); aLSpIn.Clear(); // // 1. In Parts for (j=1; j<=aNbCBP; ++j) { NMTTools_ListOfCommonBlock& aLCB=aCBP(j); aItCB.Initialize(aLCB); for (; aItCB.More(); aItCB.Next()) { NMTTools_CommonBlock& aCB=aItCB.Value(); if (aCB.IsPaveBlockOnFace(nF)) { const BOPTools_PaveBlock& aPB1=aCB.PaveBlock1(); nSpIn=aPB1.Edge(); const TopoDS_Shape& aSpIn=aDS.Shape(nSpIn); if (aMFence.Add(aSpIn)){ aLSpIn.Append(aSpIn); } } } } // // 2. Section Parts for (j=1; j<=aNbFFs; ++j) { BOPTools_SSInterference& aFF=aFFs(j); aFF.Indices(n1, n2); if (!(n1==nF || n2==nF)) { continue; } BOPTools_SequenceOfCurves& aSC=aFF.Curves(); aNbCurves=aSC.Length(); if (!aNbCurves) { continue; } // const BOPTools_Curve& aBC=aSC(1); const BOPTools_ListOfPaveBlock& aLPB=aBC.NewPaveBlocks(); aItPB.Initialize(aLPB); for (; aItPB.More(); aItPB.Next()) { const BOPTools_PaveBlock& aPBSc=aItPB.Value(); nSpSc=aPBSc.Edge(); const TopoDS_Shape& aSpSc=aDS.Shape(nSpSc); if (aMFence.Add(aSpSc)){ aLSpIn.Append(aSpSc); } } } aNbSpIn=aLSpIn.Extent(); if (aNbSpIn) { myInParts.Add(aF, aLSpIn); } }//for (nF=1; nF<=aNbS; ++nF) { }
//======================================================================= // function: MakePCurves // purpose: //======================================================================= void NMTTools_PaveFiller::MakePCurves() { Standard_Integer i, aNb, nF1, nF2, nE; Standard_Integer aNbCB, aNbF, nSp, nF; TopAbs_ShapeEnum aType; TopoDS_Face aF1FWD, aF2FWD; TColStd_ListIteratorOfListOfInteger aItF; BOPTools_ListIteratorOfListOfPaveBlock anIt; NMTTools_ListIteratorOfListOfCommonBlock aItCB; // BOPTools_CArray1OfSSInterference& aFFs=myIP->SSInterferences(); // aNb=aFFs.Extent(); for (i=1; i<=aNb; i++) { BOPTools_SSInterference& aFF=aFFs(i); aFF.Indices(nF1, nF2); // const TopoDS_Face aF1=TopoDS::Face(myDS->Shape(nF1));//mpv const TopoDS_Face aF2=TopoDS::Face(myDS->Shape(nF2));//mpv // aF1FWD=aF1; aF1FWD.Orientation(TopAbs_FORWARD); aF2FWD=aF2; aF2FWD.Orientation(TopAbs_FORWARD); // // In, On parts processing const BOPTools_ListOfPaveBlock& aLPBInOn=aFF.PaveBlocks(); // anIt.Initialize(aLPBInOn); for (; anIt.More(); anIt.Next()) { const BOPTools_PaveBlock& aPB=anIt.Value(); nE=aPB.Edge(); const TopoDS_Edge aE=TopoDS::Edge(myDS->Shape(nE));//mpv BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF1FWD); BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aE, aF2FWD); } } // Check common blocks between edges and faces // Build P-Curves if they were not built in previos block. // The main case is :arguments for e.g aEdge, aFace -> no FFs, // but p-curves are needed. // aNb=myDS->NumberOfShapesOfTheObject(); for (i=1; i<=aNb; ++i) { const TopoDS_Shape& aS=myDS->Shape(i); aType=aS.ShapeType(); // if (aType!=TopAbs_EDGE) { continue; } const TopoDS_Edge& aE=TopoDS::Edge(aS); // if (BRep_Tool::Degenerated(aE)) { continue; } // const NMTTools_ListOfCommonBlock& aLCB=myCommonBlockPool(myDS->RefEdge(i)); aNbCB=aLCB.Extent(); if (!aNbCB) { continue; } // aItCB.Initialize(aLCB); for (; aItCB.More(); aItCB.Next()) { const NMTTools_CommonBlock& aCB=aItCB.Value(); const BOPTools_PaveBlock &aPB1=aCB.PaveBlock1(); // const TColStd_ListOfInteger& aLF=aCB.Faces(); aNbF=aLF.Extent(); if (!aNbF) { continue; } // nSp=aPB1.Edge(); const TopoDS_Edge aSp=TopoDS::Edge(myDS->Shape(nSp));//mpv // aItF.Initialize(aLF); for (; aItF.More(); aItF.Next()) { nF=aItF.Value(); aF1FWD=TopoDS::Face(myDS->Shape(nF)); aF1FWD.Orientation(TopAbs_FORWARD); // BOPTools_Tools2D::BuildPCurveForEdgeOnFace(aSp, aF1FWD); } // for (; aItCB.More(); aItCB.Next()) { }//if (aS.ShapeType()==TopAbs_EDGE) { } }