Go to: Synopsis. Return value. MEL examples.
string[] executeForEachObject( string $inThisList[], string $thisCmd )
None
| Variable Name | Variable Type | Description |
|---|---|---|
| $inThisList | string[] | - a list of object names to operate on |
| $thisCmd | string | - a string with %s in it. |
// Example 1. if "thisCmd" is a string that looks like:
string $thisCmd = "reverseCommand -ch off -rpo on %s";
// and curve1 and curve2 are in the given list, then the commands
// that will be executed for each object will look like:
reverseCommand -ch off -rpo on curve1;
reverseCommand -ch off -rpo on curve2;
// Example 2. if "thisCmd" is a string that looks like:
string $thisCmd = "reverseProc( true, false, %s )";
// and curve1 and curve2 are in the given list, then the commands
// that will be executed for each object will look like:
reverseProc( true, false, "curve1" );
reverseProc( true, false, "curve2" );
// Example 3.
cone; sphere; select -all;
string $cmd = "duplicate %s";
string $itemList[] = `ls -sl`;
select -d;
string $results[] = executeForEachObject($itemList, $cmd);