It would take days to figure out in what direction to move it.
howabout seconds?
yes well did you use your middle mouse button click drag on the center of yoru gird AFTER the center pivot menuitem. The procedure calculates this all to you by the way. PLEASE NOTE: dont zoom the view on the object. maya doent actually care where it is just as long as te middle button is pressed at the right location.
There ra ereasons why this would appear to fail tough. If the object is BIG then it could appear that it is not at the center even if it fact IS. because you cant see it.
How come theres no way to calculate what is the distance from mesh to grid so i can enter - those values for translation?
There is. However what that is depends on what you thnk is where the mesh is.
A mesh is not a one number its many numbers. So the compuiter is having slight difficulties in understanding where the mesh is. As its in many places at the same time. And your not helping because your not actually tellin g the computer anything usefull. Technically speaking the mesh is at the center when the trasform is at the center, if its not then there is some reason for that. The computer doent actually care of the stupidity assoscaited with the fact that all points are way off center.
To illustrate the point put paper on the floor and dtaw a x in a corner of it place a mug randomly on top of it, what are the vaiues you need to move in the axe directions for the mig for it to be in the center? Well oviously it depends WHERE on the mug you measure.
So now the real question to computer and me alike is what do you consider the mesh to be? Well i can do a good enough guess and execute the exact same thing as daikath in simple procedure steps (paste and run to script editor, after selecting all objects you want to center thir center of):
{
for($item in `ls -sl`){
xform -cp $item;
move -a -rpr 0 0 0 $item;
}
}
Please note this is the same as doing EXACTLY what dikath said so you dont really need the code. in fact if you ever do it maya does this code.
Now this is nt a set in stone procedure. IF your object is BIG then it need to be scaleddown or small scaled up. To do this you could try following instead:
{
for($item in `ls -sl`){
$result=0.0;
xform -cp $item;
move -a -rpr 0 0 0 $item;
float $bb[]=`xform -q -boundingBox $item`;
for($subItem in $bb)
$result=max($result,abs($subItem));
scale (1/$result) (1/$result) (1/$result) $item;
}
}
again no magic. Very basic maya stuff.
PS: they will not automagically do exactly what you want just something that way. Because to get what you want requires us to know what that is. Wich you are not saying