MEL commands
For every action through the Maya interface, one or more MEL commands exist. For example, you can add a (polygon) cube to the scene using the polyCube command:
  • Choose Window → General Editors → Script Editor from the Maya menus to open the Script Editor.
  • Type polyCube; in the bottom half of the Script Editor and press the Enter key on the numeric keypad.
     
    The MEL command reference (in the Maya help pages: infonet.bk.tudelft.nl/help/mayahelp/Commands/) gives an overview of all available commands (categorised).
     
    If you know how to specify the action through the Maya interface, you can also find out what the corresponding commands are through the Script Editor:
  • Add a polygon cube to the scene by means of the Maya 'Create' menu.
  • Look into the top half of the Script Editor and find the following (last) lines:
     
    polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -tx 1 -ch 1;
    // Result: pCube2 polyCube2 //

     
    De first line contains the MEL command, the second line describes the result as a comment (preceded by //):
  • polyCube is the name of the command.
  • Each combination of letters preceded by - denotes a flag>.
     
    Command options
    A flag specifies a certain option for the command and may be followed by one or more values (e.g., numbers). The meaning of each of these flags is specified in the MEL command reference (e.g., -w 1 specifies the width of the cube as 1). Each flag is optional; if an option is not specified, a default value is used instead.
     
    A command can be applied to a specific object (or objects) or to the current selection:
  • Move the cube with the move tool.
  • Look into the top half of the Script Editor and find one or more lines like the following:
     
    move -r -os -wd 0 0 5.109298 ;
     
    The move command is in this case applied to the current selection. You can apply it to a specific object by adding the name of the object (e.g. pCube2) to the end of the statement, but before the semicolon:
     
    move -r 0 0 5 pCube2;
     
    Command sequences
    A script is any sequence of commands that you execute at once. You can execute a script in one of three ways:
  • Copy and paste into the bottom half of the Script Editor and press the numeric Enter key.
  • Save your script in a .mel file and use the Open Script... item in the File menu of the Script Editor to load the content of this file into the bottom half of the Script Editor; press the numeric Enter key to execute the script.
  • use the Source Script... item in the File menu of the Script Editor to execute the content of your .mel file directly, without copying it into the Script Editor.