Added small UI to show realizing elements for the connections

Example - https://i.imgur.com/JLDcnbK.png
This commit is contained in:
Andrej730
2023-08-23 18:21:43 +05:00
parent 2ccc9d886e
commit 12b5a88861
2 changed files with 32 additions and 2 deletions
@@ -114,7 +114,13 @@ class ConnectionsData:
else:
related_element = rel.RelatedElement
if element.is_a("IfcRelConnectsPathElements"):
realizing_elements = []
realizing_elements_connection_type = ""
if rel.is_a("IfcRelConnectsWithRealizingElements"):
realizing_elements.extend(rel.RealizingElements)
realizing_elements_connection_type = rel.ConnectionType
if rel.is_a("IfcRelConnectsPathElements"):
related_element_connection_type = rel.RelatedConnectionType
else:
related_element_connection_type = ""
@@ -125,6 +131,8 @@ class ConnectionsData:
"is_relating": True,
"Name": related_element.Name or "Unnamed",
"ConnectionType": related_element_connection_type,
"realizing_elements": realizing_elements,
"realizing_elements_connection_type": realizing_elements_connection_type
}
)
@@ -134,7 +142,13 @@ class ConnectionsData:
else:
relating_element = rel.RelatingElement
if element.is_a("IfcRelConnectsPathElements"):
realizing_elements = []
realizing_elements_connection_type = ""
if rel.is_a("IfcRelConnectsWithRealizingElements"):
realizing_elements.extend(rel.RealizingElements)
realizing_elements_connection_type = rel.ConnectionType
if rel.is_a("IfcRelConnectsPathElements"):
relating_element_connection_type = rel.RelatingConnectionType
else:
relating_element_connection_type = ""
@@ -145,6 +159,8 @@ class ConnectionsData:
"is_relating": False,
"Name": relating_element.Name or "Unnamed",
"ConnectionType": relating_element_connection_type,
"realizing_elements": realizing_elements,
"realizing_elements_connection_type": realizing_elements_connection_type
}
)
@@ -146,6 +146,20 @@ class BIM_PT_connections(Panel):
op = row.operator("bim.remove_connection", icon="X", text="")
op.connection = connection["id"]
if connection["realizing_elements"]:
row = self.layout.row(align=True)
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.label(text=obj.name)
row.operator(
"bim.select_entity", text="", icon="RESTRICT_SELECT_OFF"
).ifc_id = element.id()
class BIM_PT_mesh(Panel):
bl_label = "Representation Utilities"