diff --git a/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.cpp b/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.cpp index 5284a26a5b..85125f092c 100644 --- a/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.cpp +++ b/src/ifcgeom/kernels/opencascade/OpenCascadeKernel.cpp @@ -152,12 +152,23 @@ bool IfcGeom::OpenCascadeKernel::convert_openings(const IfcUtil::IfcBaseEntity* BOPAlgo_MakerVolume mv; mv.AddArgument(entity_part); mv.SetAvoidInternalShapes(true); + // mv.SetFuzzyValue(settings_.get().get()); + std::optional failure; try { mv.Perform(); - entity_part = mv.Shape(); - Logger::Warning("Sucessfully detected exterior volume to non-manifold first operand"); + auto entity_part_2 = mv.Shape(); + if (IfcGeom::util::count(entity_part_2, TopAbs_FACE) == 0) { + failure = "Empty result (no faces) for BOPAlgo_MakerVolume; original was " + std::to_string(IfcGeom::util::count(entity_part, TopAbs_FACE)); + } else { + is_manifold = util::is_manifold(entity_part_2); + Logger::Warning(std::string("Sucessfully detected exterior volume to non-manifold first operand; shape is now ") + (is_manifold ? std::string("manifold") : std::string("non-manifold"))); + entity_part = entity_part_2; + } } catch (const Standard_Failure& e) { - Logger::Warning("MakeVolume failed: " + std::string(e.GetMessageString()), entity); + failure.emplace(e.GetMessageString()); + } + if (failure) { + Logger::Warning("MakeVolume failed: " + *failure, entity); } } else { Logger::Warning("Non-manifold first operand, use --make-volume to try and make manifold");