This commit is contained in:
Andrej730
2025-03-05 18:53:50 +05:00
parent 4c97cc8a41
commit e1e51cbf26
6 changed files with 9 additions and 9 deletions
@@ -239,7 +239,7 @@ def get_slab_preview_data(context, relating_type):
bm.verts.ensure_lookup_table()
if x_angle:
rot_mat = Matrix.Rotation(x_angle, 3, "X")
if abs(x_angle) > (pi/2):
if abs(x_angle) > (pi / 2):
rot_mat = rot_mat @ Matrix.Scale(-1, 3, (0, 1, 0))
bmesh.ops.rotate(bm, cent=Vector(bm.verts[0].co), verts=bm.verts, matrix=rot_mat)
new_faces = bmesh.ops.contextual_create(bm, geom=bm.edges)
+2 -2
View File
@@ -313,8 +313,8 @@ class DumbSlabPlaner:
if layer_params["direction_sense"] == "NEGATIVE":
direction_ratios *= -1
# offset_direction *= -1
elif (abs(existing_x_angle )> (pi / 2) and direction_ratios.z > 0) or (
abs(existing_x_angle )< (pi / 2) and direction_ratios.z < 0
elif (abs(existing_x_angle) > (pi / 2) and direction_ratios.z > 0) or (
abs(existing_x_angle) < (pi / 2) and direction_ratios.z < 0
):
# The extrusion direction is negative. If the layer_parameter is set to positive,
# then the we change the extrusion direction.
+3 -2
View File
@@ -248,7 +248,8 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator):
if tool.Model.get_usage_type(element) == "LAYER3":
# Reset the transformation and returns to the original points with 0 degrees
extrusion.SweptArea.OuterCurve.Points.CoordList = [
(p[0], p[1] * abs(cos(existing_x_angle))) for p in extrusion.SweptArea.OuterCurve.Points.CoordList
(p[0], p[1] * abs(cos(existing_x_angle)))
for p in extrusion.SweptArea.OuterCurve.Points.CoordList
]
# Apply the transformation for the new x_angle
@@ -261,7 +262,7 @@ class ChangeExtrusionXAngle(bpy.types.Operator, tool.Ifc.Operator):
direction_ratios = Vector((0.0, sin(x_angle), cos(x_angle)))
# direction_ratios = Vector(extrusion.ExtrudedDirection.DirectionRatios)
layer_params = tool.Model.get_material_layer_parameters(element)
perpendicular_depth= layer_params["thickness"] * abs(1 / cos(x_angle)) / unit_scale
perpendicular_depth = layer_params["thickness"] * abs(1 / cos(x_angle)) / unit_scale
perpendicular_offset = layer_params["offset"] * abs(1 / cos(x_angle)) / unit_scale
offset_direction = direction_ratios.copy()
+2 -2
View File
@@ -1044,7 +1044,7 @@ class Loader(bonsai.core.tool.Loader):
prev_co = None
co = Vector((0.0, offset, 0.0))
# no = Vector((0.0, 1.0, 0.0))
no = (cls.get_extrusion_vector(element).cross(Vector([1., 0., 0.]))).normalized()
no = (cls.get_extrusion_vector(element).cross(Vector([1.0, 0.0, 0.0]))).normalized()
# Cache this
body = ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Body", "MODEL_VIEW")
styles = {}
@@ -1097,7 +1097,7 @@ class Loader(bonsai.core.tool.Loader):
for item in ifcopenshell.util.representation.resolve_representation(body).Items:
if item.is_a("IfcExtrudedAreaSolid"):
return Vector(item.ExtrudedDirection.DirectionRatios)
return Vector([0., 0., 1.])
return Vector([0.0, 0.0, 1.0])
@classmethod
def create_mesh_from_shape(
-1
View File
@@ -171,7 +171,6 @@ class Raycast(bonsai.core.tool.Raycast):
print("empty", snap_point)
return points
if not custom_bmesh:
bm = bmesh.new()
if face is None: # Object without faces
@@ -98,7 +98,7 @@ class Usecase:
else:
direction_ratios = (0.0, 0.0, 1.0)
offset_direction = direction_ratios # offset direction doesn't change if direction_sense is negative
offset_direction = direction_ratios # offset direction doesn't change if direction_sense is negative
extrusion_direction = self.file.createIfcDirection(direction_ratios)
if self.settings["direction_sense"] == "NEGATIVE":
direction_ratios = tuple((-n for n in direction_ratios))