Remove usage of .wrapped_item and some other fixes

This commit is contained in:
Thomas Krijnen
2026-01-10 11:01:18 +01:00
parent 5c9213426f
commit b66b04b001
55 changed files with 129 additions and 118 deletions
+1 -1
View File
@@ -181,7 +181,7 @@ def import_attributes(
info = {a.name(): None for a in attributes}
info["type"] = element
else:
assert (entity := element.wrapped_data.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.wrapped_data.declaration()
quantity.declaration()
.as_entity()
.attribute_by_index(3)
.type_of_attribute()
@@ -89,7 +89,7 @@ class PrintIfcFile(bpy.types.Operator):
return tool.Ifc.get()
def execute(self, context):
print(tool.Ifc.get().wrapped_data.to_string())
print(tool.Ifc.get().to_string())
return {"FINISHED"}
@@ -785,7 +785,7 @@ def lock_error_message(name: str) -> str:
def calc_delete_is_batch(ifc_file: ifcopenshell.file, context: bpy.types.Context) -> bool:
total_elements = len(tool.Ifc.get().wrapped_data.entity_names())
total_elements = len(tool.Ifc.get().entity_names())
total_polygons = sum([len(o.data.polygons) for o in context.selected_objects if o.type == "MESH"])
# These numbers are a bit arbitrary, but basically batching is only
# really necessary on large models and large geometry removals.
+2 -2
View File
@@ -93,7 +93,7 @@ class ColourByPropertyData:
element = tool.Ifc.get_entity(obj)
if not element:
return default
keys = [a.name() for a in element.wrapped_data.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"):
@@ -124,7 +124,7 @@ class SelectSimilarData:
element = tool.Ifc.get_entity(obj)
if not element:
return []
keys = [a.name() for a in element.wrapped_data.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
@@ -1800,7 +1800,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.wrapped_data.declaration().as_entity().all_attributes()
for a in item.declaration().as_entity().all_attributes()
if a.type_of_attribute()._is("IfcLengthMeasure")
]