mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 18:16:40 +00:00
Made door / window preview both simpler and more intuitive
This commit is contained in:
committed by
Ryan Schultz
parent
db8bbb9a6e
commit
babc73d057
@@ -298,15 +298,8 @@ class FilledOpeningGenerator:
|
||||
new_matrix.translation.x = point_on_base_axis.x
|
||||
new_matrix.translation.y = point_on_base_axis.y
|
||||
else:
|
||||
filling_min_x = min([p[0] for p in filling_obj.bound_box])
|
||||
filling_max_x = max([p[0] for p in filling_obj.bound_box])
|
||||
|
||||
# offset that results in the same x extents when the model is rotated 180 degrees
|
||||
filling_opposite_x = filling_max_x + filling_min_x
|
||||
|
||||
offset_dir = voided_obj.matrix_world @ Vector((filling_opposite_x, 0, 0, 0))
|
||||
new_matrix.translation.x = point_on_side_axis.x + offset_dir.x
|
||||
new_matrix.translation.y = point_on_side_axis.y + offset_dir.y
|
||||
new_matrix.translation.x = point_on_side_axis.x
|
||||
new_matrix.translation.y = point_on_side_axis.y
|
||||
new_matrix = new_matrix @ Euler((0, 0, radians(180.0))).to_matrix().to_4x4()
|
||||
|
||||
if should_set_z_level:
|
||||
|
||||
@@ -531,7 +531,6 @@ def get_generic_product_preview_data(context, relating_type):
|
||||
snap_obj = bpy.data.objects.get(snap_prop.snap_object)
|
||||
snap_element = tool.Ifc.get_entity(snap_obj)
|
||||
rot_mat = Quaternion()
|
||||
invert_x = False
|
||||
if relating_type.is_a() in [ "IfcDoorType", "IfcWindowType" ] and snap_element and snap_element.is_a("IfcWall"):
|
||||
layers = tool.Model.get_material_layer_parameters(snap_element)
|
||||
axes = tool.Model.get_wall_axis(snap_obj, layers=layers)
|
||||
@@ -545,7 +544,6 @@ def get_generic_product_preview_data(context, relating_type):
|
||||
else:
|
||||
# mouse is snapped to the side axis, the preview is inverted, rotate it now and correct x position later
|
||||
rot_mat = snap_obj.matrix_world.to_quaternion() @ Quaternion(Vector((0, 0, 1)), radians(180))
|
||||
invert_x = True
|
||||
|
||||
mouse_point.z = snap_obj.matrix_world.translation.z
|
||||
|
||||
@@ -553,12 +551,6 @@ def get_generic_product_preview_data(context, relating_type):
|
||||
if obj_type.data:
|
||||
data = ItemDecorator.get_obj_data(obj_type)
|
||||
data["verts"] = [tuple(obj_type.matrix_world.inverted() @ Vector(v)) for v in data["verts"]]
|
||||
if invert_x:
|
||||
# correct the x position so that the inverted object occupies the same x extents
|
||||
min_x = min([p[0] for p in data["verts"]])
|
||||
max_x = max([p[0] for p in data["verts"]])
|
||||
offset_x = max_x + min_x
|
||||
data["verts"] = [tuple(Vector(v) - Vector((offset_x, 0, 0))) for v in data["verts"]]
|
||||
data["verts"] = [tuple(rot_mat @ (Vector((v[0], v[1], (v[2] + rl)))) + mouse_point) for v in data["verts"]]
|
||||
|
||||
return data
|
||||
|
||||
Reference in New Issue
Block a user