diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.hxx b/src/BOPAlgo/BOPAlgo_PaveFiller.hxx index c34565a816..dac52629d1 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.hxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.hxx @@ -262,7 +262,7 @@ protected: BOPCol_DataMapOfIntegerReal& theMVTol, BOPCol_DataMapOfIntegerListOfInteger& aDMVLV); - Standard_EXPORT void FilterPavesOnCurves(const BOPDS_VectorOfCurve& theVNC); + Standard_EXPORT void FilterPavesOnCurves(const BOPDS_VectorOfCurve& theVNC,BOPCol_DataMapOfIntegerReal& theMVTol); //! Depending on the parameter aType it checks whether //! the vertex nV was created in EE or EF intersections. diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index bbc1b35c91..e1cbe33fe0 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -442,7 +442,7 @@ void BOPAlgo_PaveFiller::MakeBlocks() // if some E-F vertex was put on a curve due to large E-F intersection range, // and it also was put on another curve correctly then remove this vertex from // the first curve. Detect such case if the distance to curve exceeds aTolR3D. - FilterPavesOnCurves(aVC); + FilterPavesOnCurves(aVC, aMVTol); for (j = 0; j aCheckDist && aPBD.SinAngle < aSinAngleMin) + if (aPBD.SquareDist > aCheckDist && aPBD.SinAngle < aSinAngleMin) { aPBD.PB->RemoveExtPave(nV); + isRemoved = Standard_True; + } + else if (aPBD.SquareDist > aMaxDistKept) + aMaxDistKept = aPBD.SquareDist; + } + + if (isRemoved && aMaxDistKept > 0) + { + const Standard_Real* pTol = theMVTol.Seek(nV); + if (pTol) + { + const TopoDS_Vertex& aV = *(TopoDS_Vertex*)&myDS->Shape(nV); + const Standard_Real aRealTol = Max(*pTol, sqrt(aMaxDistKept) + Precision::Confusion()); + (*(Handle(BRep_TVertex)*)&aV.TShape())->Tolerance(aRealTol); } } } diff --git a/tests/bugs/modalg_5/bug24655 b/tests/bugs/modalg_5/bug24655 index 1c6a0cf007..b5d7b5e8aa 100644 --- a/tests/bugs/modalg_5/bug24655 +++ b/tests/bugs/modalg_5/bug24655 @@ -16,5 +16,5 @@ checkprops result -s 11.9246 checkshape result # Analysis of "nbshapes result" -checknbshapes result -vertex 23 -edge 34 -wire 13 -face 13 -shell 1 -solid 1 -compsolid 0 -compound 1 -shape 86 +checknbshapes result -wire 13 -face 13 -shell 1 -solid 1 checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_7/bug31913 b/tests/bugs/modalg_7/bug31913 new file mode 100644 index 0000000000..97e873da70 --- /dev/null +++ b/tests/bugs/modalg_7/bug31913 @@ -0,0 +1,25 @@ +puts "=============================================================================================" +puts "0031913: Modeling Algorithms - Invalid result of cut operation" +puts "=============================================================================================" +puts "" + +restore [locate_data_file bug31913_shell_to_cut.brep] s1 +restore [locate_data_file bug31913_cutting_solid.brep] s2 + +bclearobjects +bcleartools +baddobjects s1 +baddtools s2 +bfillds +bbop rcommon 0 +bbop rcut 2 + +checkshape rcommon +checknbshapes rcommon -face 17 -wire 17 +checkprops rcommon -s 0.0317669 + +checkshape rcut +checknbshapes rcut -face 73 -wire 73 +checkprops rcut -s 39.1577 + +checkview -display rcommon -2d -path ${imagedir}/${test_image}.png