Skip to content

Commit 5c4046e

Browse files
committed
declaration as property
1 parent d82e1da commit 5c4046e

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎src/ifcopenshell-python/ifcopenshell/api/project/append_asset.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ def get_attributes() -> tuple[W.attribute, ...]:
615615
nonlocal attributes_
616616
if attributes_ is not None:
617617
return attributes_
618-
attributes_ = element.declaration().as_entity().all_attributes()
618+
attributes_ = element.declaration.all_attributes()
619619
return attributes_
620620

621621
def get_existing_element_(

‎src/ifcopenshell-python/ifcopenshell/api/style/edit_surface_style.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def execute(self, style: ifcopenshell.entity_instance, attributes: dict[str, Any
8181
self.style = style
8282

8383
attribute_types: dict[str, str] = {}
84-
for attribute in style.declaration().as_entity().all_attributes():
84+
for attribute in style.declaration.all_attributes():
8585
attribute_type = attribute.type_of_attribute()
8686
if attribute_type.as_aggregation_type() is None:
8787
attribute_type = attribute_type.declared_type().name()

‎src/ifcopenshell-python/ifcopenshell/util/schema.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def get_declaration(element: ifcopenshell.entity_instance):
7070
print(declaration.is_abstract()) # False
7171
print(declaration.supertype().name()) # IfcBuildingElement
7272
"""
73-
return element.declaration().as_entity()
73+
return element.declaration
7474

7575

7676
def is_a(declaration: ifcopenshell.ifcopenshell_wrapper.declaration, ifc_class: str) -> bool:
@@ -104,7 +104,7 @@ def get_supertypes(
104104
.. code:: python
105105
106106
wall = model.createIfcWall()
107-
results = ifcopenshell.util.schema.get_supertypes(wall.declaration().as_entity())
107+
results = ifcopenshell.util.schema.get_supertypes(wall.declaration.as_entity())
108108
# [<entity IfcBuildingElement>, <entity IfcElement>, ..., <entity IfcRoot>]
109109
"""
110110
results = []

‎src/ifcopenshell-python/ifcopenshell/util/selector.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -569,8 +569,8 @@ def set_predefined_type(
569569
element: ifcopenshell.entity_instance, value: Union[str, None], *, is_type: bool
570570
) -> None:
571571
predefined_type = element.PredefinedType
572-
declaration = element.declaration()
573-
entity = declaration.as_entity()
572+
declaration = element.declaration
573+
entity = declaration
574574
enum_attr = next(attr for attr in entity.attributes() if attr.name() == "PredefinedType")
575575
enum_items = ifcopenshell.util.attribute.get_enum_items(enum_attr)
576576

@@ -639,7 +639,7 @@ def set_predefined_type(
639639
except:
640640
# Try to cast
641641
data_type = ifcopenshell.util.attribute.get_primitive_type(
642-
element.declaration().as_entity().attribute_by_index(element.get_argument_index(key))
642+
element.declaration.attribute_by_index(element.get_argument_index(key))
643643
)
644644
if data_type == "string":
645645
value = str(value)

‎src/ifcopenshell-python/ifcopenshell/util/unit.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ def get_property_unit(
475475
measure_class = None
476476

477477
if prop.is_a("IfcPhysicalSimpleQuantity"):
478-
entity = prop.declaration().as_entity()
478+
entity = prop.declaration
479479
measure_class = entity.attribute_by_index(3).type_of_attribute().declared_type().name()
480480
elif prop.is_a("IfcPropertySingleValue"):
481481
measure_class = prop.NominalValue.is_a()

0 commit comments

Comments
 (0)