See #6214. Fix how extrusion existing angle is calculated.

The issue happen when the layer has a negative direction sense.
This commit is contained in:
Bruno Perdigão
2025-02-24 20:28:02 -03:00
parent e46e1512fa
commit ea274588b0
+12 -1
View File
@@ -1981,7 +1981,18 @@ class Model(bonsai.core.tool.Model):
@classmethod
def get_existing_x_angle(cls, extrusion: ifcopenshell.entity_instance) -> float:
x, y, z = extrusion.ExtrudedDirection.DirectionRatios
x_angle = Vector((0, 1)).angle_signed(Vector((y, z)))
vector = Vector((0, 1))
x_angle = vector.angle_signed(Vector((y, z)))
# The extrusion direction is changed by the layer direction change
# So we have to adapt the values of y, z and vector accordingly
if z < 0 and y < 0:
y = abs(y)
z = abs(z)
if z < 0 and y >=0:
vector = Vector((0, -1))
x_angle = vector.angle_signed(Vector((y, z)))
return x_angle