Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 07-12-2009, 07:21 AM   #1
Join Date: Mar 2008
Posts: 33
Thanks: 0
Thanked 1 Time in 1 Post
Default Duplicate array script


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

rename pSphere1 a1;

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

Any ideas?
garch is offline   Reply With Quote
Old 14-12-2009, 10:10 AM   #2
Chirone's Avatar
Join Date: Dec 2007
Location: NZ
Posts: 3,124
Thanks: 11
Thanked 147 Times in 143 Posts

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:
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
Chirone is offline   Reply With Quote
Old 14-12-2009, 05:52 PM   #3
Technical Director
NextDesign's Avatar
Join Date: Feb 2004
Posts: 2,982
Thanks: 33
Thanked 532 Times in 471 Posts

The -r after move is relative to the last position. -a is absolute, just so you don't get confused
Imagination is more important than knowledge.
NextDesign is offline   Reply With Quote

A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.