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() bm.verts.ensure_lookup_table()
if x_angle: if x_angle:
rot_mat = Matrix.Rotation(x_angle, 3, "X") 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)) 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) 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) 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": if layer_params["direction_sense"] == "NEGATIVE":
direction_ratios *= -1 direction_ratios *= -1
# offset_direction *= -1 # offset_direction *= -1
elif (abs(existing_x_angle )> (pi / 2) and direction_ratios.z > 0) or ( elif (abs(existing_x_angle) > (pi / 2) and direction_ratios.z > 0) or (
abs(existing_x_angle )< (pi / 2) and direction_ratios.z < 0 abs(existing_x_angle) < (pi / 2) and direction_ratios.z < 0
): ):
# The extrusion direction is negative. If the layer_parameter is set to positive, # The extrusion direction is negative. If the layer_parameter is set to positive,
# then the we change the extrusion direction. # 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": if tool.Model.get_usage_type(element) == "LAYER3":
# Reset the transformation and returns to the original points with 0 degrees # Reset the transformation and returns to the original points with 0 degrees
extrusion.SweptArea.OuterCurve.Points.CoordList = [ 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 # 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((0.0, sin(x_angle), cos(x_angle)))
# direction_ratios = Vector(extrusion.ExtrudedDirection.DirectionRatios) # direction_ratios = Vector(extrusion.ExtrudedDirection.DirectionRatios)
layer_params = tool.Model.get_material_layer_parameters(element) 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 perpendicular_offset = layer_params["offset"] * abs(1 / cos(x_angle)) / unit_scale
offset_direction = direction_ratios.copy() offset_direction = direction_ratios.copy()
+2 -2
View File
@@ -1044,7 +1044,7 @@ class Loader(bonsai.core.tool.Loader):
prev_co = None prev_co = None
co = Vector((0.0, offset, 0.0)) co = Vector((0.0, offset, 0.0))
# no = Vector((0.0, 1.0, 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 # Cache this
body = ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Body", "MODEL_VIEW") body = ifcopenshell.util.representation.get_context(tool.Ifc.get(), "Model", "Body", "MODEL_VIEW")
styles = {} styles = {}
@@ -1097,7 +1097,7 @@ class Loader(bonsai.core.tool.Loader):
for item in ifcopenshell.util.representation.resolve_representation(body).Items: for item in ifcopenshell.util.representation.resolve_representation(body).Items:
if item.is_a("IfcExtrudedAreaSolid"): if item.is_a("IfcExtrudedAreaSolid"):
return Vector(item.ExtrudedDirection.DirectionRatios) return Vector(item.ExtrudedDirection.DirectionRatios)
return Vector([0., 0., 1.]) return Vector([0.0, 0.0, 1.0])
@classmethod @classmethod
def create_mesh_from_shape( def create_mesh_from_shape(
-1
View File
@@ -171,7 +171,6 @@ class Raycast(bonsai.core.tool.Raycast):
print("empty", snap_point) print("empty", snap_point)
return points return points
if not custom_bmesh: if not custom_bmesh:
bm = bmesh.new() bm = bmesh.new()
if face is None: # Object without faces if face is None: # Object without faces
@@ -98,7 +98,7 @@ class Usecase:
else: else:
direction_ratios = (0.0, 0.0, 1.0) 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) extrusion_direction = self.file.createIfcDirection(direction_ratios)
if self.settings["direction_sense"] == "NEGATIVE": if self.settings["direction_sense"] == "NEGATIVE":
direction_ratios = tuple((-n for n in direction_ratios)) direction_ratios = tuple((-n for n in direction_ratios))