mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
Systems UI - display icons for each system type in the dropdown
Example - https://files.catbox.moe/rnyuro.png
This commit is contained in:
@@ -57,9 +57,9 @@ class SystemData:
|
||||
|
||||
# We're only interested in systems for services. Not sure why IFC groups these together.
|
||||
return [
|
||||
(c, c, get_entity_doc(version, c).get("description", ""))
|
||||
for c in sorted([d.name() for d in declarations])
|
||||
if c not in ("IfcStructuralAnalysisModel")
|
||||
(c, c, get_entity_doc(version, c).get("description", ""), tool.System.SYSTEM_ICONS[c], i)
|
||||
for i, c in enumerate(sorted([d.name() for d in declarations]))
|
||||
if c != "IfcStructuralAnalysisModel"
|
||||
]
|
||||
|
||||
@classmethod
|
||||
|
||||
@@ -36,16 +36,6 @@ FLOW_DIRECTION_TO_ICON = {
|
||||
"NOTDEFINED": "CHECKBOX_DEHLT",
|
||||
}
|
||||
|
||||
SYSTEM_ICONS = {
|
||||
"IfcSystem": "EXTERNAL_DRIVE",
|
||||
"IfcDistributionSystem": "NETWORK_DRIVE",
|
||||
"IfcDistributionCircuit": "DRIVER",
|
||||
"IfcBuildingSystem": "MOD_BUILD",
|
||||
"IfcBuiltSystem": "MOD_BUILD",
|
||||
"IfcZone": "CUBE",
|
||||
}
|
||||
SYSTEM_ICONS["IfcElectricalCircuit"] = SYSTEM_ICONS["IfcDistributionCircuit"]
|
||||
|
||||
|
||||
class BIM_PT_systems(Panel):
|
||||
bl_label = "Systems"
|
||||
@@ -446,7 +436,7 @@ class BIM_UL_systems(UIList):
|
||||
op.option = "COLLAPSE" if item.is_expanded else "EXPAND"
|
||||
if data.edited_system_id == system_id:
|
||||
row.label(text="", icon="GREASEPENCIL")
|
||||
row.prop(item, "name", text="", icon=SYSTEM_ICONS[item.ifc_class], emboss=False)
|
||||
row.prop(item, "name", text="", icon=tool.System.SYSTEM_ICONS[item.ifc_class], emboss=False)
|
||||
|
||||
|
||||
class BIM_UL_zones(UIList):
|
||||
|
||||
@@ -48,6 +48,16 @@ class System(bonsai.core.tool.System):
|
||||
def get_zone_props(cls) -> BIMZoneProperties:
|
||||
return bpy.context.scene.BIMZoneProperties
|
||||
|
||||
SYSTEM_ICONS = {
|
||||
"IfcSystem": "EXTERNAL_DRIVE",
|
||||
"IfcDistributionSystem": "NETWORK_DRIVE",
|
||||
"IfcDistributionCircuit": "DRIVER",
|
||||
"IfcBuildingSystem": "MOD_BUILD",
|
||||
"IfcBuiltSystem": "MOD_BUILD",
|
||||
"IfcZone": "CUBE",
|
||||
}
|
||||
SYSTEM_ICONS["IfcElectricalCircuit"] = SYSTEM_ICONS["IfcDistributionCircuit"]
|
||||
|
||||
@classmethod
|
||||
def add_ports(
|
||||
cls,
|
||||
@@ -430,10 +440,8 @@ class System(bonsai.core.tool.System):
|
||||
|
||||
@classmethod
|
||||
def draw_system_ui(cls, layout: bpy.types.UILayout, system_id: int, system_name: str, system_class: str) -> None:
|
||||
from bonsai.bim.module.system.ui import SYSTEM_ICONS
|
||||
|
||||
row = layout.row(align=True)
|
||||
row.label(text=system_name, icon=SYSTEM_ICONS[system_class])
|
||||
row.label(text=system_name, icon=cls.SYSTEM_ICONS[system_class])
|
||||
op = row.operator("bim.select_system_products", text="", icon="RESTRICT_SELECT_OFF")
|
||||
op.system = system_id
|
||||
op = row.operator("bim.unassign_system", text="", icon="X")
|
||||
|
||||
Reference in New Issue
Block a user