diff --git a/src/ifcblenderexport/blenderbim/bim/module/structural/__init__.py b/src/ifcblenderexport/blenderbim/bim/module/structural/__init__.py index 828ffc8683..eaac7afdc2 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/structural/__init__.py +++ b/src/ifcblenderexport/blenderbim/bim/module/structural/__init__.py @@ -21,6 +21,7 @@ classes = ( prop.BIMObjectStructuralProperties, ui.BIM_PT_structural_analysis_models, ui.BIM_PT_structural_boundary_conditions, + ui.BIM_PT_connected_structural_members, ui.BIM_UL_structural_analysis_models, ) diff --git a/src/ifcblenderexport/blenderbim/bim/module/structural/data.py b/src/ifcblenderexport/blenderbim/bim/module/structural/data.py index 6efbcf2c86..dfe1265db4 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/structural/data.py +++ b/src/ifcblenderexport/blenderbim/bim/module/structural/data.py @@ -12,6 +12,7 @@ class Data: cls.is_loaded = False cls.products = {} cls.boundary_conditions = {} + cls.connected_structural_members = {} cls.structural_analysis_models = {} @classmethod @@ -59,3 +60,9 @@ class Data: else: data = {} cls.boundary_conditions[connection.id()] = data + + cls.connected_structural_members[connection.id()] = [ + rel.RelatingStructuralMember.id() + for rel in connection.ConnectsStructuralMembers or [] + ] + diff --git a/src/ifcblenderexport/blenderbim/bim/module/structural/prop.py b/src/ifcblenderexport/blenderbim/bim/module/structural/prop.py index 8656827324..ebd8199615 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/structural/prop.py +++ b/src/ifcblenderexport/blenderbim/bim/module/structural/prop.py @@ -31,3 +31,4 @@ class BIMStructuralProperties(PropertyGroup): class BIMObjectStructuralProperties(PropertyGroup): boundary_condition_attributes: CollectionProperty(name="Boundary Condition Attributes", type=Attribute) is_editing_boundary_condition: BoolProperty(name="Is Editing Boundary Condition", default=False) + connected_structural_members: CollectionProperty(name="Connected Structural Members", type=Attribute) diff --git a/src/ifcblenderexport/blenderbim/bim/module/structural/ui.py b/src/ifcblenderexport/blenderbim/bim/module/structural/ui.py index 359c5ee428..e5cead4f98 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/structural/ui.py +++ b/src/ifcblenderexport/blenderbim/bim/module/structural/ui.py @@ -75,6 +75,56 @@ class BIM_PT_structural_boundary_conditions(Panel): row.label(text=str(value)) +class BIM_PT_connected_structural_members(Panel): + bl_label = "IFC Connected Structural Members" + bl_idname = "BIM_PT_connected_structural_members" + bl_options = {"DEFAULT_CLOSED"} + bl_space_type = "PROPERTIES" + bl_region_type = "WINDOW" + bl_context = "object" + + @classmethod + def poll(cls, context): + if not context.active_object: + return False + props = context.active_object.BIMObjectProperties + if not props.ifc_definition_id: + return False + if not IfcStore.get_file().by_id(props.ifc_definition_id).is_a("IfcStructuralConnection"): + return False + return True + + def draw(self, context): + self.oprops = context.active_object.BIMObjectProperties + self.props = context.active_object.BIMStructuralProperties + if self.oprops.ifc_definition_id not in Data.connected_structural_members: + Data.load(self.oprops.ifc_definition_id) + + self.data = Data.connected_structural_members[self.oprops.ifc_definition_id] + + for member in self.data: + row = self.layout.row(align=True) + row.label(text=str(member)) + + # row = self.layout.row(align=True) + # if self.data and self.props.is_editing_boundary_condition: + # row.label(text=self.data["type"], icon="CON_TRACKTO") + # row.operator("bim.edit_structural_boundary_condition", text="", icon="CHECKMARK") + # row.operator("bim.disable_editing_structural_boundary_condition", text="", icon="X") + # elif self.data and not self.props.is_editing_boundary_condition: + # row.label(text=self.data["type"], icon="CON_TRACKTO") + # row.operator("bim.enable_editing_structural_boundary_condition", text="", icon="GREASEPENCIL") + # row.operator("bim.remove_structural_boundary_condition", text="", icon="X") + # else: + # row.label(text="No Boundary Condition Found", icon="CON_TRACKTO") + # row.operator("bim.add_structural_boundary_condition", text="", icon="ADD") + + # if self.props.is_editing_boundary_condition: + # self.draw_editable_ui(context) + # else: + # self.draw_read_only_ui(context) + + class BIM_PT_structural_analysis_models(Panel): bl_label = "IFC Structural Analysis Models" bl_idname = "BIM_PT_structural_analysis_models" diff --git a/src/ifcblenderexport/blenderbim/bim/module/structural/unassign_structural_analysis_model.py b/src/ifcblenderexport/blenderbim/bim/module/structural/unassign_structural_analysis_model.py index 4e2bfb2f01..0f1b49290e 100644 --- a/src/ifcblenderexport/blenderbim/bim/module/structural/unassign_structural_analysis_model.py +++ b/src/ifcblenderexport/blenderbim/bim/module/structural/unassign_structural_analysis_model.py @@ -3,7 +3,7 @@ from blenderbim.bim.module.owner.api import update_owner_history class Usecase: - def __init__(self, file, settings=None): + def __init__(self, file, settings={}): self.file = file self.settings = { "product": None,