diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.hxx b/src/BOPAlgo/BOPAlgo_PaveFiller.hxx index 6bde207118..6269e6da70 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.hxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.hxx @@ -490,6 +490,21 @@ protected: //! due to being rejected by bounding boxes intersection. Standard_EXPORT void ForceInterfEE(); + //! When all section edges are created and no increase of the tolerance + //! of vertices put on the section edges is expected, make sure that + //! the created sections have valid range. + //! If any of the section edges do not have valid range, remove them + //! from Face/Face intersection info and from the input map. + //! Put such edges into map for further unification of their + //! vertices in the PostTreatFF method. + //! + //! All these section edges have already been checked to have valid range. + //! Current check is necessary for the edges whose vertices have also + //! been put on other section edges with greater tolerance, which has caused + //! increase of the tolerance value of the vertices. + Standard_EXPORT void RemoveMicroSectionEdges(BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks& theMSCPB, + TopTools_IndexedMapOfShape& theMicroEdges); + TopTools_ListOfShape myArguments; BOPDS_PDS myDS; diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index ce4e2b9286..930e1a82d8 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -690,7 +690,10 @@ void BOPAlgo_PaveFiller::MakeBlocks() } } }//for (i=0; iInterfFF(); + + // Build the new map of section edges avoiding the micro edges + BOPDS_IndexedDataMapOfShapeCoupleOfPaveBlocks aSEPBMap; + // Analyze all section edges + Standard_Integer aNbCPB = theMSCPB.Extent(); + for (Standard_Integer i = 1; i <= aNbCPB; ++i) + { + const TopoDS_Shape& aSI = theMSCPB.FindKey(i); + const BOPDS_CoupleOfPaveBlocks& aCPB = theMSCPB(i); + + if (aSI.ShapeType() != TopAbs_EDGE) + { + // Not an edge + aSEPBMap.Add(aSI, aCPB); + continue; + } + + // Get pave block for analysis + const Handle(BOPDS_PaveBlock)& aPB = aCPB.PaveBlock1(); + if (aPB->HasEdge()) + { + // Not a real section edge + aSEPBMap.Add(aSI, aCPB); + continue; + } + + if (!BOPTools_AlgoTools::IsMicroEdge(TopoDS::Edge(aSI), myContext, Standard_False)) + { + // Normal edge + aSEPBMap.Add(aSI, aCPB); + continue; + } + + // Micro edge is found, avoid it in the map + // and remove from the F/F Intersection info structure + + // Get F/F interference which created this micro edge + BOPDS_InterfFF& aFF = aFFs(aCPB.IndexInterf()); + // Get curve from which this edge has been created + BOPDS_Curve& aCurve = aFF.ChangeCurves().ChangeValue(aCPB.Index()); + // Get all section pave blocks created from this curve + BOPDS_ListOfPaveBlock& aLPBC = aCurve.ChangePaveBlocks(); + // Remove pave block from the list + for (BOPDS_ListIteratorOfListOfPaveBlock it(aLPBC); it.More(); it.Next()) + { + if (it.Value() == aPB) + { + aLPBC.Remove(it); + break; + } + } + + // Add the "micro" edge to the map of "micro" edges for + // unification of its vertices in the PostTreatFF method + theMicroEdges.Add(aSI); + } + + // Overwrite the old map if necessary + if (aSEPBMap.Extent() != theMSCPB.Extent()) + theMSCPB = aSEPBMap; +} diff --git a/tests/bugs/modalg_7/bug29387 b/tests/bugs/modalg_7/bug29387 new file mode 100644 index 0000000000..169d311319 --- /dev/null +++ b/tests/bugs/modalg_7/bug29387 @@ -0,0 +1,29 @@ +puts "========" +puts "OCC29387" +puts "========" +puts "" +################################################# +# Incorrect result of cut a face with several shapes +################################################# + +restore [locate_data_file bug29387_obj.brep] s +restore [locate_data_file bug29387_tools.brep] t +bclearobjects +bcleartools +baddobjects s +baddctools t +bfillds + +# perform GF operation +bbuild rgf +checkshape rgf +checknbshapes rgf -wire 289 -face 288 -shell 14 -solid 14 -t +checkprops rgf -s 529.587 -v 0.604529 + +# perform CUT operation +bbop result 2 +checkshape result +checknbshapes result -wire 2 -face 1 +checkprops result -s 470.719 + +checkview -display result -2d -path ${imagedir}/${test_image}.png \ No newline at end of file