populate_derived() upon instance creation, don't only rely on serialization 'hack' #5364

This commit is contained in:
Thomas Krijnen
2024-10-07 20:41:34 +02:00
parent 8e8136ffb6
commit aa9b2d7428
4 changed files with 22 additions and 7 deletions
+5 -1
View File
@@ -596,7 +596,11 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
const IfcParse::schema_definition* schema = IfcParse::schema_by_name(schema_identifier);
const IfcParse::declaration* decl = schema->declaration_by_name(name);
IfcEntityInstanceData data(storage_t(decl->as_entity() ? decl->as_entity()->attribute_count() : 1));
return schema->instantiate(decl, std::move(data));
auto inst = schema->instantiate(decl, std::move(data));
if (auto entinst = inst->as<IfcUtil::IfcBaseEntity>()) {
entinst->populate_derived();
}
return inst;
}
%}