From: emv Date: Fri, 11 Aug 2017 06:16:38 +0000 (+0300) Subject: 0028892: BOPAlgo_PaveFiller returns status "error: 11" in draw or raises exception... X-Git-Tag: V7_2_0~60 X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=7337535943c5be0b2ab318fbd560137454f20353;p=occt-copy.git 0028892: BOPAlgo_PaveFiller returns status "error: 11" in draw or raises exception in app on the given shapes set Boolean Operations algorithm - Added processing of the untouched edges (without edge set) in the UpdatePaveBlocks method. IntCurvesFace_Intersector algorithm - Avoid calculation of the number of sample points on the surfaces with too small UV ranges. --- diff --git a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx index 038f0c5d2f..bbc1b35c91 100644 --- a/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx +++ b/src/BOPAlgo/BOPAlgo_PaveFiller_6.cxx @@ -2602,21 +2602,27 @@ void BOPAlgo_PaveFiller::UpdatePaveBlocks } // if (bRebuild) { - Standard_Boolean isDegEdge = myDS->ShapeInfo(aPB->Edge()).HasFlag(); + Standard_Integer nE = aPB->Edge(); + // Check if the Pave Block has the edge set + if (nE < 0) { + // untouched edge + nE = aPB->OriginalEdge(); + } + Standard_Boolean isDegEdge = myDS->ShapeInfo(nE).HasFlag(); if (wasRegularEdge && !isDegEdge && nV[0] == nV[1]) { // now edge has the same vertex on both ends; // check if it is not a regular closed curve. - const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(aPB->Edge())); + const TopoDS_Edge& aE = TopoDS::Edge(myDS->Shape(nE)); const TopoDS_Vertex& aV = TopoDS::Vertex(myDS->Shape(nV[0])); Standard_Real aLength = IntTools::Length(aE); Standard_Real aTolV = BRep_Tool::Tolerance(aV); if (aLength <= aTolV * 2.) { // micro edge, so mark it for removal - aMicroEdges.Add(aPB->Edge()); + aMicroEdges.Add(nE); continue; } } - nSp = SplitEdge(aPB->Edge(), nV[0], aT[0], nV[1], aT[1]); + nSp = SplitEdge(nE, nV[0], aT[0], nV[1], aT[1]); if (bCB) aCB->SetEdge(nSp); else diff --git a/src/IntCurvesFace/IntCurvesFace_Intersector.cxx b/src/IntCurvesFace/IntCurvesFace_Intersector.cxx index 02417ea231..11c1d84d37 100644 --- a/src/IntCurvesFace/IntCurvesFace_Intersector.cxx +++ b/src/IntCurvesFace/IntCurvesFace_Intersector.cxx @@ -174,16 +174,26 @@ IntCurvesFace_Intersector::IntCurvesFace_Intersector(const TopoDS_Face& Face, if (nbsu > aMaxSamples) nbsu = aMaxSamples; if (nbsv > aMaxSamples) nbsv = aMaxSamples; - if (Max(dU, dV) > Min(dU, dV) * aTresh) - { - aMinSamples = 10; - nbsu = (Standard_Integer)(Sqrt(dU / dV) * aMaxSamples); - if (nbsu < aMinSamples) nbsu = aMinSamples; - nbsv = aMaxSamples2 / nbsu; - if (nbsv < aMinSamples) + if (dU > gp::Resolution() && dV > gp::Resolution()) { + if (Max(dU, dV) > Min(dU, dV) * aTresh) { - nbsv = aMinSamples; - nbsu = aMaxSamples2 / aMinSamples; + aMinSamples = 10; + nbsu = (Standard_Integer)(Sqrt(dU / dV) * aMaxSamples); + if (nbsu < aMinSamples) nbsu = aMinSamples; + nbsv = aMaxSamples2 / nbsu; + if (nbsv < aMinSamples) + { + nbsv = aMinSamples; + nbsu = aMaxSamples2 / aMinSamples; + } + } + } + else { + if (dU < gp::Resolution()) { + nbsu = 1; + } + if (dV < gp::Resolution()) { + nbsv = 1; } } diff --git a/tests/bugs/modalg_7/bug28892_1 b/tests/bugs/modalg_7/bug28892_1 new file mode 100644 index 0000000000..a0b465dc44 --- /dev/null +++ b/tests/bugs/modalg_7/bug28892_1 @@ -0,0 +1,24 @@ +puts "TODO OCC28989 ALL: Faulty shapes in variables" + +puts "=======" +puts "OCC28892" +puts "=======" +puts "" +################################################## +# BOPAlgo_PaveFiller returns status "error: 11" in draw or raises exception in app on the given shapes set +################################################## + +binrestore [locate_data_file bug28892_shape.bin] a +binrestore [locate_data_file bug28892_tools.bin] b + +bclearobjects +bcleartools +baddobjects a +baddctools b +bfillds +bbuild result + +# just check that the operation did not raise an exception and produced any result +checkshape result + +# checkview -display result -2d -path ${imagedir}/${test_image}.png \ No newline at end of file diff --git a/tests/bugs/modalg_7/bug28892_2 b/tests/bugs/modalg_7/bug28892_2 new file mode 100644 index 0000000000..34487c42a0 --- /dev/null +++ b/tests/bugs/modalg_7/bug28892_2 @@ -0,0 +1,29 @@ +puts "TODO OCC28989 ALL: Error: result is self-interfered" + +puts "=======" +puts "OCC28892" +puts "=======" +puts "" +################################################## +# BOPAlgo_PaveFiller returns status "error: 11" in draw or raises exception in app on the given shapes set +################################################## + +binrestore [locate_data_file bug28892_shape.bin] a +binrestore [locate_data_file bug28892_tools.bin] b + +bclearobjects +bcleartools +baddobjects a +explode b +baddtools b_1 b_6 b_12 +bfillds +bbuild result + +# just check that the operation did not raise an exception and produced any result +checkshape result + +if {![regexp "OK" [bopcheck result]]} { + puts "Error: result is self-interfered" +} + +# checkview -display result -2d -path ${imagedir}/${test_image}.png \ No newline at end of file diff --git a/tests/bugs/modalg_7/bug28892_3 b/tests/bugs/modalg_7/bug28892_3 new file mode 100644 index 0000000000..881f6e7031 --- /dev/null +++ b/tests/bugs/modalg_7/bug28892_3 @@ -0,0 +1,28 @@ +puts "TODO OCC28989 ALL: Error: result is self-interfered" + +puts "=======" +puts "OCC28892" +puts "=======" +puts "" +################################################## +# BOPAlgo_PaveFiller returns status "error: 11" in draw or raises exception in app on the given shapes set +################################################## + +binrestore [locate_data_file bug28892_tools.bin] b + +explode b +bclearobjects +bcleartools +baddobjects b_6 +baddtools b_12 +bfillds +bbuild result + +# just check that the operation did not raise an exception and produced any result +checkshape result + +if {![regexp "OK" [bopcheck result]]} { + puts "Error: result is self-interfered" +} + +# checkview -display result -2d -path ${imagedir}/${test_image}.png \ No newline at end of file diff --git a/tests/bugs/modalg_7/bug28984 b/tests/bugs/modalg_7/bug28984 new file mode 100644 index 0000000000..62d0bf282a --- /dev/null +++ b/tests/bugs/modalg_7/bug28984 @@ -0,0 +1,25 @@ +puts "TODO OCC28984 ALL: Error: Too big intersection tolerance" + +puts "=======" +puts "0028984" +puts "=======" +puts "" +################################################## +# Huge intersection tolerance obtained by Face/Face intersection algorithm +################################################## + +binrestore [locate_data_file bug28984_faces.bin] f + +explode f + +set log [bopcurves f_1 f_2 -2d] +regexp {Tolerance Reached=([-0-9.+eE]+)} $log full tol_reached +regexp {([1-9]) curve} $log full nb_curves + +if {$nb_curves != 2} { + puts "Error: Invalid number of curves" +} + +if {$tol_reached > 0.1} { + puts "Error: Too big intersection tolerance" +} \ No newline at end of file