Align and distribute objects along an axis

Hi!
I was searching how to distribute objects with equal distance each other, for example I have a bunch of letters and wanted to distribute along X axis with an offset of 2 units each other. I have searched a lot and can’t find the way for doing that. Is there a menu or panel I’m missing or any script for doing this?

Thanx!

Oscurart Tools addon allows to distribute equidistantly objects along one or combination of axis.
http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/3D_interaction/Oscurart_Tools

1 Like

Best to use an addon to distribute them but it’s good to know other ways too.

To distribute objects you could use the grid zoom levels in top/right/front views. If you put your zoom level so that the smallest grid you see is 1 blender unit, roughly place the objects and then select them all and shift+S -> selection to grid, you get them N blender units apart of each other.

With python console you could for example


location = C.active_object.location.x
for obj in C.selected_objects:
    obj.location.x = location
    location += 3

to distribute objects along X axis with offset of 3, starting from the active object.

Or if you want to use the text editor to do the same


import bpy

location = bpy.context.active_object.location.x
offset = 3

for obj in bpy.context.selected_objects:
    obj.location.x = location
    location += offset

To align objects, you could use the object menu -> transform -> align objects, or you could scale to 0 along two axes while manipulate center points option is on.
For example if you want to use scaling to align objects with the active object X axis: select objects, enable manipulate center points (alt+comma), active element pivot (alt+period), S to scale, shift+X to exclude X-axis, and 0.

1 Like

Thank you! I’m going to try out that addon right now

Thank you for the info. I’m going to practice that metod too. :smiley:

Hi JA12, the first metod I can’t understand well, I have follow it and doesn’t get anything close to distribute :smiley: but with the python console is very handy and I can offset it the way I wanted. One thing, is there a way to put this into a panel for quicker use? If there is, how to do it?
Thankyou!

That first one is manual way of course. Not very useful with 100 objects but if you only have a few, it’s an option.
You can quickly grab objects by right mouse button click and drag, then place them with LMB. Selection to grid puts the centers on visible grid and you have your objects equal distance apart of each other. Here 2BU:


If you want to have a button on the tool shelf, you’d have to put a class structure with layout in your script and register functions to register/unregister your class. It would also need a operator definition to get input from the operator panel. An addon, basically.
But if you’re going to do that, might as well put more functionality in it.

Not sure why oscuart tools doesn’t take an input. It has a value field instead of getting values from the operator panel but that didn’t do anything. Tried it with 2.69 RC2 r60837, addon straight from the SVN.

(In case you’re not aware, operator panel is on the bottom of the tool shelf and also accessible with F6 key, giving options after a function is executed).

really? No one even is going to mention the array modifier?

Array modifier does not distribute objects, it affects only one object, arraying the mesh (in mesh type objects). Thread starter said he has bunch of letters that need to be distributed so array modifier wouldn’t help in any way.

Now I can see it, thank you, but is not a good solution :smiley:

I think this scape from my knowledge so lets use the console for now. Will copy your script to a txt and will paste when needed.

Playing with Oscurart Ttools I have found that only works distributing objects that aren’t close, if you put all of the objects in the same position and hit distribute button along X axis, you don’t get nothing. :smiley:

Oscurart Tools - if you have a pile of objects - Objects set the distance Distribute then divides. So, pull one object out to set the distance you need; Distribute selected objects.


Thank you very much for the info!