This seems an absurdly simple question, and I feel embarrassed for asking it, but:
How do I list all vertices in a polygon mesh?
i.e. do something that returns polySurface1.vtx[0], polySurface1.vtx[1],
found a way,
int $count;int $nVerts = pollyEvaluate -vertex $myPoly; //gets number of vertices in myPolyfor ($count = 0; $count < $nVerts; $count++){//do somthing with $myPoly.vtx[$count]}
pollyEvaluate -vertex $myPoly
there we go, saved abit of face and hopefully will help someone else out sometime.
Also, if you have all the verticies selected in the mesh:
string $allVerts[] = ls -sl -fl;
ls -sl -fl
if you have just the mesh selected:
PolySelectConvert 3;string $allVerts[] = ls -sl -fl;
I always use something similar to kmagill's technique. Use polyEvaluate to get the total vert count and then I build a string representing all verts in compressed format...
int $vertcount = polyEvaluate -vertex $object; string $allVerts = ($object + ".vtx[0:" + ($vertcount - 1) + "]" );
polyEvaluate -vertex $object
In most cases using a command that works on all verts fed to it in compressed format is faster than looping through the verts yourself since the API handles it instead of a MEL loop.
--JeffD