diff --git a/src/bonsai/bonsai/bim/module/model/wall.py b/src/bonsai/bonsai/bim/module/model/wall.py index a50a47536a..b8ec453037 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -122,6 +122,7 @@ class ExtendWallsToWall(bpy.types.Operator, tool.Ifc.Operator): else: self.report({"ERROR"}, "Please select at least one LAYER2 element and one active LAYER2 element") + class ExtendWallsToPolylinePoint(bpy.types.Operator, PolylineOperator, tool.Ifc.Operator): bl_idname = "bim.extend_walls_to_polyline_point" bl_label = "Extend Walls To Polyline Point" @@ -135,7 +136,7 @@ class ExtendWallsToPolylinePoint(bpy.types.Operator, PolylineOperator, tool.Ifc. for obj in context.selected_objects: if not tool.Ifc.get_entity(obj).is_a("IfcWall"): walls = False - + return bool(context.selected_objects) and is_view_3d and walls def __init__(self): @@ -150,7 +151,7 @@ class ExtendWallsToPolylinePoint(bpy.types.Operator, PolylineOperator, tool.Ifc. start = Vector((axis["reference"][0][0], axis["reference"][0][1], obj.location.z)) end = Vector((axis["reference"][1][0], axis["reference"][1][1], obj.location.z)) direcion = end - start - value = end if connection=="ATSTART" else start + value = end if connection == "ATSTART" else start self.input_ui.set_value("X", value[0]) self.input_ui.set_value("Y", value[1]) self.input_ui.set_value("Z", value[2]) @@ -194,13 +195,10 @@ class ExtendWallsToPolylinePoint(bpy.types.Operator, PolylineOperator, tool.Ifc. if event.value == "RELEASE" and event.type == "F": tool.Polyline.clear_polyline() - self.connection = "ATSTART" if self.connection=="ATEND" else "ATEND" + self.connection = "ATSTART" if self.connection == "ATEND" else "ATEND" self.set_origin(context, event, self.connection) - if ( - event.value == "RELEASE" - and event.type in {"RET", "NUMPAD_ENTER", "RIGHTMOUSE", "LEFTMOUSE"} - ): + if event.value == "RELEASE" and event.type in {"RET", "NUMPAD_ENTER", "RIGHTMOUSE", "LEFTMOUSE"}: if self.tool_state.is_input_on: is_valid = self.recalculate_inputs(context) if is_valid: @@ -235,7 +233,6 @@ class ExtendWallsToPolylinePoint(bpy.types.Operator, PolylineOperator, tool.Ifc. tool.Blender.update_viewport() return {"FINISHED"} - self.handle_keyboard_input(context, event) cancel = self.handle_cancelation(context, event) @@ -256,6 +253,7 @@ class ExtendWallsToPolylinePoint(bpy.types.Operator, PolylineOperator, tool.Ifc. tool.Blender.update_viewport() return {"RUNNING_MODAL"} + class AlignWall(bpy.types.Operator): bl_idname = "bim.align_wall" bl_label = "Align Wall" diff --git a/src/bonsai/bonsai/bim/module/search/operator.py b/src/bonsai/bonsai/bim/module/search/operator.py index ce46498029..d5ab52cc97 100644 --- a/src/bonsai/bonsai/bim/module/search/operator.py +++ b/src/bonsai/bonsai/bim/module/search/operator.py @@ -733,7 +733,7 @@ class SelectSimilar(Operator, tool.Ifc.Operator): objects = context.selected_objects or [context.active_object] if not objects: self.report({"WARNING"}, "No selected or active object found.") - return {'CANCELLED'} + return {"CANCELLED"} for obj in objects: element = tool.Ifc.get_entity(obj) key = self.key diff --git a/src/bonsai/bonsai/core/model.py b/src/bonsai/bonsai/core/model.py index 54fd50aa1e..f162768b0b 100644 --- a/src/bonsai/bonsai/core/model.py +++ b/src/bonsai/bonsai/core/model.py @@ -51,7 +51,7 @@ def extend_walls( joiner: DumbWallJoiner, model: tool.Model, target: Vector, - connection: Optional[str]=None, + connection: Optional[str] = None, ) -> None: """Extend selected walls to the target.""" for obj in blender.get_selected_objects():