From 3690998dbca518f776db6b229d56596758fbcb84 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 23 Aug 2023 23:02:54 +1000 Subject: [PATCH] Fix #3620. Bug where manually inserted windows should preseve the existing Z value. --- .../blenderbim/bim/module/model/opening.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/model/opening.py b/src/blenderbim/blenderbim/bim/module/model/opening.py index ebbc764c79..9c93accf58 100644 --- a/src/blenderbim/blenderbim/bim/module/model/opening.py +++ b/src/blenderbim/blenderbim/bim/module/model/opening.py @@ -70,7 +70,10 @@ class FilledOpeningGenerator: ) if target is None: - target = bpy.context.scene.cursor.location + should_set_z_level = True + target = bpy.context.scene.cursor.location.copy() + else: + should_set_z_level = False # Sometimes, the voided_obj may be an aggregate, which won't have any representation. if voided_obj.data: @@ -86,12 +89,17 @@ class FilledOpeningGenerator: axis = tool.Model.get_wall_axis(voided_obj, layers=layers)["base"] new_matrix = voided_obj.matrix_world.copy() - new_matrix.translation = tool.Cad.point_on_edge(target, axis) + point_on_axis = tool.Cad.point_on_edge(target, axis) + new_matrix.translation.x = point_on_axis.x + new_matrix.translation.y = point_on_axis.y - if filling.is_a("IfcDoor"): - new_matrix.translation.z = voided_obj.matrix_world.translation.z + if should_set_z_level: + if filling.is_a("IfcDoor"): + new_matrix.translation.z = voided_obj.matrix_world.translation.z + else: + new_matrix.translation.z = voided_obj.matrix_world.translation.z + props.rl2 else: - new_matrix.translation.z = voided_obj.matrix_world.translation.z + props.rl2 + new_matrix.translation.z = filling_obj.matrix_world.copy().translation.z filling_obj.matrix_world = new_matrix bpy.context.view_layer.update()