mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
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:
committed by
Thomas Krijnen
parent
040bebedfb
commit
e7370dff9f
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user