View Full Version : A few MEL questions :)

04 April 2006, 02:34 PM
Hi there everyone,

I was wondering if anyone could help me with a few problem. First one is does anyone know of a wait command i can use in MEL. The problem is i am rendering a jpg or an avi, and its going to be displayed in another program, so my script starts maya, and runs the rendering, and i use the quit; command straight after the render command, except it doesn't finish rendering as it goes straight to the quit; command. was hoping something like wait(3); existed to pause the execution of the next command for 3 min.. .or something....

Also ( though i think i should have found how to do this by now) how to i set the output directory, through a mel script for files about to be rendered??

Lots of thanks to anyone who can help... its part of my dissertaion ( 3D visualization of software source code).....

(email me if you feel obliged i need the info ASAP for presentation on the 2nd of may)


04 April 2006, 08:39 PM
hey dude. For delaying the command I think you can use the timerX command. I havent ever really used it, so I don't know how to work with it, but you can go to Maya help and get help on that command.

To set the output directory you have to set it in the render command. I think you are using it already to start the render, so you only have to add one more flag. The flag is

-rd <path>

Check this page in Maya help to get more help in the render command:


hope it helped


05 May 2006, 02:01 PM
hi there, as far as i can see from the maya help the timerx command will return the time of an operation. What i really need is a way to delay an operation for a set time. You see i can running an auto render through a mel scrpit that takes values from an outide text file. It then saves the render as either an AVI or JPG depending on what im working with and displays it through my java app. The problem is i want it to quit maya automatically after the render has finished. I use the quit; command after the batchrender command except it runs the quit; command straight after the render command and does not allow enough time for the render to complete. I knwo this is short notice but i have my presentationn in about 20 hours. If anyone knows how to do this please let me know, The help will be invaluable.


05 May 2006, 09:37 AM
hi loodis,

This might be too late, but one option is to use a scriptJob with an idleEvent. An idle event gets called repeatedly any time Maya isn't doing anything else. This example quits maya after 10 seconds, assuming maya isn't already busy with something.

$startTime = `timerX`;
scriptJob -ie "if(`timerX -st $startTime` > 10) { quit; }";

The only risk here is that the idleEvents might eat up all of your cpu power, leaving none for the actual rendering process! If you're lucky enough to have a dual core / dual cpu machine, this shouldn't be a problem. This is just a quick hack, and I'm guessing there's a much better way of doing this.

05 May 2006, 10:09 AM

pause -sec 10;

Will pause your maya for ten seconds.

05 May 2006, 10:13 AM
Ha, and there's the better way :) It doesn't block the CPU like the idle events do, so that should work nicely.

CGTalk Moderation
05 May 2006, 10:13 AM
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.