Search code examples
pythonmayamel

Maya polyInfo -ve return the wrong values


I'm slowly learning my way through python and Maya, so I'm probably doing something wrong.

So, for some reason, when I use polyInfo, it returns the wrong information. Example, on the basic plane, I select one vertice and execute the following command.

import maya.cmds as cmds

cmds.polyInfo(ve = True)

It returns

# Result: [u'VERTEX     48:     93     90     72     92 \n'] # 

Those vertices aren't relative at all to the one I selected. Hell, sometimes, it returns non-existing vertices, depending on the selected one.

I don't know if relevant, but I have the same result in MEL with

polyInfo -ve

The doc isn't useful to me and I have a hard time finding someone with a similar problem.

What's the deal here?


Solution

  • What do you want to query ? Can you give an example of your script.

    The flag -ve return from maya documentation : Returns the Edges connected to a vertex. Requires vertices to be selected. http://download.autodesk.com/us/maya/2011help/CommandsPython/polyInfo.html

    Are you feeding the command with a selection : i.e :

    edges = cmds.polyInfo("pPlane1.vtx[48]", ve=True)
    

    so it is giving as output : 'VERTEX 48:' selection is vertex number 48 (a single one at the moment), ' 93 90 72 92 ' and it is connected to 4 edges with the indexes : 93, 90,72,92

    EDIT :

    here is an example code to select the edges:

    edges = cmds.polyInfo(['pPlane1.vtx[54]', 'pPlane1.vtx[43]'], ve=True)
    selOut = []
    for i in edges:
        # split the indexes
        indexes = i.split(':')[-1].split(' \n')[0].split('    ')[1:]
        # write as : pPlane1.e[]
        selEdges = ['pPlane1.e[{}]'.format(j.replace(' ','')) for j in indexes]
        # merge the selection
        selOut+=selEdges
    # remove duplicated edges :
    newSel = list(set(selOut))
    cmds.select(newSel)