From 2609a8293c216763c8a553d15494e846a0607fc8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Perdig=C3=A3o?= Date: Wed, 26 Feb 2025 13:00:11 -0300 Subject: [PATCH] Fix issue where walls are created with obtuse x_angle. See #5938 --- src/bonsai/bonsai/bim/module/model/polyline.py | 1 + .../ifcopenshell/api/geometry/add_wall_representation.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/model/polyline.py b/src/bonsai/bonsai/bim/module/model/polyline.py index 5788bb148f..2af857f663 100644 --- a/src/bonsai/bonsai/bim/module/model/polyline.py +++ b/src/bonsai/bonsai/bim/module/model/polyline.py @@ -85,6 +85,7 @@ def get_wall_preview_data(context, relating_type): if x_angle > radians(90) or x_angle < radians(-90): height *= -1 angle_distance = height * tan(x_angle) + thickness *= 1 / cos(x_angle) data = {} data["verts"] = [] diff --git a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py index 36691a044b..28e0112be9 100644 --- a/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py +++ b/src/ifcopenshell-python/ifcopenshell/api/geometry/add_wall_representation.py @@ -18,7 +18,7 @@ import ifcopenshell.util.element import ifcopenshell.util.unit -from math import sin, cos +from math import sin, cos, pi from typing import Optional, Union, Any from ifcopenshell.util.data import Clipping @@ -112,7 +112,7 @@ class Usecase: self.file.createIfcDirection((1.0, 0.0, 0.0)), ), extrusion_direction, - self.convert_si_to_unit(self.settings["height"]) * (1 / cos(self.settings["x_angle"])), + self.convert_si_to_unit(self.settings["height"]) * abs((1 / cos(self.settings["x_angle"]))), ) if self.settings["booleans"]: extrusion = self.apply_booleans(extrusion)