mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
avoid writing to ifc loading ui elements
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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))
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user