avoid writing to ifc loading ui elements

This commit is contained in:
Andrej730
2024-10-01 16:49:44 +05:00
parent 0ca3837fc2
commit c3a6d28927
3 changed files with 6 additions and 9 deletions
@@ -42,7 +42,7 @@ class LoadProfiles(bpy.types.Operator):
continue
new = props.profiles.add()
new.ifc_definition_id = profile.id()
new.name = profile.ProfileName or "Unnamed"
new["name"] = profile.ProfileName or "Unnamed"
new.ifc_class = profile.is_a()
props.is_editing = True
+3 -5
View File
@@ -105,7 +105,7 @@ class Material(bonsai.core.tool.Material):
for category, mats in categories.items():
cat = props.materials.add()
cat.name = category
cat["name"] = category
cat.is_category = True
cat.is_expanded = cat.name in expanded_categories
@@ -114,8 +114,7 @@ class Material(bonsai.core.tool.Material):
for material in mats if cat.is_expanded else []:
new = props.materials.add()
# Assign name before assigning ifc_definition_id to avoid triggering IFC update.
new.name = get_name(material)
new["name"] = get_name(material)
new.ifc_definition_id = material.id()
new.total_elements = len(
ifcopenshell.util.element.get_elements_by_material(tool.Ifc.get(), material)
@@ -127,8 +126,7 @@ class Material(bonsai.core.tool.Material):
return
for material in materials:
new = props.materials.add()
# Assign name before assigning ifc_definition_id to avoid triggering IFC update.
new.name = get_name(material)
new["name"] = get_name(material)
new.ifc_definition_id = material.id()
new.total_elements = len(ifcopenshell.util.element.get_elements_by_material(tool.Ifc.get(), material))
+2 -3
View File
@@ -448,12 +448,11 @@ class Spatial(bonsai.core.tool.Spatial):
props = bpy.context.scene.BIMSpatialDecompositionProperties
new = props.containers.add()
new.ifc_class = element.is_a()
new.name = element.Name or "Unnamed"
new["name"] = element.Name or "Unnamed"
new.description = element.Description or ""
new.long_name = element.LongName or ""
if not element.is_a("IfcProject"):
ifc_file = tool.Ifc.get()
new.elevation = str(ifcopenshell.util.placement.get_storey_elevation(element))
new["elevation"] = str(ifcopenshell.util.placement.get_storey_elevation(element))
new.is_expanded = element.id() not in cls.contracted_containers
new.level_index = level_index
children = ifcopenshell.util.element.get_parts(element)