global proc drop() { // first object is your saranWRap // second object is the thing to wrap source angelUtil; string $list[] = `ls -sl`; int $selectSize = `size $list`; if ($selectSize != 2) { shError("Need to select two objects"); return; } string $targetObject = $list[1]; string $saranWrapObject = $list[0]; print ("Target = ("+$targetObject+")\n"); print ("Saran = ("+$saranWrapObject+")\n"); // show all verts.. string $marker[] = `polyCube -w 0.012 -h 0.012 -d 0.012 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -tx 1 -ch 1`; // print ("Marker = ("+$marker[0]+")\n"); geometryConstraint $targetObject $marker[0]; int $totalVerts[] = `polyEvaluate -v $saranWrapObject`; print ("Total Verts = ("+$totalVerts[0]+")\n"); int $index; for ($index =0; $index < $totalVerts[0]; $index++) { string $objVtx = ($saranWrapObject+".vtx["+$index+"]"); float $point[] = `pointPosition $objVtx`; float $newPos[] = dropCube ($marker[0], $point[0], $point[1], $point[2]); move -x $newPos[0] -y $newPos[1] -z $newPos[2] $objVtx; } delete $marker[0]; select $saranWrapObject; xform -cp; } global proc float[] dropCube( string $markerName, float $x, float $y, float $z) { // place the cube at $x, $y, $z int $loop; select $markerName; move -x $x -y $y -z $z; // set the initial BOX location for ($loop=0; $loop< 10; $loop++) { move -x $x -z $z; } string $markerT = $markerName+".translate"; // print ("Marker = ("+$markerT+")\n"); float $markerPos[] = `getAttr $markerT`; // print ("MPos = ("+$markerPos[0]+")\n"); // print ("MPos = ("+$markerPos[1]+")\n"); // print ("MPos = ("+$markerPos[2]+")\n"); return $markerPos; }