From 9ab58ebf65d43e98e1538f1bcf52879775902f74 Mon Sep 17 00:00:00 2001 From: akaftasev Date: Thu, 19 Nov 2020 14:42:18 +0300 Subject: [PATCH] 0029392: Modeling data - Exception when getting UIso of offset surface of surface of linear extrusion Added treatment for Geom_OffsetSurface::UIso() if basisSurface is Geom_SurfaceOfLinearExtrusion --- src/Geom/Geom_OffsetSurface.cxx | 20 +++++++++++++++++--- tests/bugs/modalg_7/{bug26558 => bug26558_1} | 7 ++++--- tests/bugs/modalg_7/bug26558_2 | 14 ++++++++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) rename tests/bugs/modalg_7/{bug26558 => bug26558_1} (67%) create mode 100644 tests/bugs/modalg_7/bug26558_2 diff --git a/src/Geom/Geom_OffsetSurface.cxx b/src/Geom/Geom_OffsetSurface.cxx index 114f953510..bb11c54962 100644 --- a/src/Geom/Geom_OffsetSurface.cxx +++ b/src/Geom/Geom_OffsetSurface.cxx @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -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_1 similarity index 67% rename from tests/bugs/modalg_7/bug26558 rename to tests/bugs/modalg_7/bug26558_1 index 82b72572ed..99ee3fe375 100644 --- a/tests/bugs/modalg_7/bug26558 +++ b/tests/bugs/modalg_7/bug26558_1 @@ -1,6 +1,3 @@ -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 "========" @@ -11,3 +8,7 @@ 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 index 0000000000..1f0b1bc72d --- /dev/null +++ b/tests/bugs/modalg_7/bug26558_2 @@ -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