Maya for 3D Printing - Rapid Prototyping
In this course we're going to look at something a little different, creating technically accurate 3D printed parts.
# 1 28-02-2005 , 01:30 AM
Protheus's Avatar
Registered User
Join Date: Sep 2002
Location: Beyond Oblivion
Posts: 471

Running a MEL script

Oke I am all new to this MEL scripting.

I have the following issue - I created the following script as a test run:

window -rtf true -title "Test" Testwindow;
showWindow Testwindow;

the scripped is called: test.mel

I have placed it in the: C:\Documents and Settings\username\My Documents\maya\6.0\scripts

and then I start Maya.
But when I type: test; in the command line I get the message:

Mel Stack Trace
Cannot find procedure "test".
Start of trace: (command window: line 1).
test (command window: line 1).

Oke I looked up in the forums and you should be able to call up the script by typing its windows name and press enter ??

So what am I doing wrong ?


The Important Thing is NOT to Stop Questioning.
--- Albert Einstein ---
www.ProtheusWorld.tk
# 2 11-03-2005 , 06:55 AM
Registered User
Join Date: Dec 2004
Posts: 47
i think you need to load the script in the script editor first before you can execute it.

another thing is once it is executed Maya retains it in local memory. I had a problem where i had to quit Maya and reopen the scene file to refresh it if i made any changes, otherwise Maya will keep sourcing the first executed script.

hope that helps...

Lori

# 3 11-03-2005 , 02:50 PM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
if you have a procedure in a file e.g.

global proc alanTest()
{
print("blah\n");
}

you run it with by typing alanTest. However as lori_hunter said you have to source it first. So if I wanted it to pick up my changes each time I ran it I would do this:

source "path to my script";
alanTest;

And then run them togther each time to make sure it's sourced each time. Also the thing lori_hunter said about local memory is true if you declare a variable in the script editor it will stay persistent until you close maya. A good way around this is to encapsulate it in {} brackets. That way it's declared in "scope" and wont affect the global session. Good for testing out stuff.

user added image
Alan


Technical Director - Framestore

Currently working on: Your Highness

IMDB
# 4 11-03-2005 , 03:00 PM
Protheus's Avatar
Registered User
Join Date: Sep 2002
Location: Beyond Oblivion
Posts: 471
thanx all - I never knew that MEL scripting could be so easy. :-)


The Important Thing is NOT to Stop Questioning.
--- Albert Einstein ---
www.ProtheusWorld.tk
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads