From 64454a001f2257b0c4821a323eedd9b4527f7424 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 16 Oct 2023 11:02:30 +0200 Subject: [PATCH] Apply handling of openings on IfcFeatureElementSubtraction generically #3889 --- src/ifcgeom/mapping/mapping.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ifcgeom/mapping/mapping.cpp b/src/ifcgeom/mapping/mapping.cpp index 9867683cf8..73f05196cd 100644 --- a/src/ifcgeom/mapping/mapping.cpp +++ b/src/ifcgeom/mapping/mapping.cpp @@ -156,8 +156,8 @@ aggregate_of_instance::ptr mapping::find_openings(const IfcUtil::IfcBaseEntity* auto product = inst->as(); aggregate_of_instance::ptr openings(new aggregate_of_instance); - if (product->declaration().is(IfcSchema::IfcElement::Class()) && !product->declaration().is(IfcSchema::IfcOpeningElement::Class())) { - IfcSchema::IfcElement* element = (IfcSchema::IfcElement*)product; + if (product->as() && !product->as()) { + const IfcSchema::IfcElement* element = product->as(); auto rels = element->HasOpenings(); for (auto& rel : *rels) { openings->push(rel->RelatedOpeningElement()); @@ -170,8 +170,8 @@ aggregate_of_instance::ptr mapping::find_openings(const IfcUtil::IfcBaseEntity* auto decomposes = obdef->Decomposes()->generalize(); if (decomposes->size() != 1) break; IfcSchema::IfcObjectDefinition* rel_obdef = (*decomposes->begin())->as()->RelatingObject(); - if (rel_obdef->declaration().is(IfcSchema::IfcElement::Class()) && !rel_obdef->declaration().is(IfcSchema::IfcOpeningElement::Class())) { - IfcSchema::IfcElement* element = (IfcSchema::IfcElement*)rel_obdef; + if (rel_obdef->as() && !rel_obdef->as()) { + IfcSchema::IfcElement* element = rel_obdef->as(); auto rels = element->HasOpenings(); for (auto& rel : *rels) { openings->push(rel->RelatedOpeningElement());