From 48acfad8bb3168031c0c064c687466960d6e8a45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Fri, 7 Mar 2025 15:49:32 -0300 Subject: [PATCH] Fix #6213. Adjust wall clipping from slabs to account for slab offset and direction sense. --- src/bonsai/bonsai/bim/module/model/wall.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/bonsai/bonsai/bim/module/model/wall.py b/src/bonsai/bonsai/bim/module/model/wall.py index 484937b136..13137c48a8 100644 --- a/src/bonsai/bonsai/bim/module/model/wall.py +++ b/src/bonsai/bonsai/bim/module/model/wall.py @@ -1735,7 +1735,18 @@ class DumbWallJoiner: extrusion = self.get_extrusion_data(representation) wall_dir = wall1.matrix_world.to_quaternion() @ extrusion["direction"] - slab_pt = slab2.matrix_world @ Vector((0, 0, 0)) + slab_element = tool.Ifc.get_entity(slab2) + slab_params = tool.Model.get_material_layer_parameters(slab_element) + slab_representation = ifcopenshell.util.representation.get_representation(slab_element, "Model", "Body", "MODEL_VIEW") + assert slab_representation + slab_extrusion = tool.Model.get_extrusion(slab_representation) + existing_x_angle = tool.Model.get_existing_x_angle(slab_extrusion) + existing_x_angle = 0 if tool.Cad.is_x(existing_x_angle, 0, tolerance=0.001) else existing_x_angle + existing_x_angle = 0 if tool.Cad.is_x(existing_x_angle, pi, tolerance=0.001) else existing_x_angle + offset = slab_params["offset"] + if slab_params["direction_sense"] == "NEGATIVE": + offset -= slab_params["thickness"] + slab_pt = slab2.matrix_world @ Vector((0, 0, 0)) + Vector((0, 0, offset * abs(1 / cos(existing_x_angle)))) slab_dir = slab2.matrix_world.to_quaternion() @ Vector((0, 0, -1)) tops = [mathutils.geometry.intersect_line_plane(b, b + wall_dir, slab_pt, slab_dir) for b in bases]