mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 14:02:27 +00:00
added UI to display connections for realizing elements
Example - https://imgur.com/a/1ZZlTwp
This commit is contained in:
@@ -97,7 +97,7 @@ class ConnectionsData:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls):
|
def load(cls):
|
||||||
cls.data = {"connections": cls.connections()}
|
cls.data = {"connections": cls.connections(), "is_connection_realization": cls.is_connection_realization()}
|
||||||
cls.is_loaded = True
|
cls.is_loaded = True
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -132,7 +132,7 @@ class ConnectionsData:
|
|||||||
"Name": related_element.Name or "Unnamed",
|
"Name": related_element.Name or "Unnamed",
|
||||||
"ConnectionType": related_element_connection_type,
|
"ConnectionType": related_element_connection_type,
|
||||||
"realizing_elements": realizing_elements,
|
"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",
|
"Name": relating_element.Name or "Unnamed",
|
||||||
"ConnectionType": relating_element_connection_type,
|
"ConnectionType": relating_element_connection_type,
|
||||||
"realizing_elements": realizing_elements,
|
"realizing_elements": realizing_elements,
|
||||||
"realizing_elements_connection_type": realizing_elements_connection_type
|
"realizing_elements_connection_type": realizing_elements_connection_type,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
return results
|
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:
|
class DerivedPlacementsData:
|
||||||
data = {}
|
data = {}
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ class BIM_PT_connections(Panel):
|
|||||||
layout = self.layout
|
layout = self.layout
|
||||||
props = context.active_object.BIMObjectProperties
|
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")
|
layout.label(text="No connections found")
|
||||||
|
|
||||||
for connection in ConnectionsData.data["connections"]:
|
for connection in ConnectionsData.data["connections"]:
|
||||||
@@ -155,10 +155,34 @@ class BIM_PT_connections(Panel):
|
|||||||
for element in connection["realizing_elements"]:
|
for element in connection["realizing_elements"]:
|
||||||
row = self.layout.row(align=True)
|
row = self.layout.row(align=True)
|
||||||
obj = tool.Ifc.get_object(element)
|
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.label(text=obj.name)
|
||||||
row.operator(
|
|
||||||
"bim.select_entity", text="", icon="RESTRICT_SELECT_OFF"
|
# display connections where element is connection realization
|
||||||
).ifc_id = element.id()
|
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):
|
class BIM_PT_mesh(Panel):
|
||||||
|
|||||||
Reference in New Issue
Block a user