From d1be0e8c1cb135b46be13a69eb0b3aa5ea615687 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 28 Jun 2024 17:23:42 +0500 Subject: [PATCH] create_shape - raise the same error for representations and rep items To be consistent with how it's handled when product+representation is passed, previously it would fail silently. --- src/ifcgeom/Converter.cpp | 4 +++- src/ifcwrap/IfcGeomWrapper.i | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ifcgeom/Converter.cpp b/src/ifcgeom/Converter.cpp index a563016d20..b0e0d79d02 100644 --- a/src/ifcgeom/Converter.cpp +++ b/src/ifcgeom/Converter.cpp @@ -389,7 +389,9 @@ IfcGeom::ConversionResults ifcopenshell::geometry::Converter::convert(IfcUtil::I IfcGeom::ConversionResults results; if (geom_item) { std::clock_t geom_start = std::clock(); - kernel_->convert(geom_item, results); + if (!kernel_->convert(geom_item, results)) { + throw std::runtime_error("Failed to convert item"); + } std::clock_t geom_end = std::clock(); total_map_time += (geom_start - map_start) / (double) CLOCKS_PER_SEC; total_geom_time += (geom_end - geom_start) / (double) CLOCKS_PER_SEC; diff --git a/src/ifcwrap/IfcGeomWrapper.i b/src/ifcwrap/IfcGeomWrapper.i index 07df60c1df..496b51ccff 100644 --- a/src/ifcwrap/IfcGeomWrapper.i +++ b/src/ifcwrap/IfcGeomWrapper.i @@ -844,7 +844,12 @@ struct ShapeRTTI : public boost::static_visitor // https://github.com/IfcOpenShell/IfcOpenShell/issues/1649 instance->declaration().is(Schema::IfcProfileDef::Class()) ) { - IfcGeom::ConversionResults shapes = kernel.convert(instance); + IfcGeom::ConversionResults shapes; + try { + shapes = kernel.convert(instance); + } catch (...) { + throw IfcParse::IfcException("Failed to process shape"); + } IfcGeom::Representation::BRep brep(settings, instance->declaration().name(), to_locale_invariant_string(instance->data().id()), shapes); try {