PDA

View Full Version : run MEL procedures within PYTHON?


jorx
05-01-2009, 06:48 AM
Hi all,

I've discovered a MEL global procedure ( doPaintEffectsToPoly ) that's loaded with Maya. However such a module does not exist in python- so is there a way to run a mel command/global procedure within Python?

Thanks, I eagerly await your response.

RyanT
05-01-2009, 07:39 AM
Yup there is. Look up the eval Python command. Example shows this:
import maya.mel as mel
mel.eval('match "a+b+" "abbcc"')

You can also get variables from mel like this:

myPythonVar=mel.eval('$tempMelVar=$gMainWindow')

jorx
05-01-2009, 08:01 AM
Thanks man! By the way- we've been emailing recently- I'm the guy in New Zealand! Seems you're quite active online...

RyanT
05-01-2009, 04:41 PM
Ahh thats funny. Yes I try to be when I can.

Another thing when you want to call commands 95% can be called with Python because they are real commands. Autodesk started adding scripts to the commands help documents and those have a blue icon next to them to signify that. So As long as it doesnt have the blue icon you can call it like normal. Otherwise you have to do the import maya.mel thing.

jorx
05-01-2009, 10:47 PM
well good on yah mate!
thanks again for your help, without people like you learning would be a cold painful experience!

CGTalk Moderation
05-01-2009, 10:47 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.