]> OCCT Git - occt-copy.git/commitdiff
0029392: Modeling data - Exception when getting UIso of offset surface of surface...
authorakaftasev <akaftasev@opencascade.com>
Thu, 19 Nov 2020 11:42:18 +0000 (14:42 +0300)
committerbugmaster <bugmaster@opencascade.com>
Wed, 25 Nov 2020 15:48:38 +0000 (18:48 +0300)
Added treatment for Geom_OffsetSurface::UIso() if basisSurface is Geom_SurfaceOfLinearExtrusion

src/Geom/Geom_OffsetSurface.cxx
tests/bugs/modalg_7/bug26558 [deleted file]
tests/bugs/modalg_7/bug26558_1 [new file with mode: 0644]
tests/bugs/modalg_7/bug26558_2 [new file with mode: 0644]

index 114f953510e22d4e828e2ad01eac9cf0ca3574a1..bb11c54962e933c05f3e0695798c2c25863d29bd 100644 (file)
@@ -46,6 +46,7 @@
 #include <Geom_TrimmedCurve.hxx>
 #include <Geom_UndefinedDerivative.hxx>
 #include <Geom_UndefinedValue.hxx>
+#include <GeomLProp_SLProps.hxx>
 #include <GeomAbs_CurveType.hxx>
 #include <GeomAbs_IsoType.hxx>
 #include <GeomAbs_Shape.hxx>
@@ -530,14 +531,27 @@ void Geom_OffsetSurface_VIsoEvaluator::Evaluate(Standard_Integer *,/*Dimension*/
 //=======================================================================
 //function : UIso
 //purpose  : The Uiso or the VIso of an OffsetSurface can't be clearly 
-//           exprimed as a curve from Geom. So, to extract the U or VIso
-//           an Approximation is needed. This approx always will return a 
-//           BSplineCurve from Geom.
+//           exprimed as a curve from Geom (except some particular cases).
+//           So, to extract the U or VIso an Approximation is needed.
+//           This approx always will return a BSplineCurve from Geom.
 //=======================================================================
 
 Handle(Geom_Curve) Geom_OffsetSurface::UIso (const Standard_Real UU) const 
 {
   if (equivSurf.IsNull()) {
+    GeomAdaptor_Surface aGAsurf (basisSurf);
+    if (aGAsurf.GetType() == GeomAbs_SurfaceOfExtrusion)
+    {
+      Handle(Geom_Curve) aL = basisSurf->UIso(UU);
+      GeomLProp_SLProps aSurfProps (basisSurf, UU, 0., 2, Precision::Confusion());
+     
+      gp_Vec aDir;
+      aDir = aSurfProps.Normal();
+      aDir *= offsetValue;
+
+      aL->Translate(aDir);
+      return aL;
+    }
     const Standard_Integer Num1 = 0, Num2 = 0, Num3 = 1;
     Handle(TColStd_HArray1OfReal) T1, T2, T3 = new TColStd_HArray1OfReal(1,Num3);
     T3->Init(Precision::Approximation());
diff --git a/tests/bugs/modalg_7/bug26558 b/tests/bugs/modalg_7/bug26558
deleted file mode 100644 (file)
index 82b7257..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-puts "TODO OCC26558 ALL: An exception was caught"
-puts "TODO OCC26558 ALL: TEST INCOMPLETE"
-
-puts "========"
-puts "0026558: Failing to build isoline for offset surface"
-puts "========"
-puts ""
-
-restore [locate_data_file bug26558_s.brep] s
-
-mksurface sur s
-offset o sur 0.5
-uiso icur o 0
diff --git a/tests/bugs/modalg_7/bug26558_1 b/tests/bugs/modalg_7/bug26558_1
new file mode 100644 (file)
index 0000000..99ee3fe
--- /dev/null
@@ -0,0 +1,14 @@
+puts "========"
+puts "0026558: Failing to build isoline for offset surface"
+puts "========"
+puts ""
+
+restore [locate_data_file bug26558_s.brep] s
+
+mksurface sur s
+offset o sur 0.5
+uiso icur o 0
+
+smallview
+fit       
+checkview -screenshot -2d -path ${imagedir}/${test_image}-3d.png 
\ No newline at end of file
diff --git a/tests/bugs/modalg_7/bug26558_2 b/tests/bugs/modalg_7/bug26558_2
new file mode 100644 (file)
index 0000000..1f0b1bc
--- /dev/null
@@ -0,0 +1,14 @@
+puts "========"
+puts "0026558: Failing to build isoline for offset surface"
+puts "========"
+puts ""
+
+restore [locate_data_file bug26558_s.brep] s
+
+mksurface sur s
+offset o sur -0.5
+uiso icur o 0
+
+smallview
+fit   
+checkview -screenshot -2d -path ${imagedir}/${test_image}-3d.png
\ No newline at end of file