View Full Version : External Python driving Maya

03 March 2008, 10:54 PM
I recently gave a lecture at GDC 2008 called Python for Technical Artists (

One of the examples I used (and posted online) showed how to use an external Python script to send MEL commands to Maya. That is, using commandPorts from a standalone Python script, rather than using the embedded Python interpreter/API in Maya. It could also send Python commands, for that matter.

The reason this is interesting to me (and driving 3ds Max the same way via COM) is because it enables us to develop one common tool script and, with very few lines of MaxScript or MEL, easily make it work with both apps. Getting more cross-app mileage from our tools has been a recent focus of mine.

The example script was "" in the COM folder of the examples download, posted on the Volition GDC Archive (

Hope someone finds it useful. May be wickedly dull old news, too. We're primarily a 3ds Max house and I'm not too dialed-in to the latest and greatest Maya/MEL stuff. :)

03 March 2008, 10:31 PM
Sounds interesting :)

I've just been developing a traffic animation tool for Maya and am interested in looking at ways of using Python within 3ds max to minimise redevelopment.
I'll be having a look at it as soon as my course finishes (in a week and a bit!)


03 March 2008, 11:42 PM
import maya.cmds
mc = maya.cmds
#pFace = polyFaceFaceted ("pCube1.f[1]", r= True)
createHair 8 8 10 0 0 0 0 5 0 2 1 2
# Error: ('invalid syntax', ('<maya console>', 7, 12, 'createHair 8 8 10 0 0 0 0 5 0 2 1 2'))
# File "<maya console>", line 6
# createHair 8 8 10 0 0 0 0 5 0 2 1 2
# ^
# SyntaxError: invalid syntax #

I'm trying to create a dynamic Curve off this cube. It reads the last line as an error. I got the last line from running through the createHair options menu and changing a few attribute within the dialougue box and hitting create. This line was the result of it. How can I convert such a line into a mel to python executable code??

createHair 8 8 10 0 0 0 0 5 0 2 1 2


CGTalk Moderation
03 March 2008, 11:42 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.