NEW: Aligner/Displacer/Randomizer Script

Here is my very first Python script with a GUI called Object Aligner/Displacer:

[>]Download the .zip file

Contents (3 files): README.TXT, aligndisplacerscript.py, sample.blend

This script can do several things:

  • Align selected objects by LocX, LocY, or LocZ, or all Loc XYZ to the last selected object.

  • Resize objects according to the SizeX, SizeY, or SizeZ, or all Size XYZ of the last selected object.

  • Rotate objects according to the RotX, RotY, RotZ, or all Rot XYZ of the last selected object.

  • Randomly relocate 1 or more selected objects by LocX, LocY, or LocZ, or all Loc XYZ (reloacte all selected objects)

  • Randomly resize 1 or more selected objects by SizeX, SizeY, or SizeY, or all Size XYZ (resize all selected objects)

  • Randomly rotate 1 or more selected objects by RotX, RotY, or RotZ, or all Rot XYZ (rerotate all selected objects)

  • Relocate 1 or more selected objects to 0,0,0 coordinates (center of Blender universe)

  • Resize 1 or more selected objects to default primitive size (SizeX/Y/Z=1)

  • Zero X/Y/Z rotation for 1 or more selected objects

A full Python install is assumed. This was designed and tested in Blender 2.31 for Windows. It may not work in other versions. Be sure to read the README.TXT file before using it.

What can this be used for? If you’ve ever wanted to conveniently align a bunch of objects along the x y or z axis of another object you can do that with this. If you’ve ever needed to scatter a bunch of objects or orient objects in the same direction of another object, this script lets you do that. If you’ve ever wanted to make several objects the same size as another, you can also do that. Conversely, if you’ve ever wanted to introduce randomness to a bunch of similar objects you can now do that as well for location, size, and rotation.

Check out the sample.blend file included in the .zip to try out the script safely before attempting to use elsewhere. The script only modifies active data, not the .blend file itself, so unless you like what the script has done don’t save the changes. Reload the file and try again.

A history of object transformations is printed in the Blender console window with each new change introduced. If you’re attempting to change dozens of objects at once there may be a delay as the active object data gets updated and the objects themselves get redrawn in the 3D View.

Well, I wrote this mostly to learn about Python, but I thought it might be useful to someone out there, so here it is :slight_smile:

If you get a chance to try it let me know what you think. Thanks!

RobertT

OK OK, so I spend a high number of hours setting up an asteroid field, resizing, rotating, alighning, and then you release this script :o :o :smiley: :smiley:
Thanks :smiley: :smiley: , because I corrupted my save file and had to do it all again, but I used your script and it only took about half an hour.

Ken

C O O O L :smiley:

I’m so glad I posted this then! :smiley: Thanks for letting me know this worked! (big sigh of relief) :stuck_out_tongue:

RobertT

Sweet man! Very cool idea! I will test and get back to you. This sort of thing would be sweet to have built into blender. Then, perhaps it could be applied to dupliverts. This would be sweet for snow and rain if you used a partical system.

good going!

dante

FREKEN Sweet!

This this mad happy Chaos.
It will go great with Beast Hair and fur gen when that comes out.

Feature request. Chaos as an Extrude. That could make some freeky trees.

Thankyou ^v^

Way cool, robert. I didn’t even realize you knew Python. I think I better get on the ball, and learn some myself. :smiley:

Hey, this is a fantastic script.

Create falling leaves, feathers etc. Or exploding objects, the list goes on and on…

What would be nice … :wink: is… a duplicate x number of times for a selected object before applying the transforms. This will save me doing a 100 odd shift D’s

Laziness = technology hehehehe. and talent of course, in your case.

Cheers

Thanks, soletread, for the nice comments :slight_smile:

Have you tried dupliverts? All you’d have to do is set up something like add a mesh grid (e.g. 10 x 10), select the object you want duplicated then select the grid, press CTRL P (this makes the grid the parent of the object). Next, select just the grid. In the Object window click the DupliVerts button. You should then see a bunch of objects. They may overlap. This isn’t a problem just yet. They don’t really exist, since they’re “dupliverted” objects. Press CTRL + SHIFT + A and click the “make dupli’s real” prompt. You now have real clones of your object.

But now you need to move them around. Now you load the align/displace script. Split your window if it isn’t already so you can see both the script GUI and the 3D View. Run the script (ALT + P). Select all the “dupli’s made real” objects. You can select a bunch at a time by pressing the B key and highlighting them with the rectangular selector. Once they’ve been selected and the script is running click the Rand LocXYZ button to scatter them in the X, Y, Z directions.

Alternately you may only want to shift them around the X or Y axis, in which case you simply click the Rand LocX or Rand LocY button. At this point clicking any of those Rand buttons will only shift the selected objects around a little bit until you adjust the Randomize range. You’ll have to adjust the Randomize range and click the Rand LocXYZ (or LocX or LocY) button several times to get something close to what you need. Further manual adjustment of objects may be necessary, but at this point most of the hard work should be done.

I hope that helps :slight_smile:

Thanks for trying the script!

RobertT

Dupliverts will work yes. of course.

I can then make their location identical with your script, yes? All at 0,0,0

Thats fine then.

THanks for the tip. Off to make that autumn scene

Cheers

Definitely :slight_smile: Just select all objects then click the “SetLoc: 0,0,0” button.

If you ever need to spread the objects apart, just increase the Randomize range button and click any of the appropriate Rand LocX/Y/Z/XYZ buttons :wink:

RobertT

Ok great, thanks once again for the time saver…

Hello

Such a script it will be very useful, but i can’t get it to work under Linux.
Some tips, anyone??
Thanks
Bye

Tip number one: GIVE INFORMATION!!!

What is the problem? (Saying “it don’t work” doesn’t quite cut it…)
What version of Blender?
What’s in the console window?
What version of Python are you using?

Hello and…sorry…

Well I want to know if it works under Linux, and if YES,
well, some help.
Blender 2.31a with Mandrake 9.2/Python 2.3
I’ve setted the Python path correctly …i guess…
i have a problem with the “import ramdom” line
Thanks

It seems that whrandom has been deprecated in your installed version of Python.

If you could possibly edit the line in the Blender text window so it reads “import random from random” instead of “whrandom from random” please let me know if that gets the script running. I’ll update my script if it does. Thanks!

RobertT

wrandom is indeed deprecated

hey great script dude.

That’s what I was dreaming about…
Is there possibility to change the script the way it would be able to allow randomisation by range smaller than 1.0 (0.1, 0.01 i.e)?
Anybody know how to do it?

Works great!

maybe possible to build in a drop to object function?

thanks

P

Please don’t resurrect 3-year old threads…

Still, nice to hear the script still works…