Intro to Mel Script Part 3 :: The Command Line

The Command Line is a User Interface (UI) element within Maya that is used for executing code snippets. Code snippets usually are single lines of code that you quickly execute and move on. Any heavier use of Mel Scripts is usually done with the Script Editor or with .mel files.


Before you can do anything
you need to find the Command Line.


Inside the Maya Preferences window there is a "UI Elements" section.
This section has the checkbox for the Command Line.
Simply make sure that the Command Line option is checked.


You should see the Command Line now. It should be in the
bottom left-hand corner of Maya.
 
 
Be sure that it says "Mel" and NOT "Python". Having the
Command Line set to "Python" will only execute scripts
in that language. We are dealing with Mel Script, so just double-check that here.


Okay, we have our commandLine all setup. Let's execute some code.
polyCube -w 1 -h 1 -d 1 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -cuv 4 -ch 1;



Copy/Paste the line above into the Command Line input field.
Then, all you do is hit Enter on your keyboard
in order to make the code execute.



Once you do that, you'll notice that the "History" section of
the Command Line returns the output of that Mel command.


Now, every time you execute a snippet of code using the Command Line, you'll see that the code goes away. This is supposed to happen and you can easily get that code back. This is the default behavior of the Command Line.


Pressing the up arrow inside the Command Line
input field will fill it with the previous code. If you keep pressing
the up arrow, you'll cycle through the list of recent
code snippets that the user has executed in this session
of Maya.


















































No comments:

Post a Comment