Hi. I need some fast python method to find center of all given elements.
A good idea to use mfntransform with loop from python api 2.0 
(getTranslation).
But it also maybe components(verts, faces) in selection.
I need center of all.

At this time i use this func. But i know that it is not fast as i need:
 

> def itemsCenter( items ):
>     if len(items) == 1:    return mc.xform( items, q=1,t=1, ws=1 )
>     xx=[]
>     yy=[]
>     zz=[]
>     for item in items:
>         pos=mc.xform( item, q=1, t=1, ws=1 )
>         xx.append( pos[0] )
>         yy.append( pos[1] )
>         zz.append( pos[2] )
>     return sum(xx) / 2, sum(yy) / 2, sum(zz) / 2
>

 

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to