I want to make multiple copies of a complex mesh and space them apart so that they barely touch. What I have now is a script like this:
import bpy
C = bpy.context
src_obj = bpy.context.active_object
x_size = src_obj.dimensions.x
for i in range (1,5):
new_obj = src_obj.copy()
new_obj.data = src_obj.data.copy()
new_obj.animation_data_clear()
new_obj.location.x += i * x_size
C.collection.objects.link(new_obj)
However, if I rotate the original object around the z axis, x_size doesn't really refer to the x dimensions in world space anymore, so the spacing between the objects is off. How do I get the dimensions along the world space instead?
ob.bound_box. Find min and max values of X in 8 vectors of bounding box. max - min will give you desired result. https://blender.stackexchange.com/a/8470/115433 – Reigen Sep 14 '21 at 05:59