PDA

View Full Version : Positioning a grouped object


slebed
04-13-2007, 03:27 AM
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.

MerlinEl
04-13-2007, 08:00 AM
try this:

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

slebed
04-13-2007, 06:34 PM
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!

PiXeL_MoNKeY
04-13-2007, 07:55 PM
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

slebed
04-13-2007, 08:27 PM
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!

CGTalk Moderation
04-13-2007, 08:27 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.