From 1e092c140f5b11786dd35d6bab69da40b959b1a6 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Fri, 21 Jun 2024 15:58:44 +0500 Subject: [PATCH] add ifc2x3 support for 301cdf650 --- src/ifcgeom/mapping/mapping.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/ifcgeom/mapping/mapping.cpp b/src/ifcgeom/mapping/mapping.cpp index 53926f2aef..2da6b2d36b 100644 --- a/src/ifcgeom/mapping/mapping.cpp +++ b/src/ifcgeom/mapping/mapping.cpp @@ -258,9 +258,20 @@ void mapping::get_representations(std::vector& tasks, const IfcUtil::IfcBaseEntity* mapping::get_product_type(const IfcUtil::IfcBaseEntity* product_) { auto product = product_->as(); +#ifdef SCHEMA_IfcObject_HAS_IsTypedBy auto rels = product->IsTypedBy(); +#else // IFC2X3. + auto rels = product->IsDefinedBy(); +#endif for (auto it = rels->begin(); it != rels->end(); ++it) { +#ifdef SCHEMA_IfcObject_HAS_IsTypedBy auto rel = *it; +#else // IFC2X3. + IfcSchema::IfcRelDefinesByType* rel = (*it)->as(); + if (rel == nullptr) { + continue; + } +#endif // Avoid segfault if RelatingType is unset. if (rel->get("RelatingType")->isNull()){ break;