//author : Walter Behrnes //title : component level duplicate //version : 1.0 //date last motified : couple of weeks ago from 6-11-2003 //1 copy script to Melscripts directory //2 $myelement is the object which you want to make your duplicates attach to. //3 $myobj is the object you want to duplicate. //4 Select components you want to copy to, type out the procedure name with added variables hit enter. //EXAMPLE placeObj("ball","box"); would copy box onto the components of ball //This is a preversion that is not completely worked out. global proc placeObj (string $myelem, string $myobj) { float $elemmat[] = `xform -query -t -ws $myelem`; //string $myelemX = $myelem+".translateX"; //string $myelemY = $myelem+".translateY"; //string $myelemZ = $myelem+".translateZ"; //Gather World space coords of object //$myobjX = `getAttr $myelemX`; //$myobjY = `getAttr $myelemY`; //$myobjZ = `getAttr $myelemZ`; //print ("\n"+$myelem+" translateX = "+$myobjX); //print ("\n"+$myelem+" translateY = "+$myobjY); //print ("\n"+$myelem+" translateZ = "+$myobjZ); string $obj[]= `ls -sl -fl`; int $size = size($obj); for ($i = 0; $i < $size; $i++) { //Gather World Space coords of Components float $mat[] = `xform -query -t -os $obj[$i]`; //print ("\n component X = " +$mat[0]); //print ("\n component Y = " + $mat[1]); //print ("\n component Z = " + $mat[3]); //Figure out woldSpace of coordinates float $matX = $mat[0] - $elemmat[0];//$myobjX float $matY = $mat[1] - $elemmat[1];//$myobjY float $matZ = $mat[2] - $elemmat[2];//$myobjZ //print ("\n New component X = " + $matX); //print ("\n New component Y = " + $matY); //print ("\n New component Z = " + $matZ); string $newobj = ($myobj + $i); print $newobj; duplicate -n $newobj $myobj ; move -xyz $matX $matY $matZ $newobj; }; }