View Full Version : Grouping in object as they are created


chayanvinayak
09 September 2007, 08:54 PM
hi ,

I am creating toruses in a function and i need to put these torus into a group as these are created.

I am using following code to create a empty group "handle" and trying to put duplicated polyToruses into this group, but polytoruses are not added into group "handle".
-----------------------------------------------------------------
group -em -name handle;
polyTorus -ch on -r (1/2) -sr (1/2);

for($i=1;$i<=8;$i++){
duplicate -rr;
move -r 0.5 (($i-5)/2) 0;
group;

};

JackSMillenium
09 September 2007, 09:49 PM
The "group" command creates a NEW group with the selected objects. In your case, you've already created the group, and you want to "parent" your duplicate objects under an existing group. This bit of code will work:


// Store the group name for later use
string $groupName = "handle";
group -em -name $groupName;
// Store the original torus name for later use
string $tmpA[] = `polyTorus -ch on -r (1/2) -sr (1/2)`;
string $torus = $tmpA[0];

for($i=1;$i<=8;$i++){
// Store the name of the copy to move and parent it
string $dups[] = `duplicate -rr $torus`;
string $copyName = $dups[0];
move -r 0.5 (($i-5)/2) 0 $copyName;
// parent the copy to the original group
parent $copyName $groupName;
}

CGTalk Moderation
09 September 2007, 09:49 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.


1