> MEL
> Lesson 1: MEL basics
![]()
Downloading Maya MEL scripts
A MEL script is a file containing a collection of MEL procedures and commands. As mentioned in the lesson’s introduction, you can extend Maya’s capabilities with scripts. In the next steps, you obtain a free script available on our customer community Web site.
- Create a new scene before starting the next part of the lesson.
- Using your computer’s installed Web browser, navigate to the Maya web site (
www.autodesk.com/maya) and then choose the Visit the Community link.
To view and download content from the Downloads area you will need to register. (Be sure to read the Terms and Conditions of Use document available from that page.)
- Click the Downloads link.
The Downloads area provides a search engine to access the many shaders, plug-ins and MEL scripts available for download.
- Use the Find a Download search engine to search for Maya MEL scripts, and choose spiral.mel to obtain a script that creates a spiral curve based on values you supply for height, radius, and number of revolutions (“rounds”).
- In the file browser that appears, select the appropriate destination directory for the scripts file to download to. For example:
(Windows)
drive:\Documents and Settings\<username>\My Documents\maya\scripts(Mac OS X)
Users/<username>/Library/Preferences/Autodesk/maya/scripts(Linux)
~<username>/maya/scriptsSubstitute your specific hard drive letter and login name where username and drive appear in the above paths.
Many of the shaders and scripts in the downloads area of the Web site are compressed to reduce download time. Ensure that the MEL script is uncompressed (if necessary) before proceeding. To see how to execute the script, you need to examine the contents of the spiral.mel script for comments and clues.
To examine the MEL script’s contents
- In the Script Editor, select File > Load script. In the resulting browser, open
spiral.mel. The script appears in the Input area of the Script Editor.- Read the comments in the file—the text following the // characters. The comments describe the purpose of the script in addition to copyright and disclaimer information.
Notice the following line in the script:
global proc string spiral( float $ht, float $radius, float $numRounds)
The three variables within the parentheses, $ht, $radius, and $numRounds are arguments to the procedure spiral. They represent values that you must enter when you execute the
spiral.melscript in a later step. The variables specify the height, radius, and number of rounds for the spiral curve that will be created when you execute the script.The entry float is short for floating point—the data type of an argument. A floating point number is a number with a decimal point rather than an integer.
To execute the MEL script
- To execute the script, enter the following text in the input section of the Script Editor. Remember to press the numeric Enter key after the text.
spiral 5 2 10;
- Maya finds the spiral.mel script in the scripts directory and executes the script contents to create the following spiral curve of height 5, radius 2, and 10 rounds:
The script file must be in the appropriate scripts directory or your script will not execute when you enter its name in the input section of the Script Editor.