Grouping in object as they are created


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);

duplicate -rr;
move -r 0.5 (($i-5)/2) 0;



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];

    // 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;


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.