mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Display the default container in the UI when creating new types
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user