Integrating 3D models with photography
Interested in integrating your 3D work with the real world? This might help
# 1 20-12-2004 , 10:34 PM
Billy_Cat's Avatar
Registered User
Join Date: Aug 2004
Location: USA, CA
Posts: 351

script help

how do you select vertices with a specific quardinate using the script editor.. I want to select all vertices that have the value "0" on the x axis.. it doesnt matter what y or z value they have..

# 2 21-12-2004 , 03:27 AM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
Try this.

Caveats:
1) Run this on one objects at a time
2) make sure you set the $maxVerts to be greater than the number of verts in your object. (the higher this number, the longer the script takes)

$axis is obviously the axis you are scanning and $findVerts is the value you are looking for. Not a perfect script, but whaddaya want for nothin'?



string $axis = "x";
float $findVerts = 0;
int $maxVerts = 441;

string $obj[] = `ls -dag -sl`;
int $countA = 0;
int $countB = 0;

float $getIt;
string $toBeSelected[];

while ($countA != $maxVerts)
{
$getIt = `getAttr ($obj[1]+".pnts["+$countA+"].pnt"+$axis)`;
$getIt = (trunc($getIt*1000) / 1000);
if ($getIt == $findVerts)
{
$toBeSelected[$countB] = ($obj[0]+".vt"+$axis+"["+$countA+"]");
$countB += 1;
}
$countA += 1;
}
while ($countB > 0)
{
$countB -= 1;
select -add $toBeSelected[$countB];

}
select -d $obj[0];

# 3 21-12-2004 , 04:16 AM
Billy_Cat's Avatar
Registered User
Join Date: Aug 2004
Location: USA, CA
Posts: 351
when I use that, it just selects all the vertices in the model..

# 4 21-12-2004 , 05:26 AM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
When then all your vertices must have x values of 0. Sorry.

# 5 21-12-2004 , 11:53 AM
caligraphics's Avatar
Registered User
Join Date: Mar 2003
Location: Billund, Denmark
Posts: 992
Dann :
I am no programmer, but I think your script is selecting the vertices based on thieir local coords, but I think he wanted to select the vertices with a World coord of X = 0 ..


Carsten Lind
Senior 3D Artist,
Maya Software Manager & Maya Instructor
LEGO Systems A/S
# 6 21-12-2004 , 04:23 PM
Dann's Avatar
Registered User
Join Date: Feb 2003
Location: Los Angeles
Posts: 695
You are absolutely correct. I'm no programmer either, and I don't know how to find world coordinates of a vertex.

# 7 22-12-2004 , 09:49 AM
Billy_Cat's Avatar
Registered User
Join Date: Aug 2004
Location: USA, CA
Posts: 351
oh well..

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads