diff --git a/src/blenderbim/blenderbim/bim/module/geometry/data.py b/src/blenderbim/blenderbim/bim/module/geometry/data.py index 6a3ece41c9..22575778d3 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/data.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/data.py @@ -97,7 +97,7 @@ class ConnectionsData: @classmethod def load(cls): - cls.data = {"connections": cls.connections()} + cls.data = {"connections": cls.connections(), "is_connection_realization": cls.is_connection_realization()} cls.is_loaded = True @classmethod @@ -132,7 +132,7 @@ class ConnectionsData: "Name": related_element.Name or "Unnamed", "ConnectionType": related_element_connection_type, "realizing_elements": realizing_elements, - "realizing_elements_connection_type": realizing_elements_connection_type + "realizing_elements_connection_type": realizing_elements_connection_type, } ) @@ -160,12 +160,29 @@ class ConnectionsData: "Name": relating_element.Name or "Unnamed", "ConnectionType": relating_element_connection_type, "realizing_elements": realizing_elements, - "realizing_elements_connection_type": realizing_elements_connection_type + "realizing_elements_connection_type": realizing_elements_connection_type, } ) return results + @classmethod + def is_connection_realization(cls): + element = tool.Ifc.get_entity(bpy.context.active_object) + connections = element.IsConnectionRealization + if not connections: + return + + results = [] + for rel in connections: + data = { + "realizing_elements_connection_type": rel.ConnectionType, + "connected_from": rel.RelatingElement, + "connected_to": rel.RelatedElement, + } + results.append(data) + return results + class DerivedPlacementsData: data = {} diff --git a/src/blenderbim/blenderbim/bim/module/geometry/ui.py b/src/blenderbim/blenderbim/bim/module/geometry/ui.py index 69520f7a51..92a8167443 100644 --- a/src/blenderbim/blenderbim/bim/module/geometry/ui.py +++ b/src/blenderbim/blenderbim/bim/module/geometry/ui.py @@ -134,7 +134,7 @@ class BIM_PT_connections(Panel): layout = self.layout props = context.active_object.BIMObjectProperties - if not ConnectionsData.data["connections"]: + if not ConnectionsData.data["connections"] and not ConnectionsData.data["is_connection_realization"]: layout.label(text="No connections found") for connection in ConnectionsData.data["connections"]: @@ -151,14 +151,38 @@ class BIM_PT_connections(Panel): connection_type = connection["realizing_elements_connection_type"] connection_type = f" ({connection_type})" if connection_type else "" row.label(text=f"Realizing elements{connection_type}:") - + for element in connection["realizing_elements"]: row = self.layout.row(align=True) obj = tool.Ifc.get_object(element) + row.operator("bim.select_entity", text="", icon="RESTRICT_SELECT_OFF").ifc_id = element.id() row.label(text=obj.name) - row.operator( - "bim.select_entity", text="", icon="RESTRICT_SELECT_OFF" - ).ifc_id = element.id() + + # display connections where element is connection realization + connections = ConnectionsData.data["is_connection_realization"] + if not connections: + return + + row = self.layout.row(align=True) + row.label(text="Element is connections realization:") + for connection in connections: + # NOTE: not displayed yet + connection_type = connection["realizing_elements_connection_type"] + connection_type = f" ({connection_type})" if connection_type else "" + + row = self.layout.row(align=True) + + connected_from = connection["connected_from"] + obj = tool.Ifc.get_object(connected_from) + row.operator("bim.select_entity", text="", icon="RESTRICT_SELECT_OFF").ifc_id = connected_from.id() + row.label(text=obj.name) + + row.label(text="", icon="FORWARD") + + connected_to = connection["connected_to"] + obj = tool.Ifc.get_object(connected_to) + row.operator("bim.select_entity", text="", icon="RESTRICT_SELECT_OFF").ifc_id = connected_to.id() + row.label(text=obj.name) class BIM_PT_mesh(Panel):