From 0eb70b7fc3c6fc7d0a209c9f25b67a2544063cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Tue, 8 Apr 2025 20:07:46 -0300 Subject: [PATCH] See #6397 - Fix extrusion profile editing issue. Profile transformations now correctly use the perpendicular value of the offset. --- src/bonsai/bonsai/bim/module/model/slab.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/slab.py b/src/bonsai/bonsai/bim/module/model/slab.py index a8f71eb5eb..ab1e8f517e 100644 --- a/src/bonsai/bonsai/bim/module/model/slab.py +++ b/src/bonsai/bonsai/bim/module/model/slab.py @@ -677,8 +677,9 @@ class EnableEditingExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator): # Restore the position to before it was changed by the offset and x_angle rot_matrix = Matrix.Rotation(existing_x_angle, 4, "X") - offset = Vector((0.0, 0.0, -layer_params["offset"])) - rot_offset = offset @ rot_matrix + perpendicular_offset = layer_params["offset"] * abs(1 / cos(existing_x_angle)) + offset_vector = Vector((0.0, 0.0, -perpendicular_offset)) + rot_offset = offset_vector @ rot_matrix tranlation_matrix = Matrix.Translation(rot_offset) position = position @ tranlation_matrix @@ -725,8 +726,9 @@ class EditExtrusionProfile(bpy.types.Operator, tool.Ifc.Operator): # Restore the position to after it was changed by the offset and x_angle rot_matrix = Matrix.Rotation(existing_x_angle, 4, "X") - offset = Vector((0.0, 0.0, -layer_params["offset"])) - rot_offset = offset @ rot_matrix + perpendicular_offset = layer_params["offset"] * abs(1 / cos(existing_x_angle)) + offset_vector = Vector((0.0, 0.0, -perpendicular_offset)) + rot_offset = offset_vector @ rot_matrix tranlation_matrix = Matrix.Translation(rot_offset) position = position @ tranlation_matrix