fix(sql): recognise derived attributes in sqlite_entity.__getattr__

get_attribute_category() returns 3 for a derived attribute, but
sqlite_entity.__getattr__() only branched on FORWARD (1) and INVERSE
(2), so any derived attribute (e.g. IfcSIUnit.Dimensions) fell
through to the final AttributeError instead of returning None, which
is what SQLite-linked files are documented to do since derived
attributes are not computed for them. Mirrors the DERIVED handling
already present in entity_instance.py's __getattr__.
This commit is contained in:
Petru Conduraru
2026-08-30 15:17:36 +03:00
committed by Thomas Krijnen
parent 040bebedfb
commit e7370dff9f
+5 -1
View File
@@ -385,8 +385,12 @@ class sqlite_entity:
# print("*" * 100)
# print("GETATTR", self.sqlite_wrapper.id, self.sqlite_wrapper.ifc_class, name)
INVALID, FORWARD, INVERSE = range(3)
INVALID, FORWARD, INVERSE, DERIVED = range(4)
attr_cat = self.wrapped_data.get_attribute_category(name)
if attr_cat == DERIVED:
# Derived attributes aren't stored or computed for SQLite-linked
# files, so callers must treat None as "not available" here.
return None
if attr_cat == FORWARD:
if self.sqlite_wrapper.attribute_cache:
# print(self.sqlite_wrapper.ifc_class)