Notifications
Clear all

[Closed] Positioning a grouped object

How do you set the positon of a grouped object in maxscript? It seems like I’d have to set the position of each object within the group, but that doesn’t seem right.

Any help would be appreciated.

4 Replies

try this:

for i in selection where isGroupHead i do i.pos = [10,10,10]

Thanks, that worked great. I’m trying to write a little script for myself that would move a selection of grouped objects to the positions of a bunch of spheres in a scene.


 balls = $sphere* as array
 
 for i in selection where isGroupHead i do
 (
 i.pos = balls[i].pos
 )
 
 

When I select the groups in my scene and run the above script i get the error

–Runtime error: Array index must be a positive number

I tried balls[i+1].pos but that didn’t work

Any help would be appreciated!

That is because i in the selection is returning an object and not an array index, ie its returning $Group01 and not 1. If all the group objects are the same you could also try the Clone and Align Tool. This takes one object and clones it to the position of a selection of objects.

-Eric

Wow! Boy do I feel stupid. I’ve been using Max since version 3 and have done just about every kind of 3d job, and still there are things I learn about this software every day. I wanted to write a script to do exactly what the clone and align tool did for me in ten seconds.

Thanks for the help!