I made a joint chain for a leg and named each joint, "thigh", "knee", "ankle", "ball", and "toe." I want this code to duplicate the chain and then add "_FK" to the end of each name. Right now it will only change the first name correctly, and then the rest don't change. It gives the error message "Error: No object matches name." What is preventing the for loop from working? This code works perfectly when I take out the duplication line.
duplicate -rr;
string $currentSelection[] = `ls -sl -fl`; //get name of selected objects//
int $theArraySize = size($currentSelection);
int $counter = 0;
string $newName = "";
for ( $i = 0 ; $i < $theArraySize; $i++ )
{
$newName = $currentSelection[$i] + "_FK" ;
rename $currentSelection[$i] $newName;
$counter += 1;
}