From 50d00eba2031a2b571fd391d49394bd570868fa5 Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Wed, 4 Feb 2026 18:00:07 +0500 Subject: [PATCH] black . --- src/bonsai/bonsai/bim/module/model/profile.py | 3 +-- src/bonsai/bonsai/bim/module/project/prop.py | 2 +- src/bonsai/bonsai/bim/module/root/data.py | 4 ++-- src/bonsai/bonsai/bim/module/root/operator.py | 4 +++- src/bonsai/bonsai/bim/module/system/operator.py | 17 ++++++++--------- src/bonsai/bonsai/bim/module/system/ui.py | 4 +++- 6 files changed, 18 insertions(+), 16 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/profile.py b/src/bonsai/bonsai/bim/module/model/profile.py index 0a11fa191b..572898c484 100644 --- a/src/bonsai/bonsai/bim/module/model/profile.py +++ b/src/bonsai/bonsai/bim/module/model/profile.py @@ -1136,8 +1136,7 @@ class DrawPolylineProfile(bpy.types.Operator, PolylineOperator, tool.Ifc.Operato DumbProfileJoiner().join_V(profile2["obj"], profile1["obj"]) if connect_IfcFlowSegments: bpy.ops.bim.mep_connect_elements( - obj1_name=profile1["obj"].name, - obj2_name=profile2["obj"].name + obj1_name=profile1["obj"].name, obj2_name=profile2["obj"].name ) def modal(self, context, event): diff --git a/src/bonsai/bonsai/bim/module/project/prop.py b/src/bonsai/bonsai/bim/module/project/prop.py index 1c62c98d61..08859af1f9 100644 --- a/src/bonsai/bonsai/bim/module/project/prop.py +++ b/src/bonsai/bonsai/bim/module/project/prop.py @@ -370,7 +370,7 @@ class BIMProjectProperties(PropertyGroup): load_indexed_maps: BoolProperty( name="Load Indexed Maps", description="Load indexed maps (UV and color maps)", - default=False, # Very slow and hackishly implemented + default=False, # Very slow and hackishly implemented ) links: CollectionProperty(name="Links", type=Link) active_link_index: IntProperty(name="Active Link Index") diff --git a/src/bonsai/bonsai/bim/module/root/data.py b/src/bonsai/bonsai/bim/module/root/data.py index 50f3248d8f..7adf7b5fb9 100644 --- a/src/bonsai/bonsai/bim/module/root/data.py +++ b/src/bonsai/bonsai/bim/module/root/data.py @@ -172,7 +172,7 @@ class IfcClassData: ), ) ) - if (ifc_class and "IfcCableCarrierSegment" in ifc_class): + if ifc_class and "IfcCableCarrierSegment" in ifc_class: templates.extend( ( ( @@ -182,7 +182,7 @@ class IfcClassData: ), ) ) - + if ifc_class.endswith("Type") or ifc_class.endswith("Style"): templates.extend( [ diff --git a/src/bonsai/bonsai/bim/module/root/operator.py b/src/bonsai/bonsai/bim/module/root/operator.py index 983429d311..ac766172bd 100644 --- a/src/bonsai/bonsai/bim/module/root/operator.py +++ b/src/bonsai/bonsai/bim/module/root/operator.py @@ -703,7 +703,9 @@ class AddElement(bpy.types.Operator, tool.Ifc.Operator): default_thickness = 0.005 default_inner_fillet_radius = 0.005 default_outer_fillet_radius = 0.005 - profile_name = f"{props.ifc_class}-{default_x_dim*1000}x{default_y_dim*1000}x{default_thickness*1000}" + profile_name = ( + f"{props.ifc_class}-{default_x_dim*1000}x{default_y_dim*1000}x{default_thickness*1000}" + ) profile = tool.Ifc.get().create_entity( "IfcRectangleHollowProfileDef", ProfileName=profile_name, diff --git a/src/bonsai/bonsai/bim/module/system/operator.py b/src/bonsai/bonsai/bim/module/system/operator.py index 18e8d91d88..089bd9f24b 100644 --- a/src/bonsai/bonsai/bim/module/system/operator.py +++ b/src/bonsai/bonsai/bim/module/system/operator.py @@ -488,12 +488,11 @@ class EstablishPathDirection(bpy.types.Operator, tool.Ifc.Operator): def _execute(self, context): connected_port = tool.Ifc.get().by_id(self.port_id) - - + if not connected_port or not connected_port.is_a("IfcDistributionPort"): self.report({"ERROR"}, "Invalid port specified.") return {"CANCELLED"} - + direction_map = { "SOURCE": "SINK", "SINK": "SOURCE", @@ -503,28 +502,28 @@ class EstablishPathDirection(bpy.types.Operator, tool.Ifc.Operator): next_element = tool.System.get_port_relating_element(connected_port) ports = tool.System.get_ports(next_element) segments_processed = 0 - while (len(ports) == 2): + while len(ports) == 2: if ports[0].id() == connected_port.id(): other_port = ports[1] else: other_port = ports[0] - + new_direction = direction_map.get(connected_port.FlowDirection, "NOTDEFINED") other_port.FlowDirection = new_direction segments_processed += 1 - + connected_port = tool.System.get_connected_port(other_port) if not connected_port: break connected_port.FlowDirection = direction_map.get(other_port.FlowDirection, "NOTDEFINED") next_element = tool.System.get_port_relating_element(connected_port) - + if not next_element.is_a("IfcFlowSegment"): print(f"DEBUG: next_element is not IfcFlowSegment, stopping") break - + ports = tool.System.get_ports(next_element) - + self.report({"INFO"}, f"Established path direction through {segments_processed} flow segment(s).") return {"FINISHED"} diff --git a/src/bonsai/bonsai/bim/module/system/ui.py b/src/bonsai/bonsai/bim/module/system/ui.py index a3d73c10f6..e8f8b7daeb 100644 --- a/src/bonsai/bonsai/bim/module/system/ui.py +++ b/src/bonsai/bonsai/bim/module/system/ui.py @@ -333,7 +333,9 @@ class BIM_PT_port(Panel): else: cols[7].label(text="", icon="BLANK1") cols[8].label(text="") - cols[9].operator("bim.establish_path_direction", text="", icon="CON_FOLLOWPATH").port_id = connected_port.id() + cols[9].operator("bim.establish_path_direction", text="", icon="CON_FOLLOWPATH").port_id = ( + connected_port.id() + ) else: cols[4].label(text="", icon="BLANK1") cols[5].label(text="", icon="BLANK1")