Basic Use Of Maya's Command Port

This is a basic tutorial on how to use the command port in Maya. By opening the command port we can send Mel commands to Maya remotely. This can become very handy later in the plugin development process. The iteration through the phases of coding, compiling, loading the plugin, testing and finally unloading the plugin, can be shortened and well integrated with you favourite IDE (whether it's Emacs or KDevelop for instance)
Follow these 5 simple steps and you will be able to make basic use of the Maya command port.
1. Start Maya
$ maya
2. Open Script Editor
Inside Maya look for "Window" in the top menu.
Window -> General Editors -> Script Editor
3. Open the Command port in Maya
In the Script Editor write:
commandPort -n "localhost:6000";
Where 6000 is the port number (choose a unused port number between 1024 and 65000).
Execute the command by pressing <Ctrl> <Enter> at the same time (or Command -> Execute from the menu)
Now the command port is open to the outside world, making it possible to execute Mel commands remotely.
4. Connect to the Command Port
I order to send Mel commands to the machine running Maya with the command port open you can use telnet.
Usage: telnet <host> <port>
I our case we could write:
$ telnet localhost 6000
Response:
tic@mtic:~/$ telnet localhost 6000
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
5. Send actual commands to Maya
We could start by making Maya draw a sphere with the radius of 5.
In the telnet session just write:
sphere -r 5
or if we would like a torus just write:
polyTorus
The geometry will now appear in your Maya scene.
Get help to the command by typing:
help <commandName>
This will give you a list of all Mel commands starting with the letter a:
help -list "a*"
This was just a quick intro to the command port which we are going to use later on in upcoming tutorials on plugin development.
Check out this screenshot from the above test (click on the picture to enlarge)
- 20.12.2006. 21:06 | Author: Ticless
Comments
Write a comment