From 521efa926dc8f24c2e7e1e85b3689acdcabdc634 Mon Sep 17 00:00:00 2001 From: ika Date: Fri, 24 Mar 2017 12:24:08 +0300 Subject: [PATCH] 0028589: Data Exchange - Writing face with NaturalRestriction flag to IGES Add additional check for infinite surfaces Correction of test case for issue CR28589 --- src/BRepToIGES/BRepToIGES_BRShell.cxx | 9 ++++++++- tests/bugs/iges/bug28589 | 8 ++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/bugs/iges/bug28589 diff --git a/src/BRepToIGES/BRepToIGES_BRShell.cxx b/src/BRepToIGES/BRepToIGES_BRShell.cxx index 9d2003a2bb..235f839365 100644 --- a/src/BRepToIGES/BRepToIGES_BRShell.cxx +++ b/src/BRepToIGES/BRepToIGES_BRShell.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -313,10 +314,16 @@ Handle(IGESData_IGESEntity) BRepToIGES_BRShell ::TransferFace(const TopoDS_Face& } } + // protection against faces on infinite surfaces with mistaken natural restriction flag + Standard_Boolean isWholeSurface = BRep_Tool::NaturalRestriction(start); + if ((Surf->IsKind(STANDARD_TYPE(Geom_Plane)) || + Surf->IsKind(STANDARD_TYPE(Geom_CylindricalSurface)) || + Surf->IsKind(STANDARD_TYPE(Geom_ConicalSurface))) && !IOuter.IsNull()) + isWholeSurface = Standard_False; // returns the TrimmedSurface // -------------------------- Handle(IGESGeom_TrimmedSurface) TrimmedSurf = new IGESGeom_TrimmedSurface; - if (BRep_Tool::NaturalRestriction(start)) { + if (isWholeSurface) { //if face bounds and surface bounds are same, outer wire is unnecessary TrimmedSurf-> Init (ISurf, Standard_False, NULL, Tab); } diff --git a/tests/bugs/iges/bug28589 b/tests/bugs/iges/bug28589 new file mode 100644 index 0000000000..8c1d5cf528 --- /dev/null +++ b/tests/bugs/iges/bug28589 @@ -0,0 +1,8 @@ +####################################################################### +# Data Exchange - Writing face with NaturalRestriction flag to IGES +####################################################################### + +restore [locate_data_file bug28589.brep] face +brepiges face ${imagedir}/${casename}.igs +igesbrep ${imagedir}/${casename}.igs result * +checknbshapes result -shape 10