From: emv Date: Mon, 20 Sep 2021 15:07:30 +0000 (+0300) Subject: 0032578: Modeling Algorithms - Splitting face by set of edges fails X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2FCR0_FixRS_740;p=occt.git 0032578: Modeling Algorithms - Splitting face by set of edges fails Update information about ON/IN sub-shapes for all touched faces when intersection with shapes of lower types (edges and vertices) complete. Previously only the faces participating in the Face/Face intersection were updated. --- diff --git a/src/BOPAlgo/BOPAlgo_Builder_2.cxx b/src/BOPAlgo/BOPAlgo_Builder_2.cxx index 157b1fd30c..1131673dd3 100644 --- a/src/BOPAlgo/BOPAlgo_Builder_2.cxx +++ b/src/BOPAlgo/BOPAlgo_Builder_2.cxx @@ -408,6 +408,7 @@ void BOPAlgo_Builder::BuildSplitFaces() for (j=1; j<=aNbPBIn; ++j) { const Handle(BOPDS_PaveBlock)& aPB=aMPBIn(j); nSp=aPB->Edge(); + Standard_ASSERT(nSp >= 0, "Face information is not up to date", continue); aSp=(*(TopoDS_Edge*)(&myDS->Shape(nSp))); // aSp.Orientation(TopAbs_FORWARD); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx index e60fa18540..7a3f312d18 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_11.cxx @@ -152,6 +152,7 @@ void BOPAlgo_PaveFiller::CheckSelfInterference() Standard_Integer iPB, aNbPB = aMPBF.Extent(); for (iPB = 1; iPB <= aNbPB; ++iPB) { const Handle(BOPDS_PaveBlock)& aPB = aMPBF(iPB); + Standard_ASSERT(aPB->HasEdge(), "Face information is not up to date", continue); const TopoDS_Shape& aE = myDS->Shape(aPB->Edge()); // add connection TopTools_IndexedMapOfShape* pMSOr = aMCSI.ChangeSeek(aE); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index 044bbc83f0..c424c0c757 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -231,12 +231,40 @@ typedef NCollection_Vector BOPAlgo_VectorOfFaceFace; //======================================================================= void BOPAlgo_PaveFiller::PerformFF() { + // Update face info for all Face/Face intersection pairs + // and also for the rest of the faces with FaceInfo already initialized, + // i.e. anyhow touched faces. myIterator->Initialize(TopAbs_FACE, TopAbs_FACE); Standard_Integer iSize = myIterator->ExpectedLength(); - if (!iSize) { - return; + + // Collect faces from intersection pairs + TColStd_MapOfInteger aMIFence; + Standard_Integer nF1, nF2; + for (; myIterator->More(); myIterator->Next()) + { + myIterator->Value(nF1, nF2); + aMIFence.Add (nF1); + aMIFence.Add (nF2); } - // + // Collect the rest of the touched faces + for (Standard_Integer i = 0; i < myDS->NbSourceShapes(); ++i) + { + const BOPDS_ShapeInfo& aSI = myDS->ShapeInfo (i); + if (aSI.ShapeType() == TopAbs_FACE && aSI.HasReference()) + { + aMIFence.Add (i); + } + } + // Update face info + myDS->UpdateFaceInfoOn (aMIFence); + myDS->UpdateFaceInfoIn (aMIFence); + + if (!iSize) + { + // no intersection pairs found + return; + } + BOPDS_VectorOfInterfFF& aFFs = myDS->InterfFF(); aFFs.SetIncrement(iSize); // @@ -248,23 +276,8 @@ void BOPAlgo_PaveFiller::PerformFF() // Post-processing options Standard_Boolean bSplitCurve = Standard_False; // - // Fence map to store faces with updated FaceInfo structure - TColStd_MapOfInteger aMIFence; // Prepare the pairs of faces for intersection BOPAlgo_VectorOfFaceFace aVFaceFace; - Standard_Integer nF1, nF2; - // - for (; myIterator->More(); myIterator->Next()) { - myIterator->Value(nF1, nF2); - - aMIFence.Add (nF1); - aMIFence.Add (nF2); - } - // Update face info - myDS->UpdateFaceInfoOn (aMIFence); - myDS->UpdateFaceInfoIn (aMIFence); - - // Initialize interferences myIterator->Initialize(TopAbs_FACE, TopAbs_FACE); for (; myIterator->More(); myIterator->Next()) { myIterator->Value(nF1, nF2); diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx index 0b299eebc6..8d37405f09 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_7.cxx @@ -591,6 +591,7 @@ void BOPAlgo_PaveFiller::MakePCurves() for (j = 1; j <= aNbPBIn; ++j) { const Handle(BOPDS_PaveBlock)& aPB = aMPBIn(j); nE=aPB->Edge(); + Standard_ASSERT(nE >= 0, "Face information is not up to date", continue); const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&myDS->Shape(nE))); // BOPAlgo_MPC& aMPC=aVMPC.Appended(); diff --git a/tests/bugs/modalg_7/bug32578 b/tests/bugs/modalg_7/bug32578 new file mode 100644 index 0000000000..4e11206333 --- /dev/null +++ b/tests/bugs/modalg_7/bug32578 @@ -0,0 +1,28 @@ +puts "=================================================" +puts "OCC32578: Modeling Algorithms - Splitting face by set of edges fails" +puts "=================================================" +puts "" + +restore [locate_data_file bug32578_face.brep] f +restore [locate_data_file bug32578_edges.brep] ce + +bfuzzyvalue 0.01 + +bclearobjects +bcleartools +baddobjects f +eval baddtools [explode ce] +bfillds +bsplit result + +checkshape result +if {![regexp "This shape seems to be OK" [bopcheck result]]} { + puts "Error: result is a self-interferring shape" +} + +checknbshapes result -vertex 646 -edge 1234 -wire 589 -face 589 -t +checkprops result -s 351.033 + +checkview -display result -2d -path ${imagedir}/${test_image}.png + +boptions -default