PDA

View Full Version : Calling Vertices numbers


orwoFf
11-15-2007, 09:00 AM
Hi,
Is there a way to get a selected Vertex number only? Or do I need to use match and substituteAllStrings to get the clean number?

harmless
11-16-2007, 12:26 AM
global proc int[] getVertInt( string $verts[] )
{
string $curSel[] = `ls -sl`;
select -r $verts;
string $myVerts[] = `ls -sl`;
string $vertList[] = `filterExpand -sm 31 -ex true`; //poly verts

int $intVerts[] = {};
for( $vert in $vertList )
{
string $buffer[] = {};
$n = `tokenize $vert "[]" $buffer`;
string $nVertStr = $buffer[1];
int $nVert = $nVertStr;
$intVerts[size($intVerts)] = $nVert;
}
select -r $curSel;
return $intVerts;
}

//test asset
string $obj[] = `polySphere -ch on -o on -r 8.904493`;
select -r ($obj[0]+".vtx[2]");
select -add ($obj[0]+".vtx[10]");
select -add ($obj[0]+".vtx[4]");
string $verts[] = `ls -sl`;

//call my function to get ints back
int $vertNums[] = getVertInt( $verts );

print $vertNums;

CGTalk Moderation
11-16-2007, 12:26 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.