I was just about to mention the bounding box, right when Mike replied :-) You could probably just use this if its accurate enough for you:
bbox = cmds.exactWorldBoundingBox(items) cent = (bbox[3]+bbox[0])*.5, (bbox[4]+bbox[1])*.5, (bbox[5]+bbox[2])*.5 Also, in your example, did you mean to divide by 2 at the end? Shouldn't it be dividing by len(items) ? The call to mc.xform is probably the slowest part, though appending to 3 lists in a loop isn't helping much either. On Fri, Sep 7, 2012 at 9:25 AM, Mike Malinowski (LIONHEAD) <[email protected]> wrote: > Can you use the bounding box class within pymel? That has methods for > returning he centre and is probably more efficient. > > Mike > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
