From 71c1cd6a9ef61d7f93f501247998fbe249f77a62 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Fri, 19 Nov 2021 10:39:14 +0100 Subject: [PATCH] Check for null result and handle some bop alerts --- src/ifcgeom/IfcGeomFunctions.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index fbb1f1b835..f445f44af3 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -154,6 +154,10 @@ #include #include +#if OCC_VERSION_HEX >= 0x70200 +#include +#endif + #include "../ifcparse/macros.h" #include "../ifcparse/IfcSIPrefix.h" #include "../ifcparse/IfcFile.h" @@ -4438,6 +4442,15 @@ bool IfcGeom::Kernel::boolean_operation(const TopoDS_Shape& a_, const TopTools_L } } else { std::stringstream str; + +#if OCC_VERSION_HEX >= 0x70200 + if (builder->HasError(STANDARD_TYPE(BOPAlgo_AlertBOPNotAllowed))) { + Logger::Error("Invalid operands using first operand"); + result = a; + success = true; + } +#endif + #if OCC_VERSION_HEX >= 0x70000 builder->DumpErrors(str); #else @@ -4457,7 +4470,7 @@ bool IfcGeom::Kernel::boolean_operation(const TopoDS_Shape& a_, const TopTools_L Logger::Notice("No longer attempting boolean operation with higher fuzziness"); } } - return success; + return success && !result.IsNull(); } bool IfcGeom::Kernel::boolean_operation(const TopoDS_Shape& a, const TopoDS_Shape& b, BOPAlgo_Operation op, TopoDS_Shape& result, double fuzziness) {