Slabs offset are now measured perpendicularly.
This commit is contained in:
Bruno Perdigão
2025-02-11 10:31:07 -03:00
parent f6087613f0
commit 06c6fa5dff
2 changed files with 8 additions and 14 deletions
+4 -4
View File
@@ -298,8 +298,8 @@ class DumbSlabPlaner:
x, y, z = extrusion.ExtrudedDirection.DirectionRatios
existing_x_angle = tool.Model.get_existing_x_angle(extrusion)
perpendicular_depth = thickness * (1 / cos(existing_x_angle))
offset = layer_params["offset"]
offset_vector = Vector((0.0, 0.0, offset / self.unit_scale))
perpendicular_offset = layer_params["offset"] * (1 / cos(existing_x_angle))
offset_vector = Vector((0.0, 0.0, perpendicular_offset / self.unit_scale))
if layer_params["direction_sense"] == "POSITIVE":
y = abs(y) if existing_x_angle > 0 else -abs(y)
z = abs(z)
@@ -309,8 +309,8 @@ class DumbSlabPlaner:
extrusion.ExtrudedDirection.DirectionRatios = (x, y, z)
extrusion.Depth = perpendicular_depth
if offset != 0.0 and not extrusion.Position:
tool.Model.add_extrusion_position(extrusion, offset)
if perpendicular_offset != 0.0 and not extrusion.Position:
tool.Model.add_extrusion_position(extrusion, perpendicular_offset)
# Update the extrusion's location based on its current rotation angle and offset
if extrusion.Position:
+4 -10
View File
@@ -261,21 +261,15 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator):
# Here we set the extrusion direction to negative if that's the case
x, y, z = extrusion.ExtrudedDirection.DirectionRatios
layer_params = tool.Model.get_material_layer_parameters(element)
offset = layer_params["offset"]
# Change offset to keep the position in relation to the top face of the slab
# The x_angle changes the slab vertical depth, so we have to adapt the offset accordingly
offset -= (extrusion.Depth - perpendicular_depth) * unit_scale
offset_vector = Vector((0.0, 0.0, offset / unit_scale))
perpendicular_offset = layer_params["offset"] * (1 / cos(x_angle))
offset_vector = Vector((0.0, 0.0, perpendicular_offset / unit_scale))
if layer_params["direction_sense"] == "NEGATIVE":
y = -abs(y) if x_angle > 0 else abs(y)
z = -abs(z)
extrusion.ExtrudedDirection.DirectionRatios = (x, y, z)
if offset != 0.0 and not extrusion.Position:
tool.Model.add_extrusion_position(extrusion, offset)
if perpendicular_offset != 0.0 and not extrusion.Position:
tool.Model.add_extrusion_position(extrusion, perpendicular_offset)
# Update the extrusion's location based on its current rotation angle
if extrusion.Position: