mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 07:36:47 +00:00
Fixes for using hybrid kernel on non-products #5443
This commit is contained in:
@@ -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,20 +174,22 @@ 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>();
|
||||||
for (;;) {
|
if (obdef != nullptr) {
|
||||||
auto decomposes = obdef->Decomposes()->generalize();
|
for (;;) {
|
||||||
if (decomposes->size() != 1) break;
|
auto decomposes = obdef->Decomposes()->generalize();
|
||||||
IfcSchema::IfcObjectDefinition* rel_obdef = (*decomposes->begin())->as<IfcSchema::IfcRelAggregates>()->RelatingObject();
|
if (decomposes->size() != 1) break;
|
||||||
if (rel_obdef->as<IfcSchema::IfcElement>() && !rel_obdef->as<IfcSchema::IfcFeatureElementSubtraction>()) {
|
IfcSchema::IfcObjectDefinition* rel_obdef = (*decomposes->begin())->as<IfcSchema::IfcRelAggregates>()->RelatingObject();
|
||||||
IfcSchema::IfcElement* element = rel_obdef->as<IfcSchema::IfcElement>();
|
if (rel_obdef->as<IfcSchema::IfcElement>() && !rel_obdef->as<IfcSchema::IfcFeatureElementSubtraction>()) {
|
||||||
auto rels = element->HasOpenings();
|
IfcSchema::IfcElement* element = rel_obdef->as<IfcSchema::IfcElement>();
|
||||||
for (auto& rel : *rels) {
|
auto rels = element->HasOpenings();
|
||||||
openings->push(rel->RelatedOpeningElement());
|
for (auto& rel : *rels) {
|
||||||
|
openings->push(rel->RelatedOpeningElement());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
obdef = rel_obdef;
|
obdef = rel_obdef;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return openings;
|
return openings;
|
||||||
|
|||||||
Reference in New Issue
Block a user