Grouping objects

 From:  Hamish Mead (HAIRYKIWI)
7327.3 
Hi Peter,

The Match Object Name (V2) script made by Michael a few years back may be of help. (I've been using it ever since.)
http://moi3d.com/forum/messages.php?webtag=MOI&msg=3375.1

It's also available on http://kyticka.webzdarma.cz/3d/moi/ - and copied here:

MatchObjectNameV2 – the script works purely off of selection – to use it you must make a combined selection that includes at least one of the objects that already has the name assigned to it, along with other unnamed objects that you want to have assigned to that same name.
When you have a selection set up like that, then push the shortcut key and it will assign the unnamed objects to have that same name.
You can use the Scene browser to help you make the selection – right click on the object name in the scene browser to make it the "isolated selection" – everything else will get deselected and only those named objects will be selected. Then select the unnamed objects and then push the shortcut key.

code:
script: /* Match object name */ var name = ''; var objects = moi.geometryDatabase.getObjects(); for ( var i = 0; i < objects.length; ++i ) { var obj = objects.item(i); if ( obj.selected && obj.name != '' ) { name = obj.name; break; } } if ( name != '' ) { for ( var i = 0; i < objects.length; ++i ) { var obj = objects.item(i); if ( obj.selected && obj.name == '' ) { obj.name = name; obj.selected = false; obj.selected = true; } } }


Cheers,
Hamish