]> OCCT Git - occt.git/commitdiff
0032106: Modeling Algorithms - Tolerance of General Fuse result depends on a sequence...
authorifv <ifv@opencascade.com>
Thu, 1 Apr 2021 08:10:00 +0000 (11:10 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 7 Apr 2021 15:37:19 +0000 (18:37 +0300)
BOPTools_AlgoTools2D::MakePCurveOnFace(...): extension of surface for projection with large tolerance is added.

test/bugs/modalg_7/bug32106 : new test case added

src/BOPTools/BOPTools_AlgoTools2D.cxx
tests/bugs/modalg_7/bug32106 [new file with mode: 0644]

index 85642012a180bf5110f4dd76a6b8aefa497ce619..356e0e8be04b36e27d379e3365ad9c1d65623438 100644 (file)
@@ -576,6 +576,7 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
     Standard_Integer aDegMin = -1, aDegMax = -1, aMaxSegments = -1;
     Standard_Real aMaxDist = -1;
     AppParCurves_Constraint aBndPnt = AppParCurves_TangencyPoint;
+    Standard_Boolean isExtendSurf = Standard_False;
     if ((TolReached2d  >= 10. * aTR) && (TolReached2d <= aMaxTol || isAnaSurf))
     {
       aTR = Min(aMaxTol, 0.1*TolReached2d);
@@ -585,12 +586,34 @@ void BOPTools_AlgoTools2D::MakePCurveOnFace
       {
         aBndPnt = AppParCurves_PassPoint;
       }
+      isExtendSurf = Standard_True;
     }
     else if(TolReached2d > aMaxTol)
     {
       aTR = Min(TolReached2d, 1.e3 * aMaxTol);
       aMaxDist = 1.e2 * aTR;
       aMaxSegments = 100;
+      isExtendSurf = Standard_True;
+    }
+    if (isExtendSurf)
+    {
+      Handle(Adaptor3d_Surface) anA3dSurf;
+      Standard_Real dt = (aBAHS->LastUParameter() - aBAHS->FirstUParameter());
+      if (!aBAHS->IsUPeriodic() || Abs(dt - aBAHS->UPeriod()) > 0.01 * dt)
+      {
+        dt *= 0.01;
+        anA3dSurf = aBAHS->UTrim(aBAHS->FirstUParameter() - dt, aBAHS->LastUParameter() + dt, 0.);
+      }
+      dt = (aBAHS->LastVParameter() - aBAHS->FirstVParameter());
+      if (!aBAHS->IsVPeriodic() || Abs(dt - aBAHS->VPeriod()) > 0.01 * dt)
+      {
+        dt *= 0.01;
+        anA3dSurf = aBAHS->VTrim(aBAHS->FirstVParameter() - dt, aBAHS->LastVParameter() + dt, 0.);
+      }
+      if (!anA3dSurf.IsNull())
+      {
+        aProjCurv.Load(anA3dSurf);
+      }
     }
     aProjCurv.Load(aTR);
     aProjCurv.SetDegree(aDegMin, aDegMax);
diff --git a/tests/bugs/modalg_7/bug32106 b/tests/bugs/modalg_7/bug32106
new file mode 100644 (file)
index 0000000..19c0cb1
--- /dev/null
@@ -0,0 +1,37 @@
+puts "============================================================================================="
+puts "0032106: Modeling Algorithms - Tolerance of General Fuse result depends on a sequence of arguments"
+puts "============================================================================================="
+puts ""
+
+brestore [locate_data_file bug32106-body.brep] b1
+brestore [locate_data_file bug32106-contour.brep] w1
+tcopy -n b1 b2 
+tcopy -n w1 w2
+
+bclearobjects
+bcleartools
+
+baddobjects b1 w1
+bfuzzyvalue 1.0
+bfillds
+bbuild r1
+
+checkshape r1
+checknbshapes r1 -vertex 65 -edge 96 -wire 33 -face 32 -shell 1 -t
+checkmaxtol r1 -ref  4.2e-01
+checkprops r1 -l 73255.5
+
+bclearobjects
+bcleartools
+
+baddobjects w2 b2
+bfuzzyvalue 1.0
+bfillds
+bbuild r2
+checkshape r2
+checknbshapes r2 -ref [nbshapes r1]
+checkmaxtol r2 -ref 4.2e-01
+checkprops r2 -l 73255.6
+
+checkview -display r1 -2d -path ${imagedir}/${test_image}_r1.png
+checkview -display r2 -2d -path ${imagedir}/${test_image}_r2.png