From: ifv Date: Tue, 8 Oct 2019 11:44:04 +0000 (+0300) Subject: 0031031: Incorrect result is returned from BRepPrimAPI_MakePrism::Generated() X-Git-Url: http://git.dev.opencascade.org/gitweb/?a=commitdiff_plain;h=77eb04bd7b3078b7b1feaace40afebb4202f079d;p=occt-copy.git 0031031: Incorrect result is returned from BRepPrimAPI_MakePrism::Generated() 1. src\BRepSweep\BRepSweep_NumLinearRegularSweep.cxx Fix bug by adding result in list of generated shapes, if initial shape is vertex, edge or face. 2. src\BRepLib\BRepLib.cxx Add protection against treatment not geometric edge in BRepLib::UpdateInnerTolerances(...) 3. Add test case for bug and correct test for bug 30346 according to new behavior of algorithm --- diff --git a/src/BRepLib/BRepLib.cxx b/src/BRepLib/BRepLib.cxx index b8b4ed871a..3f7b47e2f7 100644 --- a/src/BRepLib/BRepLib.cxx +++ b/src/BRepLib/BRepLib.cxx @@ -1831,6 +1831,12 @@ void BRepLib::UpdateInnerTolerances(const TopoDS_Shape& aShape) for (Standard_Integer i = 1; i <= EFmap.Extent(); i++) { TopoDS_Edge anEdge = TopoDS::Edge(EFmap.FindKey(i)); + + if (!BRep_Tool::IsGeometric(anEdge)) + { + continue; + } + TopoDS_Vertex V1, V2; TopExp::Vertices(anEdge, V1, V2); Standard_Real fpar, lpar; diff --git a/src/BRepSweep/BRepSweep_NumLinearRegularSweep.cxx b/src/BRepSweep/BRepSweep_NumLinearRegularSweep.cxx index 3340325944..821a313723 100644 --- a/src/BRepSweep/BRepSweep_NumLinearRegularSweep.cxx +++ b/src/BRepSweep/BRepSweep_NumLinearRegularSweep.cxx @@ -578,5 +578,12 @@ Standard_Boolean BRepSweep_NumLinearRegularSweep::GenIsUsed(const TopoDS_Shape& Standard_Integer iGenS = myGenShapeTool.Index(aGenS); Standard_OutOfRange_Raise_if(iGenS == 0, "BRepSweep_NumLinearRegularSweep::GenIsUsed: shape index = 0") - return myBuiltShapes(iGenS, 1) && myUsedShapes(iGenS, 1); + if (iGenS == 1) + { + return myBuiltShapes(iGenS, 1); + } + else + { + return myBuiltShapes(iGenS, 1) && myUsedShapes(iGenS, 1); + } } diff --git a/tests/bugs/modalg_7/bug30346_2 b/tests/bugs/modalg_7/bug30346_2 index 6fa62957d6..c04ffd26e5 100644 --- a/tests/bugs/modalg_7/bug30346_2 +++ b/tests/bugs/modalg_7/bug30346_2 @@ -10,7 +10,7 @@ mkface f1 s 0 2*pi 0.785398163397448 1.5707963267949 prism r1 f1 0 0 2 savehistory h1 set s1 [dump h1] -if { !([regexp "0 Deleted" $s1] && [regexp "2 Generated" $s1])} { +if { !([regexp "0 Deleted" $s1] && [regexp "3 Generated" $s1])} { puts "Error: wrong history h1" } # @@ -18,6 +18,6 @@ mkface f2 s 0 5 0.785398163397448 1.5707963267949 prism r2 f2 0 0 2 savehistory h2 set s2 [dump h2] -if { !([regexp "0 Deleted" $s2] && [regexp "6 Generated" $s2])} { +if { !([regexp "0 Deleted" $s2] && [regexp "7 Generated" $s2])} { puts "Error: wrong history h2" } diff --git a/tests/bugs/modalg_7/bug31031 b/tests/bugs/modalg_7/bug31031 new file mode 100644 index 0000000000..c58b25c622 --- /dev/null +++ b/tests/bugs/modalg_7/bug31031 @@ -0,0 +1,15 @@ +puts "========" +puts "0031031: Incorrect result is returned from BRepPrimAPI_MakePrism::Generated()" +puts "========" +puts "" + +pload MODELING + +vertex v1 0 0 0 +prism r1 v1 0 0 2 +savehistory h1 +set s1 [dump h1] +if { !([regexp "0 Deleted" $s1] && [regexp "1 Generated" $s1])} { + puts "Error: wrong history h1" +} +