From 784c1724d51dd613086db72f09e5657151bf070c Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Fri, 24 May 2019 14:49:14 +0200 Subject: [PATCH] Check shell validity in accordance with https://github.com/IfcOpenShell/IfcOpenShell/commit/342cce89d70a5ded5fb1bf52d87383bfce5021ca#commitcomment-31511282 --- src/ifcgeom/IfcGeomFunctions.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index d84052b2a6..fca7f24af8 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -349,17 +349,19 @@ bool IfcGeom::Kernel::create_solid_from_faces(const TopTools_ListOfShape& face_l builder.Perform(); shape = builder.SewedShape(); - { - BRepCheck_Analyzer ana(shape); - if (!ana.IsValid()) { - ShapeFix_Shape sfs(shape); - sfs.Perform(); - shape = sfs.Shape(); - } + BRepCheck_Analyzer ana(shape); + valid_shell = ana.IsValid(); + + if (!valid_shell) { + ShapeFix_Shape sfs(shape); + sfs.Perform(); + shape = sfs.Shape(); + + BRepCheck_Analyzer reana(shape); + valid_shell = reana.IsValid(); } - BRepCheck_Analyzer ana(shape); - valid_shell = ana.IsValid() != 0 && count(shape, TopAbs_SHELL) > 0; + valid_shell &= count(shape, TopAbs_SHELL) > 0; } catch (const Standard_Failure& e) { if (e.GetMessageString() && strlen(e.GetMessageString())) { Logger::Error(e.GetMessageString());