Code:
string $stem = "dupes_"; string $suffix= "_GEO"; string $obj = "pTorus1"; string $dupeSel[] = `ls ($stem + "*" + $suffix)`; int $numbVerts[] = `polyEvaluate -v $obj`; int $i = 0; for($i; $i < $numbVerts[0]; $i++) { //pick an object to duplicate int $dupeInt = rand(0, size($dupeSel)); $dupeInt++; float $pos[] = `xform -q -ws -t ($obj + ".vtx["+$i+"]")`; string $new[] = `duplicate -rr ($stem + $dupeInt + $suffix)`; setAttr ($new[0] + ".translateX") $pos[0]; setAttr ($new[0] + ".translateY") $pos[1]; setAttr ($new[0] + ".translateZ") $pos[2]; normalConstraint -weight 1 -aimVector 0 0 1 -upVector 0 1 0 -worldUpType "vector" -worldUpVector 0 1 0 $obj $new[0]; }
Alan