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 07-12-2009 , 07:21 AM
Subscriber
Join Date: Mar 2008
Posts: 33

Duplicate array script

Hi,

I'm just getting started with scripting and I'm trying to create a simple script that would duplicate an object i've created in an array. I found a bunch of tutorial on how to create an array of objects with a for loop and I can get as far as that, but when it comes to duplicates, they all appear on top of each other... Here's my script:

// I'll use a sphere for the purpose of this example
//but in reality it is 2 planes grouped together

polySphere;
rename pSphere1 a1;

int $i;
for($i=1; $i<7; $i++){
duplicate a1;
move ($i*2) 0 ($i*2);
}

Any ideas?

# 2 14-12-2009 , 10:10 AM
Chirone's Avatar
Subscriber
Join Date: Dec 2007
Location: NZ
Posts: 3,125
i tried moving an object in 3d space and seeing what it says in the script editor

don't you need to write it as:
Code:
move -r ($i * 2) 0 ($i * 2);
?




that's a "Ch" pronounced as a "K"

Computer skills I should have:
Objective C, C#, Java, MEL. Python, C++, XML, JavaScript, XSLT, HTML, SQL, CSS, FXScript, Clips, SOAR, ActionScript, OpenGL, DirectX
Maya, XSI, Photoshop, AfterEffects, Motion, Illustrator, Flash, Swift3D
# 3 14-12-2009 , 05:52 PM
NextDesign's Avatar
Technical Director
Join Date: Feb 2004
Posts: 2,988
The -r after move is relative to the last position. -a is absolute, just so you don't get confused user added image


Imagination is more important than knowledge.
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