Simple Clone Script

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

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
W DIGITAL's picture

thanks ill try that!

thanks ill try that!

W DIGITAL's picture

also, can someone tell me how

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

W DIGITAL's picture

rollout roClone

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's picture

hi V ... put offset position

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's picture

sel =

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's picture

spinner objCount "#:"

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?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.