CGTalk > Software > Autodesk Maya > Maya Programming
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 05-23-2003, 10:38 PM   #1
Linker
New Member
 
Join Date: May 2003
Posts: 3
Spin

I beguin today Mel ;(

I seek to make spin a cube to a loop on 360° by increment of 30°deg.

On ligntwave I make

' main
{
copy (); // com. copier

for ($x=10; $x<360; $x+=10) //loop 360° by increment 10°

{
rotate (10, "Y"); // rotate on 10 °
paste ();
}
}

But I dont know with Mel....
 
Old 05-24-2003, 02:47 AM   #2
mark_wilkins
Scream.
 
mark_wilkins's Avatar
 
Join Date: Jan 2003
Posts: 1,339
1) Make a cube and rename it cube.

2) Open the Expression Editor

3) Enter the following expression:

cube.ry = frame * 10;

-- Mark

P.S. Sounds like you need a certain textbook!!
__________________
Mark R. Wilkins
author of MEL Scripting for Maya Animators
 
Old 05-24-2003, 03:03 AM   #3
Hugh
Compositor
 
Hugh's Avatar
Hugh Macdonald
2D Supervisor
Nvizible
United Kingdom
 
Join Date: Nov 2002
Posts: 1,465
Quote:
Originally posted by mark_wilkins
P.S. Sounds like you need a certain textbook!!


I think you're right there.....

I'd have to recommend one:

Complete....

sorry, sorry.... my mistake...

MEL Scripting for Maya Animators


I can't remember who it's by, though - but I'm sure a search on Amazon will bring it up.....


__________________
Hugh Macdonald
nvizible
 
Old 05-24-2003, 05:05 AM   #4
Linker
New Member
 
Join Date: May 2003
Posts: 3
Thx for ur reponse and now I discovered Expression Editor but it wasn't this.
I want my cube duplicate all 10° deg on 360.

MEL Scripting for Maya Animators, I heard some speak but actually i beguin and i have only the docs of Ple.
 
Old 05-24-2003, 07:43 AM   #5
mark_wilkins
Scream.
 
mark_wilkins's Avatar
 
Join Date: Jan 2003
Posts: 1,339
ok, here's the MEL script:


nurbsCube;

for (x = 0; x < 360; x += 10) {

duplicate;
rotate 0 $x 0;

}
__________________
Mark R. Wilkins
author of MEL Scripting for Maya Animators
 
Old 05-24-2003, 10:58 AM   #6
Hugh
Compositor
 
Hugh's Avatar
Hugh Macdonald
2D Supervisor
Nvizible
United Kingdom
 
Join Date: Nov 2002
Posts: 1,465
Mark: when you duplicate, don't you end up with both the original and the new object selected?

if I may suggest a slight modification to your script:

$newNurbsCube = `nurbsCube`;
$myNurbsCube = $newNurbsCube[0];

for($x = 0; $x < 360; $x += 10)
{
select -r $myNurbsCube;
duplicate;
rotate 0 $x 0;
}
__________________
Hugh Macdonald
nvizible

Last edited by Hugh : 05-24-2003 at 11:00 AM.
 
Old 05-24-2003, 11:25 AM   #7
mark_wilkins
Scream.
 
mark_wilkins's Avatar
 
Join Date: Jan 2003
Posts: 1,339
Mark: when you duplicate, don't you end up with both the original and the new object selected?

nope, only the new one.

-- mark
__________________
Mark R. Wilkins
author of MEL Scripting for Maya Animators

Last edited by mark_wilkins : 05-24-2003 at 11:29 AM.
 
Old 05-24-2003, 11:36 AM   #8
Hugh
Compositor
 
Hugh's Avatar
Hugh Macdonald
2D Supervisor
Nvizible
United Kingdom
 
Join Date: Nov 2002
Posts: 1,465
Ah yes - of course....

sorry 'bout that....

in which case, shouldn't the line be:

rotate 0 10 0;

as otherwise you'll be getting exponentially larger rotations from the base position....
__________________
Hugh Macdonald
nvizible
 
Old 05-24-2003, 12:55 PM   #9
mark_wilkins
Scream.
 
mark_wilkins's Avatar
 
Join Date: Jan 2003
Posts: 1,339
no, because by default rotate provides an absolute rotation.

However, one could replace

rotate 0 $x 0;

with

rotate -r 0 10 0;

-- Mark
__________________
Mark R. Wilkins
author of MEL Scripting for Maya Animators
 
Old 05-24-2003, 01:16 PM   #10
Hugh
Compositor
 
Hugh's Avatar
Hugh Macdonald
2D Supervisor
Nvizible
United Kingdom
 
Join Date: Nov 2002
Posts: 1,465
'doh

Of course - you're right..... (there shouldn't have been any doubt!)


I've been so used to always using rotate -r that I didn't notice it wasn't there in yours....
__________________
Hugh Macdonald
nvizible
 
Old 05-24-2003, 02:43 PM   #11
Linker
New Member
 
Join Date: May 2003
Posts: 3
Thanx all and mark_wilkins, I understand errors in my script, I forgot the {} ;(

you need a certain textbook Yes, sure I need to buy a good book on Mel.
 
Old 01-15-2006, 06:00 AM   #12
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,480
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 01:50 AM.


Powered by vBulletin
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.