I guess there was a little wait time, before my first post went
through. Anyways, here is my solution for now.
Basically, I create each face as a separate polyFacet, and then I join
them all together with a MEL eval.
Any feedback is welcome, as I am really inexperienced with using
python in maya.

import pymel.core as pm

def makeMesh(pointList, triangulationIndices):
    """This function receives a list of points, and a list of index
triplets
    indicating the three points to use from the list to create
triangular faces.
    It then creates a mesh in Maya using these points and indices, and
returns
    the name of the created mesh."""
    polys = []
    for i in range(len(triangulationIndices)):
        face = triangulationIndices[i]
        coords = []
        for index in face:
            coords.append(pointList[index])
        polys.append(pm.modeling.polyCreateFacet(p=coords) )
    pm.select(polys)
    mesh = pm.language.mel.eval('CombinePolygons;')
    return mesh


On Apr 20, 3:47 pm, Benjamin Golder <[email protected]>
wrote:
> I would like to create a triangulated mesh-like object in Maya using
> PyMEL.
> Which command should I use to create a new polygon object from
> scratch?
> I have a list of coordinates tuples, with a (x,y,z) tuple for each
> point.
> I also have a list of index tuples for each triangular face I want to
> make, as a (0,1,2) tuple, which refer to the indicies in the list of
> coordinates.
> I see that there is a command for appending polygon faces, but how do
> I create the first face?
>
> Thank you
> -Ben

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to