PDA

View Full Version : using the cut polygon tool in a script


neonoodle
05-05-2006, 04:24 AM
Hi everyone,
I'm trying to make a tool that will take the results of a CutPolygon command, seperate those cut faces, and then fill the holes. How can I make it so that the function waits for the script to finish the cut polygon command before acting on the results? So far I have this:

global proc string[] dbCutFaces()
{
string $selected[] = `ls -sl`;
string $result = `CutPolygon`;
string $seperated[] = `polySeparate -ch 0 $selected[0]`;
polyCloseBorder -ch 1 $seperated[0];
polyCloseBorder -ch 1 $seperated[1];
return $seperated;
}

Stucky
05-05-2006, 09:51 AM
You can use a scriptJob. See the following. It is in the Maya help. It prints a warning message when you create a sphere and then when its translate Y gets over 10. So I think you can do seomthing like this with your script. When the cutfaces run, it then finish the results.


// create a sphere, but print a warning
//the next time it is raised over 10 units high
global proc warn(){
float $height = `getAttr mySphere.ty`;
if ( $height > 10.0 ){
print ("Sphere is too high!\n");
}//end if
}// end proc
sphere -n mySphere;
scriptJob -runOnce true -attributeChange mySphere.ty warn;


I'm assuming you know how to work with all the other things you need for the script.


-S

neonoodle
05-06-2006, 01:04 AM
Cool! the scriptJob worked. Thanks!

CGTalk Moderation
05-06-2006, 01:04 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.