]> OCCT Git - occt.git/commitdiff
0031147: Modeling Algorithms - BRepOffsetAPI_MakePipeShell null access
authorakaftasev <akaftasev@opencascade.com>
Thu, 29 Apr 2021 10:40:58 +0000 (13:40 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 14 May 2021 17:43:58 +0000 (20:43 +0300)
Added to Draw command 'setsweep ' posibility to change degmax and segmax parameter manually by '-SM' and '-DM' options
Added test
Added new condition to prevent crash

src/BRepFill/BRepFill_PipeShell.cxx
src/BRepTest/BRepTest_SweepCommands.cxx
tests/pipe/bugs/bug31147 [new file with mode: 0644]

index a51ccc6b35f4a793f585fcac6733aa570903fef4..e8d408a0a7a73cff930e79a96c1f7cc82099a8af 100644 (file)
@@ -1450,6 +1450,10 @@ void BRepFill_PipeShell::BuildHistory(const BRepFill_Sweep& theSweep)
     for (Standard_Integer i = 1; i <= aVEdges->UpperRow(); i++)
     {
       const TopoDS_Shape& aVshape = aVEdges->Value(i, inde);
+      if (aVshape.IsNull())
+      {
+        continue;
+      }
       if (aVshape.ShapeType() == TopAbs_EDGE ||
           aVshape.ShapeType() == TopAbs_FACE)
         ListVshapes->Append(aVshape);
index c7f2ddc5c5a7526d19629318f7c6dd572ab9be43..be6dce7a25188206c010c15b0b9fad7cbca3dca9 100644 (file)
@@ -560,6 +560,10 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
     di << "   -CN dx dy dz : BiNormal is given by dx dy dz\n";
     di << "   -FX Tx Ty TZ [Nx Ny Nz] : Tangent and Normal are fixed\n";
     di << "   -G guide  0|1(Plan|ACR)  0|1|2(no contact|contact|contact on border) : with guide\n";
+    di << "   -SM : Set the maximum degree of approximation\n";
+    di << "         paramvalue more then 0 (100 by default)\n";
+    di << "   -DM : Set the maximum number of span of approximation\n";
+    di << "         paramvalue [1; 14] (11 by default)\n";
     return 0;
   }
 
@@ -630,6 +634,42 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
         (BRepFill_TypeOfContact)KeepContact);
     }
   }
+  else if (!strcmp(a[1], "-DM"))
+  {
+    if (n != 3)
+    {
+      di << "bad arguments !\n";
+      return 1;
+    }
+
+    if (Draw::Atoi(a[2]) > 0 && Draw::Atoi(a[2]) < 15)
+    {
+      Sweep->SetMaxDegree(Draw::Atoi(a[2]));
+    }
+    else
+    {
+      di << " -DM paramvalue must be [1; 14]\n";
+      return 1;
+    }
+  }
+  else if (!strcmp(a[1], "-SM"))
+  {
+    if (n != 3)
+    {
+      di << "bad arguments !\n";
+      return 1;
+    }
+
+    if (Draw::Atoi(a[2]) > 0)
+    {
+      Sweep->SetMaxSegments(Draw::Atoi(a[2]));
+    }
+    else
+    {
+      di << " -SM paramvalue must be more then 0\n";
+      return 1;
+    }
+  }
 
   else {
     di << "The option " << a[1] << " is unknown !\n";
@@ -638,7 +678,6 @@ static Standard_Integer setsweep(Draw_Interpretor& di,
   return 0;
 }
 
-
 //=======================================================================
 //  addsweep
 //=======================================================================
@@ -985,9 +1024,9 @@ void  BRepTest::SweepCommands(Draw_Interpretor& theCommands)
   theCommands.Add("errorsweep", "errorsweep: returns the summary error on resulting surfaces reached by Sweep",
     __FILE__, errorsweep, g);
 
-  theCommands.Add("simulsweep", "simulsweep r [n] [option]"
+  theCommands.Add("simulsweep", "simulsweep r [n] [option]",
     __FILE__, simulsweep, g);
-  theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]"
+  theCommands.Add("geompipe", "geompipe r spineedge profileedge radius [byACR [byrotate]]",
     __FILE__, geompipe, g);
 
   theCommands.Add("middlepath", "middlepath res shape startshape endshape",
diff --git a/tests/pipe/bugs/bug31147 b/tests/pipe/bugs/bug31147
new file mode 100644 (file)
index 0000000..485b5b8
--- /dev/null
@@ -0,0 +1,35 @@
+puts "============"
+puts "0031147: Modeling Algorithms - BRepOffsetAPI_MakePipeShell null access"
+puts "============"
+puts ""
+
+pload VISUALIZATION
+
+restore [locate_data_file bug31147.brep] s
+explode s e
+wire spine s_1
+wire profile s_2
+
+mksweep spine
+addsweep profile
+setsweep -SM 1000
+setsweep -DM 14
+buildsweep result -S -C 
+
+set info1 [errorsweep]
+
+set check [regexp {Tolerance on surfaces = ([0-9\-+Ee.]+)} $info1 str error]
+
+if { $error > 1.e-4 } {
+   puts "Error: bad tolerance of result"
+}
+
+vinit
+vdisplay result
+vsetdispmode 1
+vfit
+
+checkshape result
+checkview -screenshot -3d -path ${imagedir}/${test_image}.png
+
+puts "TEST COMPLETED"