Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Pymel, get connected vertices from a meshFace?

Pymel, get connected vertices from a meshFace?

Anonymous
Not applicable
1,661 Views
2 Replies
Message 1 of 3

Pymel, get connected vertices from a meshFace?

Anonymous
Not applicable

 

hi, I am trying to get connected vertices from a meshFace.
I can get a MeshVertex list of the connected vertices but I can't access to element of the returned list.
My first question is how to access to list element?

The returned list is >>>pPlaneShape2.vtx[72:73,102,105,133,136,165:166] but I don't really understand the information returned. I was expecting to get the index of 4 vertices that are connected to my face like >>>pPlaneShape2.vtx[102,105,133,136] , instead I have 6 index with some weird ":" things.. Does someone knows what it means?

thx

 

from pymel.core import *

plane = ls('pPlane2')[0].getShape()

faceSample =  plane.f[100]
cvtx= face.connectedVertices()
print (cvtx)
>>>pPlaneShape2.vtx[72:73,102,105,133,136,165:166]

print (cvtx[0])
>>># Error: line 1: IndexError: file C:\Program Files\Autodesk\Maya2015\Python\lib\site-packages\pymel\core\general.py line 4400: Indexing only allowed on an incompletely specified component (ie, 'cube.vtx') #

 

0 Likes
Accepted solutions (1)
1,662 Views
2 Replies
Replies (2)
Message 2 of 3

RFlannery1
Collaborator
Collaborator
Accepted solution

It sounds like what you are after is the vertices of the face, not the vertices connected to the face.  (In this case, "connected to" means vertices that are not on the face, but connected to it by an edge.)

 

Instead of "connectedVertices()", try "getVertices()".

 

The ":" syntax means a range of numbers.  So, for example, "72:73" means 72 and 73.  And "2:5" would mean 2, 3, 4, and 5.

Message 3 of 3

Anonymous
Not applicable

you right "getVertices()" is what I was looking for. The returned value of  "connectedVertices" makes sense now. thx!

0 Likes