From: jgv Date: Fri, 15 Jun 2018 17:22:38 +0000 (+0300) Subject: 0029861: Modeling Algorithms - BiTgte_Blend gives exception X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=6bb019b8af08df0bc72195982b42403eb5f89953;p=occt-copy.git 0029861: Modeling Algorithms - BiTgte_Blend gives exception The algorithm has been corrected to avoid exception. Now both Draw commands "brollingball" and "rollingball" give correct results. Test cases "offset faces_type_a A3, A4, A9" are good now. --- diff --git a/src/BRepAlgo/BRepAlgo_Loop.cxx b/src/BRepAlgo/BRepAlgo_Loop.cxx index 2126f4674d..4805007188 100644 --- a/src/BRepAlgo/BRepAlgo_Loop.cxx +++ b/src/BRepAlgo/BRepAlgo_Loop.cxx @@ -555,6 +555,7 @@ void BRepAlgo_Loop::Perform() TopTools_IndexedDataMapOfShapeListOfShape MVE; // add cut edges. + TopTools_MapOfShape Emap; for (itl.Initialize(myEdges); itl.More(); itl.Next()) { const TopTools_ListOfShape* pLCE = myCutEdges.Seek (itl.Value()); @@ -562,6 +563,8 @@ void BRepAlgo_Loop::Perform() { for (itl1.Initialize(*pLCE); itl1.More(); itl1.Next()) { TopoDS_Edge& E = TopoDS::Edge(itl1.Value()); + if (!Emap.Add(E)) + continue; StoreInMVE(myFace,E,MVE,YaCouture,myVerticesForSubstitute); } } diff --git a/src/BiTgte/BiTgte_Blend.cxx b/src/BiTgte/BiTgte_Blend.cxx index b15363fb70..00a6b62c7c 100644 --- a/src/BiTgte/BiTgte_Blend.cxx +++ b/src/BiTgte/BiTgte_Blend.cxx @@ -693,6 +693,7 @@ static TopoDS_Edge FindCreatedEdge return E1; } +#ifdef DRAW //======================================================================= //function : Bubble //purpose : Sets in increasing order the sequence of vertices. @@ -826,6 +827,8 @@ static void CutEdge (const TopoDS_Edge& E, V1 = V2; } } +#endif + //======================== END OF STATIC FUNCTIONS ============ @@ -2317,25 +2320,6 @@ void BiTgte_Blend::ComputeShape() #endif // end debug - // - // modify the tubes on edge for partition of edges. - // - Standard_Integer NbS = NbSurfaces(); - for (Standard_Integer i = 1; i <= NbS; i++) { - const TopoDS_Shape& S1 = SupportShape1(i); - - if ( S1.ShapeType() == TopAbs_EDGE) { - const TopoDS_Edge& E1 = TopoDS::Edge(S1); - // it is required to replace in F the cut edges of E1, that - // represent CutE - const TopTools_ListOfShape& VonE = myCutEdges(E1); - TopTools_ListOfShape NewE; - CutEdge(E1,VonE,NewE); - - } - } - - TopTools_DataMapOfShapeShape Created; TopTools_ListOfShape Empty; diff --git a/tests/bugs/modalg_2/bug22864 b/tests/bugs/modalg_2/bug22864 deleted file mode 100755 index ff671879ae..0000000000 --- a/tests/bugs/modalg_2/bug22864 +++ /dev/null @@ -1,71 +0,0 @@ -puts "============" -puts "OCC22864" -puts "============" -puts "" -############################################################################################## -# The algorithm BiTgte_Blend obtains instable results -############################################################################################## - -set BugNumber OCC22864 - -restore [locate_data_file bug22864_face1.brep] f1 -restore [locate_data_file bug22864_face2.brep] f2 - -shape aShape C -add f1 aShape -add f2 aShape - -set status 0 -set Numbers 11 - -for {set i 0} {$i < ${Numbers}} {incr i} { - puts "i=$i" - rollingball result aShape 15 @ f1 f2 - - checknbshapes result -vertex 2 -edge 3 -wire 1 -face 1 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 8 - - set aFile $imagedir/${test_image}.brep - puts "aFile=${aFile}" - file delete ${aFile} - if { [file exists ${aFile}] } { - puts "There is old ${aFile} file; Error" - set status 1 - } - - save result ${aFile} - catch {exec chmod 777 ${aFile}} - if { ![file exists ${aFile}] } { - puts "There is not ${aFile} file; save command: Error" - set status 1 - } - - set fp [open ${aFile} "r"] - set Log [read -nonewline ${fp}] - close ${fp} - # - if {$i == 0} { - set Standard_Log ${Log} - } else { - set info_result [string compare ${Log} ${Standard_Log}] - if {${info_result} == 0} { - # Log == Standard_Log - puts "Log == Standard_Log" - } else { - # Log != Standard_Log - set status 1 - puts "Log != Standard_Log" - } - } -} - -# Resume -puts "" -if {${status} == 0} { - puts "OK ${BugNumber}" -} else { - puts "Faulty ${BugNumber}" -} - -checkprops result -s 8464.91 -checkshape result -checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_2/bug22864_1 b/tests/bugs/modalg_2/bug22864_1 new file mode 100644 index 0000000000..ff671879ae --- /dev/null +++ b/tests/bugs/modalg_2/bug22864_1 @@ -0,0 +1,71 @@ +puts "============" +puts "OCC22864" +puts "============" +puts "" +############################################################################################## +# The algorithm BiTgte_Blend obtains instable results +############################################################################################## + +set BugNumber OCC22864 + +restore [locate_data_file bug22864_face1.brep] f1 +restore [locate_data_file bug22864_face2.brep] f2 + +shape aShape C +add f1 aShape +add f2 aShape + +set status 0 +set Numbers 11 + +for {set i 0} {$i < ${Numbers}} {incr i} { + puts "i=$i" + rollingball result aShape 15 @ f1 f2 + + checknbshapes result -vertex 2 -edge 3 -wire 1 -face 1 -shell 0 -solid 0 -compsolid 0 -compound 1 -shape 8 + + set aFile $imagedir/${test_image}.brep + puts "aFile=${aFile}" + file delete ${aFile} + if { [file exists ${aFile}] } { + puts "There is old ${aFile} file; Error" + set status 1 + } + + save result ${aFile} + catch {exec chmod 777 ${aFile}} + if { ![file exists ${aFile}] } { + puts "There is not ${aFile} file; save command: Error" + set status 1 + } + + set fp [open ${aFile} "r"] + set Log [read -nonewline ${fp}] + close ${fp} + # + if {$i == 0} { + set Standard_Log ${Log} + } else { + set info_result [string compare ${Log} ${Standard_Log}] + if {${info_result} == 0} { + # Log == Standard_Log + puts "Log == Standard_Log" + } else { + # Log != Standard_Log + set status 1 + puts "Log != Standard_Log" + } + } +} + +# Resume +puts "" +if {${status} == 0} { + puts "OK ${BugNumber}" +} else { + puts "Faulty ${BugNumber}" +} + +checkprops result -s 8464.91 +checkshape result +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_2/bug22864_2 b/tests/bugs/modalg_2/bug22864_2 new file mode 100644 index 0000000000..e82dcdbe37 --- /dev/null +++ b/tests/bugs/modalg_2/bug22864_2 @@ -0,0 +1,21 @@ +puts "============" +puts "OCC22864" +puts "============" +puts "" +############################################################################################## +# The algorithm BiTgte_Blend obtains instable results +############################################################################################## + +set BugNumber OCC22864 + +restore [locate_data_file bug22864_face1.brep] f1 +restore [locate_data_file bug22864_face2.brep] f2 + +compound f1 f2 s + +brollingball result s 15 @ f1 f2 + +checkshape result +checknbshapes result -vertex 7 -edge 9 -wire 4 -face 3 -shell 1 +checkprops result -s 39642.2 +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_2/bug22864_3 b/tests/bugs/modalg_2/bug22864_3 new file mode 100644 index 0000000000..3821cdcc97 --- /dev/null +++ b/tests/bugs/modalg_2/bug22864_3 @@ -0,0 +1,24 @@ +puts "============" +puts "OCC22864" +puts "============" +puts "" +############################################################################################## +# The algorithm BiTgte_Blend obtains instable results +############################################################################################## + +set BugNumber OCC22864 + +sphere s1 10 +sphere s2 10 +mkface f1 s1 +mkface f2 s2 +scalexyz f1 f1 2 2 1 +scalexyz f2 f2 0.5 0.5 2 +compound f1 f2 s + +brollingball result s 2. @ f1 f2 + +checkshape result +checknbshapes result -vertex 6 -edge 11 -wire 5 -face 5 -shell 1 +checkprops result -s 3750.55 +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_2/bug22864_4 b/tests/bugs/modalg_2/bug22864_4 new file mode 100644 index 0000000000..f7b7115324 --- /dev/null +++ b/tests/bugs/modalg_2/bug22864_4 @@ -0,0 +1,23 @@ +puts "TODO OCC29957 ALL: Error : The area of result shape is" + +puts "============" +puts "OCC22864" +puts "============" +puts "" +############################################################################################## +# The algorithm BiTgte_Blend obtains instable results +############################################################################################## + +set BugNumber OCC22864 + +cone s1 0 0 0 0 0 1 30 0 +mkface f1 s1 0 2.*pi -40 0 +cone s2 25 0 -15 1 0 0 10 0 +mkface f2 s2 0 2.*pi -55 0 +compound f1 f2 s + +brollingball result s 2. @ f1 f2 + +checkprops result -s 3523.97 + +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/bugs/modalg_7/bug29861 b/tests/bugs/modalg_7/bug29861 new file mode 100644 index 0000000000..0a8da4d07a --- /dev/null +++ b/tests/bugs/modalg_7/bug29861 @@ -0,0 +1,22 @@ +puts "============" +puts "OCC29861" +puts "============" +puts "" +############################################################################################## +# Modeling Algorithms - BiTgte_Blend gives exception +############################################################################################## + +set BugNumber OCC29861 + +cylinder s1 0 360 0 0 0 1 0 1 0 160 +cylinder s2 0 0 0 0 1 0 80 +mkface f1 s1 0 2.*pi -113.2000012 113.2000012 +mkface f2 s2 0 2.*pi 168.4 600 +compound f1 f2 s + +brollingball result s 30 @ f1 f2 + +checkshape result +checknbshapes result -vertex 10 -edge 17 -wire 7 -face 6 -shell 1 +checkprops result -s 246256 +checkview -display result -2d -path ${imagedir}/${test_image}.png diff --git a/tests/offset/faces_type_a/A3 b/tests/offset/faces_type_a/A3 index e08c7d9b1e..72645c6482 100644 --- a/tests/offset/faces_type_a/A3 +++ b/tests/offset/faces_type_a/A3 @@ -1,7 +1,4 @@ #old file ofcb19 -puts "TODO CR25925 ALL: ERROR. offsetperform operation not done." -puts "TODO CR25925 ALL: Error: The command cannot be built" -puts "TODO CR26556 ALL: Error : The offset cannot be built." restore [locate_data_file CHE_bb17.rle] s OFFSETSHAPE -0.04 {s_4 s_9 s_3 s_5 s_2 s_7 s_11} $calcul $type diff --git a/tests/offset/faces_type_a/A4 b/tests/offset/faces_type_a/A4 index 8d5dccf89e..90c4e61004 100644 --- a/tests/offset/faces_type_a/A4 +++ b/tests/offset/faces_type_a/A4 @@ -1,7 +1,4 @@ #old file ofcb23 -puts "TODO CR25925 ALL: ERROR. offsetperform operation not done." -puts "TODO CR25925 ALL: Error: The command cannot be built" -puts "TODO CR26556 ALL: Error : The offset cannot be built." restore [locate_data_file CHE_cc3.rle] s OFFSETSHAPE -0.01 {s_6} $calcul $type diff --git a/tests/offset/faces_type_a/A9 b/tests/offset/faces_type_a/A9 index 210072a13f..a6f870ba45 100644 --- a/tests/offset/faces_type_a/A9 +++ b/tests/offset/faces_type_a/A9 @@ -1,7 +1,4 @@ #old file ofsb20 -puts "TODO CR25925 ALL: ERROR. offsetperform operation not done." -puts "TODO CR25925 ALL: Error: The command cannot be built" -puts "TODO CR26556 ALL: Error : The offset cannot be built." restore [locate_data_file CHE_bb20.rle] s OFFSETSHAPE -0.1 {s_4 s_7} $calcul $type