Public Access
2
0

CIRCLE mode origin now at center X,Y and min Z

This commit is contained in:
2026-04-23 19:25:42 -04:00
parent 9e26aa36d3
commit 376a654f4f
+16 -10
View File
@@ -1,6 +1,7 @@
import bpy
import mathutils
def resolve_to_mesh_objects(obj):
"""Recursively resolve collection instances and linked instances to their source mesh objects."""
if obj.type == 'MESH':
@@ -65,6 +66,7 @@ def calculate_global_bounds(selected_objects):
'size': mathutils.Vector((max_x - min_x, max_y - min_y, max_z - min_z))
}
def create_aligned_boundary_cube(bounds, parent=None, mode=None):
if not bounds:
return None
@@ -91,18 +93,21 @@ def create_aligned_boundary_cube(bounds, parent=None, mode=None):
(0, -size.y, size.z)
]
else:
# CIRCLE mode: origin at bottom-front-left
obj.location = min_v.copy()
# CIRCLE mode: origin at center X,Y, min Z — cube extends equally in all X/Y directions
center_x = (min_v.x + max_v.x) / 2
center_y = (min_v.y + max_v.y) / 2
obj.location = (center_x, center_y, min_v.z)
verts = [
(0, 0, 0),
(size.x, 0, 0),
(size.x, size.y, 0),
(0, size.y, 0),
(0, 0, size.z),
(size.x, 0, size.z),
(size.x, size.y, size.z),
(0, size.y, size.z)
(-size.x / 2, -size.y / 2, 0),
(size.x / 2, -size.y / 2, 0),
(size.x / 2, size.y / 2, 0),
(-size.x / 2, size.y / 2, 0),
(-size.x / 2, -size.y / 2, size.z),
(size.x / 2, -size.y / 2, size.z),
(size.x / 2, size.y / 2, size.z),
(-size.x / 2, size.y / 2, size.z)
]
faces = [
(0, 1, 2, 3), (4, 5, 6, 7), (0, 1, 5, 4),
(1, 2, 6, 5), (2, 3, 7, 6), (3, 0, 4, 7)
@@ -117,5 +122,6 @@ def create_aligned_boundary_cube(bounds, parent=None, mode=None):
return obj
if __name__ == "__main__":
print("Phase 2: Geometry (Origin Alignment) logic loaded.")