Face Centroid

431 views
Skip to first unread message

moesian

unread,
Sep 22, 2011, 8:58:35 AM9/22/11
to python_inside_maya
Hello,

Whats the best way to get the center of a face using pymel?
pymel.core.general.MeshFace doesn't seem to have a method for it. If
no method exists would it be possible to extend
pymel.core.general.MeshFace to include one?

Thanks

owen burgess

unread,
Sep 22, 2011, 1:21:31 PM9/22/11
to python_in...@googlegroups.com

Justin Israel

unread,
Sep 22, 2011, 3:00:13 PM9/22/11
to python_in...@googlegroups.com

They didnt include it in the pymel api wrapper, but this would be it I think.


import pymel.core as pm

import maya.OpenMaya as OpenMaya


face = pm.MeshFace("pCube1.f[64]")

pt = face.__apimfn__().center(OpenMaya.MSpace.kWorld)

centerPoint = pm.datatypes.Point(pt)


-- justin

moesian

unread,
Sep 23, 2011, 8:01:55 AM9/23/11
to python_inside_maya
Great this worked perfectly thank you both for your help.

On Sep 22, 8:00 pm, Justin Israel <justinisr...@gmail.com> wrote:
> They didnt include it in the pymel api wrapper, but this would be it I
> think.
>
> import pymel.core as pm
>
> import maya.OpenMaya as OpenMaya
>
> face = pm.MeshFace("pCube1.f[64]")
>
> pt = face.__apimfn__().center(OpenMaya.MSpace.kWorld)
>
> centerPoint = pm.datatypes.Point(pt)
>
> -- justin
>
> On Thu, Sep 22, 2011 at 10:21 AM, owen burgess <owen.burg...@gmail.com>wrote:
>
>
>
>
>
>
>
> > Hi Roland,
>
> > Perhaps this might help:
>
> >http://mayastation.typepad.com/maya-station/2009/11/where-is-the-cent...
>
> > regards,
> > Owen
Reply all
Reply to author
Forward
0 new messages