diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index 05d60e4b33..6d15b7dba6 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -2101,6 +2101,7 @@ bool IfcGeom::Kernel::split_solid_by_shell(const TopoDS_Shape& input, const Topo } else { return false; } + apply_tolerance(solid, getValue(GV_PRECISION)); BOPCol_ListOfShape shapes; shapes.Append(input); @@ -2111,8 +2112,14 @@ bool IfcGeom::Kernel::split_solid_by_shell(const TopoDS_Shape& input, const Topo front = BRepAlgoAPI_Cut(input, solid, filler); back = BRepAlgoAPI_Common(input, solid, filler); + bool is_null[2]; + for (int i = 0; i < 2; ++i) { TopoDS_Shape& shape = i == 0 ? front : back; + const bool result_is_null = is_null[i] = shape.IsNull(); + if (result_is_null) { + continue; + } try { ShapeFix_Shape fix(shape); if (fix.Perform()) { @@ -2126,6 +2133,13 @@ bool IfcGeom::Kernel::split_solid_by_shell(const TopoDS_Shape& input, const Topo } } + if (is_null[0] || is_null[1]) { + Logger::Message(Logger::LOG_ERROR, "Null result obtained from layerset slicing"); + if (is_null[0] && is_null[1]) { + return false; + } + } + const double ab = shape_volume(input); const double a = shape_volume(front); const double b = shape_volume(back);