Fixes for using hybrid kernel on non-products #5443

This commit is contained in:
Thomas Krijnen
2024-09-23 16:18:00 +02:00
parent aaf5fde92e
commit a51ed6e6b3
+5 -5
View File
@@ -165,10 +165,8 @@ aggregate_of_instance::ptr mapping::find_openings(const IfcUtil::IfcBaseEntity*
return openings; return openings;
} }
auto product = inst->as<IfcSchema::IfcProduct>(); if (inst->as<IfcSchema::IfcElement>() && !inst->as<IfcSchema::IfcFeatureElementSubtraction>()) {
const IfcSchema::IfcElement* element = inst->as<IfcSchema::IfcElement>();
if (product->as<IfcSchema::IfcElement>() && !product->as<IfcSchema::IfcFeatureElementSubtraction>()) {
const IfcSchema::IfcElement* element = product->as<IfcSchema::IfcElement>();
auto rels = element->HasOpenings(); auto rels = element->HasOpenings();
for (auto& rel : *rels) { for (auto& rel : *rels) {
openings->push(rel->RelatedOpeningElement()); openings->push(rel->RelatedOpeningElement());
@@ -176,7 +174,8 @@ aggregate_of_instance::ptr mapping::find_openings(const IfcUtil::IfcBaseEntity*
} }
// Is the IfcElement a decomposition of an IfcElement with any IfcOpeningElements? // Is the IfcElement a decomposition of an IfcElement with any IfcOpeningElements?
const IfcSchema::IfcObjectDefinition* obdef = product->as<IfcSchema::IfcObjectDefinition>(); const IfcSchema::IfcObjectDefinition* obdef = inst->as<IfcSchema::IfcObjectDefinition>();
if (obdef != nullptr) {
for (;;) { for (;;) {
auto decomposes = obdef->Decomposes()->generalize(); auto decomposes = obdef->Decomposes()->generalize();
if (decomposes->size() != 1) break; if (decomposes->size() != 1) break;
@@ -191,6 +190,7 @@ aggregate_of_instance::ptr mapping::find_openings(const IfcUtil::IfcBaseEntity*
obdef = rel_obdef; obdef = rel_obdef;
} }
}
return openings; return openings;
} }