View Full Version : vertex selections to an array

05 May 2006, 07:50 PM
Is it possible to convert a selection of poly vertices into an array, where one could then call out specific verts based on their index number?

for example,
create a poly sphere,
select a few verts (say 6 for argument sake),

string $vertSelect[] = `ls -sl`;

print $vertSelect; // this will return all the selected verts, but

print $vertSelect[0]; // will only return the the vertex whose vertex number ID is the numerically lowest, not necessarily the first selected.

So is there a way to sort the vert array so the vert is indexed in order of selection , not on its vert ID?


05 May 2006, 04:38 AM
hi sobek,

use -flatten flag in the ls function..

string $selVerts[]=`ls -sl -flatten`;

now it will return some thing like

pSphere.vtx[1], pSphere.vtx[2], pSphere.vtx[3], pSphere.vtx[4], pSphere.vtx[5] instead of pSphere.vtx[1..5];

but if u want it to store in the "ORDER of SELECTION" ,...theres some threads on the forum.. i saw..may be u can hit a search.. if i get it again, i'll post the link...

CGTalk Moderation
05 May 2006, 04:38 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.