using python api:
import maya.OpenMaya as OpenMaya
meshName = "myMesh"
faceNormals = []
def asMDagPath(name):
selList = OpenMaya.MSelectionList()
selList.add(name)
MDagPath = OpenMaya.MDagPath()
selList.getDagPath(0, MDagPath)
return MDagPath
dag = asMDagPath(meshName)
faceIter = OpenMaya.MItMeshPolygon(dag)
while not faceIter.isDone():
normal = OpenMaya.MVector()
faceIter.getNormal(normal)
faceNormals.append(normal)
faceIter.next()
On Sun, Feb 10, 2013 at 5:17 AM, Bradon Webb <[email protected]> wrote:
> this code might be useful example for you.
>
> Im working on a similar thing. I want to re-orient a polygon if extracted
> from a mesh based on the angle of the face. Or if you have some model that
> has lost its transforms because of a lattice or vertex deformation.
>
> I think if you only use the face normal you might get a twisting problem.
>
> In this case I use 3 points in space to define the angle of the plane.
> The points are selected somewhat arbitrary for now. I could't really
> think of a good way to define the three points. You could probably do a
> vertex selection order, but unfortunately I don't think you can get the
> selected order of components very easily.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.