]> OCCT Git - occt.git/commitdiff
0031631: Modeling Algorithms - Invalid result of Pipe builder
authorabulyche <abulyche@opencascade.com>
Thu, 16 Sep 2021 06:29:49 +0000 (09:29 +0300)
committerabulyche <abulyche@opencascade.com>
Sat, 18 Sep 2021 14:07:06 +0000 (17:07 +0300)
Added the ability to operate the algorithm with different types of curves.

src/GeomFill/GeomFill_SweepSectionGenerator.cxx
src/GeometryTest/GeometryTest_SurfaceCommands.cxx
tests/pipe/bugs/bug31631 [new file with mode: 0644]

index ba5535c1d8500cd8cf2f1371bf036b476c53b9ef..e3514cdfb521d3d3e0bb777be42849fe7a474b62 100644 (file)
@@ -338,7 +338,7 @@ void GeomFill_SweepSectionGenerator::Perform(const Standard_Boolean Polynomial)
     
     myFirstSect = GeomConvert::CurveToBSplineCurve(Circ,Convert_QuasiAngular);
   }
-  
+
   if (myType <= 3 && myType >=1 ) {
     
     for (Standard_Integer i = 2; i <= myNbSections; i++) {
@@ -605,16 +605,33 @@ void GeomFill_SweepSectionGenerator::Section
     Standard_Real Alpha = U - myAdpPath->FirstParameter();
     Alpha /= myAdpPath->LastParameter() - myAdpPath->FirstParameter();
     
-    Standard_Real U1 = 
-      ( 1- Alpha) * myAdpFirstSect->FirstParameter() +
-       Alpha     * myAdpFirstSect->LastParameter();
-    
+    Standard_Real U1 = ( 1- Alpha) * myAdpFirstSect->FirstParameter() +
+      Alpha     * myAdpFirstSect->LastParameter();
+
+    if (myAdpFirstSect->GetType() == GeomAbs_Line)
+    {
+      if (Precision::IsInfinite(myAdpFirstSect->FirstParameter()) ||
+        Precision::IsInfinite(myAdpFirstSect->LastParameter()))
+      {
+        gp_Lin aLine = myAdpFirstSect->Line();
+        U1 = ElCLib::Parameter(aLine, PPath);
+      }
+    }
     gp_Pnt P1 = myAdpFirstSect->Value(U1);
     
     Standard_Real U2 = 
       ( 1- Alpha) * myAdpLastSect->FirstParameter() +
        Alpha     * myAdpLastSect->LastParameter();
-    
+
+    if (myAdpLastSect->GetType() == GeomAbs_Line)
+    {
+      if (Precision::IsInfinite(myAdpLastSect->FirstParameter()) ||
+        Precision::IsInfinite(myAdpLastSect->LastParameter()))
+      {
+        gp_Lin aLine = myAdpLastSect->Line();
+        U2 = ElCLib::Parameter(aLine, PPath);
+      }
+    }
     gp_Pnt P2 = myAdpLastSect->Value(U2);
     
     gp_Ax2 Axis;
index 58a0a620ba2c0b92b878373ef3d9311795afbf7f..5415293accb7ba20c791ef5a365fb46ee887caa2 100644 (file)
@@ -207,6 +207,20 @@ static Standard_Integer tuyau (Draw_Interpretor& di,
        Pipe.Init(path, firstS, lastS); 
       }
       else { 
+        if (narg == 6 && !Option_NS && Draw::Atof(a[5]) != 0)
+        {
+          Handle(Geom_Curve) lastS = DrawTrSurf::GetCurve(a[isect + 1]);
+          Cont = GeomAbs_C2;
+          Pipe = GeomFill_Pipe(path, firstS, lastS, Draw::Atof(a[5]));
+          Pipe.Perform(Standard_True);
+          Handle(Geom_Surface) aSurface;
+          if (Pipe.IsDone())
+          {
+            aSurface = Pipe.Surface();
+          }
+          DrawTrSurf::Set(a[1], aSurface);
+          return 0;
+        }
        // tuyau a N sections, N>=2
        TColGeom_SequenceOfCurve Seq;
        Seq.Clear();
@@ -399,12 +413,12 @@ void  GeometryTest::SurfaceCommands(Draw_Interpretor& theCommands)
 
 
   theCommands.Add("tuyau",
-                 "tuyau [-NS] result Path Curve/Radius [Curve2] [Curve3] ... \n the option -NS is used only with 2 sections.\n With it, <result> is going from the first section to the last section \n Without, <result> is a pipe by evolutive section ",
+                 "tuyau [-NS] result Path Curve/Radius [Curve2] [Curve3] ... [Radius]\n the option -NS is used only with 2 sections.\n With it, <result> is going from the first section to the last section \n Without, <result> is a pipe by evolutive section ",
                  __FILE__,
                  tuyau,g);
 
   theCommands.Add("partuyau",
-                 "tuyau result Path Curve/Radius [Curve2]\n the parametrization of the surface in the V direction will be as the Path",
+                 "tuyau result Path Curve/Radius [Curve2] [Radius]\n the parametrization of the surface in the V direction will be as the Path",
                  __FILE__,
                  tuyau,g);
 
diff --git a/tests/pipe/bugs/bug31631 b/tests/pipe/bugs/bug31631
new file mode 100644 (file)
index 0000000..1b7d832
--- /dev/null
@@ -0,0 +1,24 @@
+puts "============"
+puts "0031631: Modeling Algorithms - Invalid result of Pipe builder"
+puts "============"
+puts ""
+
+pload ALL
+
+restore [locate_data_file bug31631_1.brep] path
+restore [locate_data_file bug31631_2.brep] sup1
+restore [locate_data_file bug31631_3.brep] sup2
+
+tuyau res1 path sup1 sup2 6.35001275
+
+tuyau res2 path sup2 sup1 6.35001275
+
+mkface face1 res1
+mkface face2 res2
+
+checkprops face1 -s 352.49
+checkprops face2 -s 352.49
+
+checkview -display face1 -3d -path ${imagedir}/${test_image}.png
+
+puts "TEST COMPLETED"
\ No newline at end of file