Go to: Synopsis. Return value. Related. Flags. MEL examples.
eval [-undoEnabled boolean]
string|expression
eval is NOT undoable, NOT queryable, and NOT editable.
The purpose of the eval command is to provide a way for the user to
execute a MEL command or procedure which can only be determined at
runtime. Any valid MEL statements can be passed as the string
argument to eval. For those familiar with C, this provides a
functionality akin to function pointers.
This feature is of particular use to plug-in users. Since a plugin
command is available only after the execution of the loadPlugin
command, references to that plugin can only be resolved at runtime.
If the user wants to use eval to execute only a single simple command
with optional arguments, then he/she can use the 2nd form of the
syntax. Otherwise, the user should construct a string consisting of
the statements and/or commands to be executed.
Any | The return value of the statement or command/procedure call. |
evalDeferred, evalEcho, scriptJob
undoEnabled
Long name (short name) |
Argument types |
Properties |
|
-undoEnabled(-ue)
|
boolean
|
|
|
Specifies that the command to be executed should not be
placed on the undo queue. Default is true.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can be used more than once in a command.
|
string $timeOfDay = "afternoon";
switch($timeOfDay) {
case "morning":
$shape = "circle";
break;
case "afternoon":
$shape = "sphere";
break;
case "evening":
$shape = "cone";
break;
default:
$shape = "cylinder";
}
float $radius = 1.4;
eval $shape -r $radius; // create specified shape with given radius.
// The "eval" command above could also be constructed as a single string:
eval ($shape + " -r " + $radius);
eval "int $i = 3 + 2;";
loadPlugin mySpecialNurbCmd.dll;
int $arg1 = 1;
int $arg2 = 10;
eval mySpecialNurb $arg1 $arg2;