Vertex adiacency

maya
python

#1

Hi,
I’m try to convert an edge into a list of vertex. Using the polyListComponentConversion I retrieve a list of vertex that is order from lower vertex index to greater.
I would like a list with vertex ordered in adiacency sorting mode.
I hope I explained my problem.
Thanks.


#2

Going to assume you mean “adjacency” as that is what google tells me. With pymel MeshVertex has a method connectedVertices()

So guess you would have to iterate the flattened vertex list and set next index to be currents neighbor.

Unless you meant adjacent as closest in distance, you can get a vector for each vertex position and get distanceTo(other)


#3

yes the first one is perfect. Sorry for my bad english.
Do I have only this solution? do we have some equivalent in the python command reference?
Thanks


#4

cmds.polyListComponentConversion(vert, toEdge=True) for each individual vertex should get you the connected edges.


#5
import maya.api.OpenMaya as om


def vv():
    vit =om.MItMeshVertex()
    vit.setIndex(myvtx)
    res =vit.getConnectedVertices()
    return res