mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
A bit more descriptive port UI
Before - https://i.imgur.com/ZhVRoJM.png After - https://i.imgur.com/tI1h2i7.png
This commit is contained in:
@@ -183,15 +183,38 @@ class BIM_PT_port(Panel):
|
||||
|
||||
def draw(self, context):
|
||||
self.props = context.scene.BIMSystemProperties
|
||||
row = self.layout.row(align=True)
|
||||
|
||||
element = tool.Ifc.get_entity(context.active_object)
|
||||
port_class = element.is_a()
|
||||
layout = self.layout
|
||||
row = layout.row(align=True)
|
||||
row.label(text=port_class)
|
||||
row.operator("bim.connect_port", icon="PLUGIN", text="")
|
||||
row.operator("bim.disconnect_port", icon="UNLINKED", text="")
|
||||
row.operator("bim.set_flow_direction", icon="FORWARD", text="").direction = "SOURCE"
|
||||
row.operator("bim.set_flow_direction", icon="BACK", text="").direction = "SINK"
|
||||
row.operator("bim.set_flow_direction", icon="ARROW_LEFTRIGHT", text="").direction = "SOURCEANDSINK"
|
||||
row.operator("bim.set_flow_direction", icon="RESTRICT_INSTANCED_ON", text="").direction = "NOTDEFINED"
|
||||
row.operator("bim.remove_port", icon="X", text="")
|
||||
|
||||
if port_class == "IfcDistributionPort":
|
||||
current_flow_direction = str(element.FlowDirection)
|
||||
row = layout.row(align=True)
|
||||
row.label(text="Flow Direction:")
|
||||
row.label(text=current_flow_direction)
|
||||
|
||||
# TODO: replace with enum property?
|
||||
flow_directions = (
|
||||
("SOURCE", "FORWARD"),
|
||||
("SINK", "BACK"),
|
||||
("SOURCEANDSINK", "ARROW_LEFTRIGHT"),
|
||||
("NOTDEFINED", "RESTRICT_INSTANCED_ON"),
|
||||
)
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.label(text="Change Flow Direction:")
|
||||
for flow_direction, icon in flow_directions:
|
||||
row = layout.row()
|
||||
row.operator("bim.set_flow_direction", icon=icon, text=flow_direction).direction = flow_direction
|
||||
if flow_direction == current_flow_direction:
|
||||
row.enabled = False
|
||||
|
||||
|
||||
class BIM_UL_systems(UIList):
|
||||
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
|
||||
|
||||
Reference in New Issue
Block a user