Reputation: 91
how to find the centre point in autodesk maya...I know use the centre pivot but i can't find the point..how to find the exact coordinate of the 3d object created using autodesk maya? thanks.
Upvotes: 4
Views: 11195
Reputation: 1422
Select the object, "Modify-Center pivot.." In case of not working, just select the object and press 'Insert key, in your key board. then it will allow you to set pivot..just drag and drop the place where u want to set...
If you have any doubt feel free to share....
Upvotes: 0
Reputation: 31
Select the object and select: Animation > Create Deformers > Cluster.
A cluster deformer will now appear at the exact center of your object, denoted by a 'C', you can vertex-snap to the cluster whatever you need to have centered. The actual centerpoint of the cluster will be just below the 'C'.
Upvotes: 1
Reputation: 12208
There are actually two possible answers to the question.
The 'center' of the object could mean:
The center of the object's bounding box : you could get this as follows (using python)
bbx = cmds.xform(object, q=True, bb=True, ws=True) # world space
centerX = (bbx[0] + bbx[3]) / 2.0
centerY = (bbx[1] + bbx[4]) / 2.0
centerZ = (bbx[2] + bbx[5]) / 2.0
the location of the object's pivot: This is not the same as the object's position, since you can move the pivot without changing the translation number that maya reports. The world-space pivot location can be gotten with:
pivot = cmds.xform(object, q=True, rp=True, ws=True)
Upvotes: 3
Reputation: 12176
There's actually a command called objectCenter()
This will give you true world space of a specific point or object.
import maya.cmds as cmds
# create a simple hierarchy
cmds.polyCube( name='a' )
cmds.polyCube( name='b' )
cmds.parent( 'b', 'a' )
cmds.move( 3, 0, 0, 'a', localSpace=True )
cmds.move( 2, 2, 2, 'b', localSpace=True )
X_COORD = cmds.objectCenter('b',x=True)
# Result: 5 #
# Get the center of the bounding box of b in local space
XYZ = cmds.objectCenter('b', l=True)
# Result: 2 2 2 #
# Get the center of the bounding box of b in world space
XYZ = cmds.objectCenter('b', gl=True)
# Result: 5 2 2 #
# Get the center of the bounding box of a in world space
XYZ = cmds.objectCenter('a', gl=True)
http://download.autodesk.com/global/docs/maya2013/en_us/CommandsPython/index.html
Shannon
Upvotes: 1
Reputation: 284
If you're happy with where the center pivot command puts the pivot and you just want to know where in worldspace it is, you could do the following (assuming you have the object selected)
using PyMEL:
import pymel.core as pm
theObject = pm.ls(sl=1)[0]
theObject.getRotatePivot()
or using maya.cmds:
import maya.cmds as mc
mc.xform(query=True,rotatePivot=True)
or using MEL
xform -q -rotatePivot
Upvotes: 1
Reputation: 7611
Select the object, and then run this in the script editor:
string $sel[];
$sel = `ls -sl`;
print `getAttr ($sel[0]+".translate")`;
This will print the X, Y, and Z coordinates in the history panel.
Upvotes: 0
Reputation: 2931
Just go to the menus, Modify > Center Pivot. This will make your pivot go to the center of your model.
Upvotes: 3