PDA

View Full Version : How to save constraint output result?


Badgerow
03-17-2009, 12:27 AM
Hello all,

Please excuse the ignorance of this question, but I am wondering how it is possible to grab and store the output/result of a constraint command inside of a mel script. For example, if I want to use a pointConstraint to snap something, then delete it, I would need to grab the name of the created pointConstraint and then use it to delete it:

global proc snapAndDelete {
string $select[] = `ls -sl`;
$howMany = size($select);
if ($howMany > 2) { error "More than 2 selected"; }
pointConstraint;
//Here is where I need to get the name of the constraint created, and then delete it

}

Anyone know how to do that? Help is hugely appreciated

-Badgerow

greatPumpkin
03-17-2009, 03:02 AM
pointConstraint, and indeed most commands return useful output,



global proc snapAndDelete
{
string $select[] = `ls -sl`;
$howMany = size($select);
if ($howMany > 2)
{
error "More than 2 selected";
}

string $pCon[] = `pointConstraint`;

delete $pCon;
}



If you printed $pCon, you would get the name of the constraint maya just created.

or even easier, since you want to immediately delete the result of the point constraint commad you can do:



delete `pointConstraint`;

Badgerow
03-17-2009, 11:52 PM
Thank you, greatPumpkin! Works beautifully! :)

-Badgerow

CGTalk Moderation
03-17-2009, 11:52 PM
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.