0030597: BRepOffsetAPI_MakePipeShell raises Standard_RangeError
authorjgv <jgv@opencascade.com>
Tue, 2 Apr 2019 11:14:00 +0000 (14:14 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 12 Apr 2019 08:34:54 +0000 (11:34 +0300)
Constructor of GeomFill_SectionPlacement has been corrected: add correction of boundaries of curve to avoid mistake of LocateU in the case when the curve is BSpline.

src/GeomFill/GeomFill_SectionPlacement.cxx
tests/bugs/modalg_7/bug30597 [new file with mode: 0644]

index e4223d8..98e1a23 100644 (file)
@@ -283,6 +283,21 @@ GeomFill_SectionPlacement(const Handle(GeomFill_LocationLaw)& L,
          Handle(TColgp_HArray1OfPnt) Pnts;
          Standard_Real first = myAdpSection.FirstParameter();
          Standard_Real last =  myAdpSection.LastParameter();
+          if (myAdpSection.IsPeriodic())
+          {
+            //Correct boundaries to avoid mistake of LocateU
+            Handle(Geom_Curve) aCurve = myAdpSection.Curve();
+            if (aCurve->IsInstance(STANDARD_TYPE(Geom_TrimmedCurve)))
+              aCurve = (Handle(Geom_TrimmedCurve)::DownCast(aCurve))->BasisCurve();
+            Standard_Real Ufirst = aCurve->FirstParameter();
+            Standard_Real aPeriod = aCurve->Period();
+            Standard_Real U1 = Ufirst + Floor((first - Ufirst)/aPeriod) * aPeriod;
+            Standard_Real U2 = U1 + aPeriod;
+            if (Abs(first - U1) <= Precision::PConfusion())
+              first = U1;
+            if (Abs(last - U2) <= Precision::PConfusion())
+              last = U2;
+          }
          Standard_Real t, delta;
          if (myAdpSection.GetType() == GeomAbs_BSplineCurve)
            {
diff --git a/tests/bugs/modalg_7/bug30597 b/tests/bugs/modalg_7/bug30597
new file mode 100644 (file)
index 0000000..6f09f09
--- /dev/null
@@ -0,0 +1,19 @@
+puts "================================================================"
+puts "OCC30597: BRepOffsetAPI_MakePipeShell raises Standard_RangeError"
+puts "================================================================"
+puts ""
+
+restore [locate_data_file bug30597_compound.brep] a
+explode a
+
+explode a_1 v
+explode a_2
+explode a_3
+
+mksweep a_1
+addsweep a_2_1 a_1_1
+addsweep a_3_1 a_1_2
+
+buildsweep result
+
+checkprops result -s 0.95884