diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller.hxx b/src/BOPAlgo/BOPAlgo_PaveFiller.hxx index c9db7dc426..b6ce0d4f1d 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller.hxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller.hxx @@ -193,7 +193,7 @@ protected: const Standard_Real theTolR3D, const BOPDS_IndexedMapOfPaveBlock& theMPB, Handle(BOPDS_PaveBlock)& thePBOut, Standard_Real& theTolNew); - Standard_EXPORT Standard_Boolean IsExistingPaveBlock (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, const Standard_Real theTolR3D, const BOPCol_ListOfInteger& theLSE); + Standard_EXPORT Standard_Boolean IsExistingPaveBlock (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, const BOPCol_ListOfInteger& theLSE); //! Treatment of section edges. diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index 49e5ea237d..b978f3bfbc 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -516,7 +516,7 @@ void BOPAlgo_PaveFiller::MakeBlocks() continue; } // - bExist=IsExistingPaveBlock(aPB, aNC, aTolR3D, aLSE); + bExist=IsExistingPaveBlock(aPB, aNC, aLSE); if (bExist) { continue; } @@ -1091,7 +1091,6 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingVertex Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock (const Handle(BOPDS_PaveBlock)& thePB, const BOPDS_Curve& theNC, - const Standard_Real theTolR3D, const BOPCol_ListOfInteger& theLSE) { Standard_Boolean bRet=Standard_True; @@ -1101,16 +1100,24 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock } // Standard_Real aT1, aT2, aTm, aTx, aTol, aDist; - Standard_Integer nE, iFlag; + Standard_Integer nE, iFlag, nV1, nV2; gp_Pnt aPm; Bnd_Box aBoxPm; BOPCol_ListIteratorOfListOfInteger aItLI; // thePB->Range(aT1, aT2); + thePB->Indices(nV1, nV2); + const TopoDS_Vertex &aV1 = TopoDS::Vertex(myDS->Shape(nV1)), + &aV2 = TopoDS::Vertex(myDS->Shape(nV2)); + const Standard_Real aTolV1 = BRep_Tool::Tolerance(aV1), + aTolV2 = BRep_Tool::Tolerance(aV2); + + aTol = Max(aTolV1, aTolV2); + aTm=IntTools_Tools::IntermediatePoint (aT1, aT2); theNC.Curve().D0(aTm, aPm); aBoxPm.Add(aPm); - aBoxPm.Enlarge(theTolR3D); + aBoxPm.Enlarge(aTol); // aItLI.Initialize(theLSE); for (; aItLI.More(); aItLI.Next()) { @@ -1121,9 +1128,8 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock const Bnd_Box& aBoxE=aSIE.Box(); if (!aBoxE.IsOut(aBoxPm)) { const TopoDS_Edge& aE=(*(TopoDS_Edge *)(&aSIE.Shape())); - aTol = BRep_Tool::Tolerance(aE); - aTol = aTol > theTolR3D ? aTol : theTolR3D; - iFlag=myContext->ComputePE(aPm, aTol, aE, aTx, aDist); + const Standard_Real aTol1 = Max(BRep_Tool::Tolerance(aE), aTol); + iFlag=myContext->ComputePE(aPm, aTol1, aE, aTx, aDist); if (!iFlag) { return bRet; } @@ -1148,32 +1154,38 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock Standard_Real aT1, aT2, aTm, aTx; Standard_Integer nSp, iFlag1, iFlag2, nV11, nV12, nV21, nV22, i, aNbPB; gp_Pnt aP1, aPm, aP2; - Bnd_Box aBoxP1, aBoxPm, aBoxP2; + Bnd_Box aBoxP1, aBoxPm, aBoxP2, aBoxTmp; // bRet=Standard_False; const IntTools_Curve& aIC=theNC.Curve(); // thePB->Range(aT1, aT2); thePB->Indices(nV11, nV12); + const Standard_Real aTolV11 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV11))); + const Standard_Real aTolV12 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV12))); + const Standard_Real aTolV1 = Max(aTolV11, aTolV12); + //first point aIC.D0(aT1, aP1); aBoxP1.Add(aP1); - aBoxP1.Enlarge(theTolR3D); + aBoxP1.Enlarge(aTolV11); //intermediate point aTm=IntTools_Tools::IntermediatePoint (aT1, aT2); aIC.D0(aTm, aPm); aBoxPm.Add(aPm); - aBoxPm.Enlarge(theTolR3D); //last point aIC.D0(aT2, aP2); aBoxP2.Add(aP2); - aBoxP2.Enlarge(theTolR3D); + aBoxP2.Enlarge(aTolV12); // theTolNew = 0.; aNbPB = theMPBOnIn.Extent(); for (i = 1; i <= aNbPB; ++i) { const Handle(BOPDS_PaveBlock)& aPB = theMPBOnIn(i); aPB->Indices(nV21, nV22); + const Standard_Real aTolV21 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV21))); + const Standard_Real aTolV22 = BRep_Tool::Tolerance(TopoDS::Vertex(myDS->Shape(nV22))); + const Standard_Real aTolV2 = Max(aTolV21, aTolV22); nSp=aPB->Edge(); if (nSp < 0) continue; @@ -1187,21 +1199,28 @@ Standard_Boolean BOPAlgo_PaveFiller::IsExistingPaveBlock (!aBoxSp.IsOut(aBoxP2) ? 1 : 0); if (iFlag1 && iFlag2) { Standard_Real aDist; - if (aBoxSp.IsOut(aBoxPm) || myContext->ComputePE(aPm, - theTolR3D, - aSp, - aTx, theTolNew)) { + + const Standard_Real aRealTol = myDS->IsCommonBlock(aPB) ? + Max(aTolV1, aTolV2) : theTolR3D; + + aBoxTmp = aBoxPm; + aBoxTmp.Enlarge(aRealTol); + + if (aBoxSp.IsOut(aBoxTmp) || myContext->ComputePE(aPm, + aRealTol, + aSp, + aTx, theTolNew)) { continue; } // if (iFlag1 == 1) { - iFlag1 = !myContext->ComputePE(aP1, theTolR3D, aSp, aTx, aDist); + iFlag1 = !myContext->ComputePE(aP1, aRealTol, aSp, aTx, aDist); if (theTolNew < aDist) theTolNew = aDist; } // if (iFlag2 == 1) { - iFlag2 = !myContext->ComputePE(aP2, theTolR3D, aSp, aTx, aDist); + iFlag2 = !myContext->ComputePE(aP2, aRealTol, aSp, aTx, aDist); if (theTolNew < aDist) theTolNew = aDist; } @@ -1811,7 +1830,7 @@ void BOPAlgo_PaveFiller::RemoveUsedVertices(BOPDS_Curve& aNC, aTolV = BRep_Tool::Tolerance(aVToUpdate); aP2 = BRep_Tool::Pnt(aVToUpdate); aDist = aP1.Distance(aP2); - aTolVNew = aDist - aTolV2; + aTolVNew = Max(aDist - aTolV2, aTolR3D); // if (aTolVNew > aTolV) { BRep_Builder aBB; diff --git a/tests/boolean/bfuse_complex/E4 b/tests/boolean/bfuse_complex/E4 index 0ec76c8849..ebe7fda01d 100644 --- a/tests/boolean/bfuse_complex/E4 +++ b/tests/boolean/bfuse_complex/E4 @@ -1,7 +1,5 @@ # Original bug : pro14260 # Date : 21 Sept 98 -puts "TODO #22911 ALL: Faulty shapes in variables faulty_1 to faulty_" -puts "TODO #22911 ALL: Error : The area of result shape is" restore [locate_data_file CTO900_pro14260c.rle] c restore [locate_data_file pro14260d.rle] d diff --git a/tests/bugs/modalg_1/bug1255 b/tests/bugs/modalg_1/bug1255 index 7f187f1396..7d9a3e453a 100755 --- a/tests/bugs/modalg_1/bug1255 +++ b/tests/bugs/modalg_1/bug1255 @@ -6,8 +6,6 @@ puts "" ## Exception in command 'section' ############################################### -puts "TODO #OCC26815 ALL: Error : The length of result shape is" - restore [locate_data_file OCC1255.brep] a checkshape a @@ -16,7 +14,7 @@ mkface f1 p1 bsection result a f1 -checkprops result -l 5840.24 +checkprops result -l 5837.18 checkshape result checksection result checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_1/bug1255_1 b/tests/bugs/modalg_1/bug1255_1 index d519e05be1..6bd8b69a6e 100755 --- a/tests/bugs/modalg_1/bug1255_1 +++ b/tests/bugs/modalg_1/bug1255_1 @@ -7,8 +7,6 @@ puts "" # (This script tests new topology) ############################################### -puts "TODO #OCC26815 ALL: Error : The length of result shape is" - restore [locate_data_file OCC1255.brep] a checkshape a @@ -21,7 +19,7 @@ if { [catch {bop a f1 } ] } { bopsection result } -checkprops result -l 5840.24 +checkprops result -l 5837.18 checkshape result checksection result checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_4/bug697_2 b/tests/bugs/modalg_4/bug697_2 index b00d8b3fe3..f3fbf27ced 100755 --- a/tests/bugs/modalg_4/bug697_2 +++ b/tests/bugs/modalg_4/bug697_2 @@ -1,6 +1,3 @@ -puts "TODO OCC25829 ALL: Error : The area of result shape is" -puts "TODO OCC25829 ALL: Faulty shapes in variables faulty_1 to" - puts "============" puts "OCC697" puts "============" @@ -27,7 +24,7 @@ if { [catch {bfuse result b2 b3} catch_result] } { puts "Faulty : an exception was caught" } -checkprops result -s 25357.5 +checkprops result -s 26041.9 checkshape result checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_4/bug697_4 b/tests/bugs/modalg_4/bug697_4 index 6a5fe0edb8..ee86ee2fb4 100755 --- a/tests/bugs/modalg_4/bug697_4 +++ b/tests/bugs/modalg_4/bug697_4 @@ -1,6 +1,3 @@ -puts "TODO OCC25829 ALL: Error : The area of result shape is" -puts "TODO OCC25829 ALL: Faulty shapes in variables faulty_1 to" - puts "============" puts "OCC697" puts "============" @@ -21,6 +18,6 @@ checkshape b3 if { [catch {bfuse result b3 b2} catch_result] } { puts "Faulty OCC697" } -checkprops result -s 25357.5 +checkprops result -s 26041.9 checkshape result checkview -display result -3d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_4/bug697_7 b/tests/bugs/modalg_4/bug697_7 index 96fa265724..4462acb572 100755 --- a/tests/bugs/modalg_4/bug697_7 +++ b/tests/bugs/modalg_4/bug697_7 @@ -1,6 +1,3 @@ -puts "TODO OCC25829 ALL: Error : The area of result shape is" -puts "TODO OCC25829 ALL: Faulty shapes in variables faulty_1 to" - puts "============" puts "OCC697" puts "============" @@ -22,6 +19,6 @@ bop b2 b3 if { [catch {bopfuse result} catch_result] } { puts "Faulty OCC697 " } -checkprops result -s 25357.5 +checkprops result -s 26041.9 checkshape result checkview -display result -3d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_4/bug697_8 b/tests/bugs/modalg_4/bug697_8 index 9557c44ab1..fc23c71d0a 100755 --- a/tests/bugs/modalg_4/bug697_8 +++ b/tests/bugs/modalg_4/bug697_8 @@ -1,6 +1,3 @@ -puts "TODO OCC25829 ALL: Error : The area of result shape is" -puts "TODO OCC25829 ALL: Faulty shapes in variables faulty_1 to" - puts "============" puts "OCC697" puts "============" @@ -22,6 +19,6 @@ bop b3 b2 if { [catch {bopfuse result} catch_result] } { puts "Faulty OCC697" } -checkprops result -s 25357.5 +checkprops result -s 26041.9 checkshape result checkview -display result -3d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_4/bug772 b/tests/bugs/modalg_4/bug772 index d10aa8cb59..5ac6a9f7c5 100755 --- a/tests/bugs/modalg_4/bug772 +++ b/tests/bugs/modalg_4/bug772 @@ -1,5 +1,3 @@ -puts "TODO OCC26999 ALL: Error : .*The area .*is" - puts "========" puts "OCC772" puts "SAM1643" diff --git a/tests/bugs/modalg_6/bug27128 b/tests/bugs/modalg_6/bug27128 new file mode 100644 index 0000000000..ec95d397ea --- /dev/null +++ b/tests/bugs/modalg_6/bug27128 @@ -0,0 +1,23 @@ +puts "============" +puts "OCC27128" +puts "============" +puts "" +############################### +## The algorithm of sharing edges in Boolean operation should be improved +############################### + +plane pl 0.195808075898442, -0.229262227170656, 4.05546403129991 0 0 1 +psphere s1 pl 0.03101752454 +restore [locate_data_file bug27128-Helix_Pipe.brep] s2 + +settolerance s1 2.0e-6 + +bfuse result s1 s2 +checkshape result + +smallview +donly s1 +fit +donly result + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_6/bug27179 b/tests/bugs/modalg_6/bug27179 new file mode 100644 index 0000000000..4148e739a0 --- /dev/null +++ b/tests/bugs/modalg_6/bug27179 @@ -0,0 +1,31 @@ +puts "============" +puts "OCC27179" +puts "============" +puts "" +############################### +## The algorithm of sharing edges in Boolean operation should be improved +############################### + +plane pl 0.195808075898442, -0.229262227170656, 4.05546403129991 0 0 1 +psphere s1 pl 0.03101752454 +restore [locate_data_file bug27128-Helix_Pipe.brep] s2 + +settolerance s1 2.0e-6 + +explode s1 f +explode s2 f + +bsection result s1_1 s2_2 + +smallview +donly s1 +fit +donly result + +if { [string compare -nocase [checksection result] " nb alone Vertices : 0\n\n"] } { + puts "ERROR: the section is not closed" +} else { + puts "The section is OK" +} + +checkview -screenshot -2d -path ${imagedir}/${test_image}.png