mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 02:07:36 +00:00
avoid writing to ifc loading ui elements
This commit is contained in:
@@ -42,7 +42,7 @@ class LoadProfiles(bpy.types.Operator):
|
|||||||
continue
|
continue
|
||||||
new = props.profiles.add()
|
new = props.profiles.add()
|
||||||
new.ifc_definition_id = profile.id()
|
new.ifc_definition_id = profile.id()
|
||||||
new.name = profile.ProfileName or "Unnamed"
|
new["name"] = profile.ProfileName or "Unnamed"
|
||||||
new.ifc_class = profile.is_a()
|
new.ifc_class = profile.is_a()
|
||||||
|
|
||||||
props.is_editing = True
|
props.is_editing = True
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class Material(bonsai.core.tool.Material):
|
|||||||
|
|
||||||
for category, mats in categories.items():
|
for category, mats in categories.items():
|
||||||
cat = props.materials.add()
|
cat = props.materials.add()
|
||||||
cat.name = category
|
cat["name"] = category
|
||||||
cat.is_category = True
|
cat.is_category = True
|
||||||
cat.is_expanded = cat.name in expanded_categories
|
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 []:
|
for material in mats if cat.is_expanded else []:
|
||||||
new = props.materials.add()
|
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.ifc_definition_id = material.id()
|
||||||
new.total_elements = len(
|
new.total_elements = len(
|
||||||
ifcopenshell.util.element.get_elements_by_material(tool.Ifc.get(), material)
|
ifcopenshell.util.element.get_elements_by_material(tool.Ifc.get(), material)
|
||||||
@@ -127,8 +126,7 @@ class Material(bonsai.core.tool.Material):
|
|||||||
return
|
return
|
||||||
for material in materials:
|
for material in materials:
|
||||||
new = props.materials.add()
|
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.ifc_definition_id = material.id()
|
||||||
new.total_elements = len(ifcopenshell.util.element.get_elements_by_material(tool.Ifc.get(), material))
|
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
|
props = bpy.context.scene.BIMSpatialDecompositionProperties
|
||||||
new = props.containers.add()
|
new = props.containers.add()
|
||||||
new.ifc_class = element.is_a()
|
new.ifc_class = element.is_a()
|
||||||
new.name = element.Name or "Unnamed"
|
new["name"] = element.Name or "Unnamed"
|
||||||
new.description = element.Description or ""
|
new.description = element.Description or ""
|
||||||
new.long_name = element.LongName or ""
|
new.long_name = element.LongName or ""
|
||||||
if not element.is_a("IfcProject"):
|
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.is_expanded = element.id() not in cls.contracted_containers
|
||||||
new.level_index = level_index
|
new.level_index = level_index
|
||||||
children = ifcopenshell.util.element.get_parts(element)
|
children = ifcopenshell.util.element.get_parts(element)
|
||||||
|
|||||||
Reference in New Issue
Block a user