ScriptSpot

Forum topic · Scripts Wanted

Simple Clone Script

By W DIGITAL · 2010-11-21

Description

Hi, can anyone help me with a code to create clones?
It just needs one button ,one spinner,and radiobutton with option of copy or instance
spinner= object count
button=create clones

so when one object is selected, spinner is at 100, it creates 100 duplicates at same position

can anyone help create this simple script?

Comments (6)

W DIGITAL · 2010-11-21

thanks ill try that!

W DIGITAL · 2010-11-21

also,
can someone tell me how i keep this selection after clones have been made?

W DIGITAL · 2010-11-21

rollout roClone "clone"
(
spinner objCount "#:" range:[1,100,50] type:#integer across:2 align:#left width:60
button btndo
radiobuttons clone labels:#("Copy", "Instance","Reference") across:2

on btndo pressed Do (sel = getCurrentSelection()
sf = sel
if (Clone.state == 1) then(
c=objCount.value
for i=1 to c do (
mycyl = copy sf
)
)

if (Clone.state == 2) then(
c=objCount.value
for i=1 to c do (
mycyl = instance sf
)
)
if (Clone.state == 3) then(
c=objCount.value
for i=1 to c do (
mycyl = reference sf
)
)
)
)createDialog roClone 120 100

ok i think i just made my first script!

now another question...

how could i add a function which adds translation to each copy?

so when i have a 2nd spinner, with a value of 1, that each object is translated 1 on x axis

Budi G · 2010-11-21

hi V ...
put offset position in looping commands


for i=1 to c do 
(
   mycyl = reference sf
   mycyl.pos.x += (i*spinner_offset.value) --- offset the copy objects  by spinner
)

about 'spinner_offset.value' is your new spinner

W DIGITAL · 2010-11-21

sel = getCurrentSelection()
sf = sel
if 1==1 then(
for i=1 to 10 do (
mycyl = copy sf
)
)

ok this works, now i just add the button

W DIGITAL · 2010-11-21

spinner objCount "#:" range:[1,100,50] type:#integer across:3 align:#left width:60
radiobuttons clone labels:#("Copy", "Instance","Reference") across:2

for i=1 to c do
(
mycyl = copy a
)

something like that?