Display the default container in the UI when creating new types

This commit is contained in:
Dion Moult
2024-07-29 19:50:21 +10:00
parent 8ca2a55616
commit 98edb5a34c
3 changed files with 12 additions and 1 deletions
@@ -50,6 +50,7 @@ class AuthoringData:
cls.props = bpy.context.scene.BIMModelProperties
if ifc_element_type:
cls.ifc_element_type = None if ifc_element_type == "all" else ifc_element_type
cls.data["default_container"] = cls.default_container()
cls.data["ifc_element_type"] = cls.ifc_element_type
cls.data["ifc_classes"] = cls.ifc_classes()
cls.data["relating_type_id"] = cls.relating_type_id() # only after .ifc_classes()
@@ -74,6 +75,15 @@ class AuthoringData:
cls.data["boundary_class"] = cls.boundary_class()
cls.data["selected_material_usages"] = cls.selected_material_usages()
@classmethod
def default_container(cls) -> str | None:
props = bpy.context.scene.BIMSpatialDecompositionProperties
if props.default_container:
try:
return tool.Ifc.get().by_id(props.default_container).Name
except:
pass
@classmethod
def boundary_class(cls):
declaration = tool.Ifc.schema().declaration_by_name("IfcRelSpaceBoundary")
@@ -503,6 +503,7 @@ class BimToolUI:
def draw_type_selection_interface(cls):
# shared by both sidebar and header
row = cls.layout.row(align=True)
row.label(text=f"Container: {AuthoringData.data['default_container']}", icon="OUTLINER_COLLECTION")
if AuthoringData.data["ifc_classes"]:
if not AuthoringData.data["ifc_element_type"]:
row.label(text="", icon="FILE_VOLUME")
@@ -97,7 +97,7 @@ class SpatialDecompositionData:
}
@classmethod
def default_container(cls) -> str:
def default_container(cls) -> str | None:
props = bpy.context.scene.BIMSpatialDecompositionProperties
if props.default_container:
try: