entity_instance: switch to use of declaration as a property

Fixes most of the bonsai tests.
This commit is contained in:
Andrej730
2026-07-22 18:46:43 +05:00
parent c2badadfc4
commit 3536bcf46d
8 changed files with 9 additions and 8 deletions
+1 -1
View File
@@ -187,7 +187,7 @@ def import_attributes(
info = {a.name(): None for a in attributes}
info["type"] = element
else:
assert (entity := element.declaration().as_entity())
assert (entity := element.declaration.as_entity())
attributes = entity.all_attributes()
info = element.get_info()
for attribute in attributes:
+1 -1
View File
@@ -206,7 +206,7 @@ class CostSchedulesData:
data["UnitSymbol"] = ifcopenshell.util.unit.get_unit_symbol(unit)
if quantity.is_a("IfcPhysicalSimpleQuantity"):
measure_class = (
quantity.declaration()
quantity.declaration
.as_entity()
.attribute_by_index(3)
.type_of_attribute()
+2 -2
View File
@@ -95,7 +95,7 @@ class ColourByPropertyData:
element = tool.Ifc.get_entity(obj)
if not element:
return default
keys = [a.name() for a in element.declaration().as_entity().all_attributes()]
keys = [a.name() for a in element.declaration.as_entity().all_attributes()]
psets = ifcopenshell.util.element.get_psets(element)
for pset, properties in psets.items():
if pset.endswith("Common"):
@@ -126,7 +126,7 @@ class SelectSimilarData:
element = tool.Ifc.get_entity(obj)
if not element:
return []
keys = [a.name() for a in element.declaration().as_entity().all_attributes()]
keys = [a.name() for a in element.declaration.as_entity().all_attributes()]
psets = ifcopenshell.util.element.get_psets(element, psets_only=True)
for pset, properties in psets.items():
if pset.endswith("Common"):
+1 -1
View File
@@ -2166,7 +2166,7 @@ class Geometry(bonsai.core.tool.Geometry):
item = tool.Ifc.get().by_id(props.ifc_definition_id)
allowed_attributes = [
a.name()
for a in item.declaration().as_entity().all_attributes()
for a in item.declaration().as_entity.all_attributes()
if a.type_of_attribute()._is("IfcLengthMeasure")
]