From 581ec2845ae1c7d340038d6483f136f9d57c6f67 Mon Sep 17 00:00:00 2001 From: Damien Picard Date: Sun, 5 Mar 2023 22:02:13 +0100 Subject: [PATCH] Fix #104467: Archimesh boolean doesn't work in 3.5 I introduced the bug in dd91f21836 when I overlooked an error that was caught in a try... expecpt block, where context was not defined. --- archimesh/__init__.py | 2 +- archimesh/achm_main_panel.py | 24 ++++++++++-------------- archimesh/achm_tools.py | 8 +++----- 3 files changed, 14 insertions(+), 20 deletions(-) diff --git a/archimesh/__init__.py b/archimesh/__init__.py index fe48cab53..ef02b271f 100644 --- a/archimesh/__init__.py +++ b/archimesh/__init__.py @@ -11,7 +11,7 @@ bl_info = { "name": "Archimesh", "author": "Antonio Vazquez (antonioya)", "location": "View3D > Add Mesh / Sidebar > Create Tab", - "version": (1, 2, 4), + "version": (1, 2, 5), "blender": (3, 0, 0), "description": "Generate rooms, doors, windows, and other architecture objects", "doc_url": "{BLENDER_MANUAL_URL}/addons/add_mesh/archimesh.html", diff --git a/archimesh/achm_main_panel.py b/archimesh/achm_main_panel.py index 482e26fde..7c8c885a1 100644 --- a/archimesh/achm_main_panel.py +++ b/archimesh/achm_main_panel.py @@ -108,20 +108,16 @@ class ARCHIMESH_OT_Hole(Operator): # --------------------------------------- for child in obj.parent.children: # noinspection PyBroadException - try: - if child["archimesh.ctrl_hole"]: - # apply scale - t = parentobj.RoomGenerator[0].wall_width - if t > 0: - child.scale.y = (t + 0.45) / (child.dimensions.y / child.scale.y) # Add some gap - else: - child.scale.y = 1 - # add boolean modifier - if isboolean(myroom, child) is False: - set_modifier_boolean(myroom, child) - except: - # print("Unexpected error:" + str(sys.exc_info())) - pass + if "archimesh.ctrl_hole" in child and child["archimesh.ctrl_hole"]: + # apply scale + t = parentobj.RoomGenerator[0].wall_width + if t > 0: + child.scale.y = (t + 0.45) / (child.dimensions.y / child.scale.y) # Add some gap + else: + child.scale.y = 1 + # add boolean modifier + if not isboolean(myroom, child): + set_modifier_boolean(myroom, child) # --------------------------------------- # Now add the modifiers to baseboard diff --git a/archimesh/achm_tools.py b/archimesh/achm_tools.py index 59bcb2efd..81f0a7bd0 100644 --- a/archimesh/achm_tools.py +++ b/archimesh/achm_tools.py @@ -172,11 +172,9 @@ def set_modifier_solidify(myobject, width): # Add modifier (boolean) # -------------------------------------------------------------------- def set_modifier_boolean(myobject, bolobject): - bpy.context.view_layer.objects.active = myobject - if bpy.context.view_layer.objects.active.name == myobject.name: - boolean_modifier = context.object.modifiers.new("", 'BOOLEAN') - boolean_modifier.operation = 'DIFFERENCE' - boolean_modifier.object = bolobject + boolean_modifier = myobject.modifiers.new("", 'BOOLEAN') + boolean_modifier.operation = 'DIFFERENCE' + boolean_modifier.object = bolobject # -------------------------------------------------------------------- -- 2.30.2