how to make array and select this after cloning
hi, can anyone help me with this, its very simple, i simply want to select the clones after script has run,
select mycyl does not work, and i have tried others stuff as well (also reading anubis array tutorial), i still cant get it, and cannot find help in maxscript documentation
isnt mycyl already an array, or if not, how do i make this one, and then how do i select this array?
thanks for your help!
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
)
)
Comments
anubis i really appreciate
anubis
i really appreciate your help
and i have been trying for past 4hours to get this stupid code to work
the clones was no problem, only this silly selection at the end
now i really try with your copy function
but of course it not work-
your versionworked
but it only made 2 copies, and not the value given in the spinner objCount-
so i try, i really try to make it work but of course it doesnt
on btndo pressed Do
(
--local boxes = selection as array
fn CopyAndSelect objArray = (
currObjs = objects.count
c = objcount.value
copy objArray
newObjs = for i = (currObjs+1) to c collect objects[i]
select newObjs
)
CopyAndSelect (getCurrentSelection())
)
// www.v-motion.co //
haha i tried exactly that
haha
i tried exactly that line
local boxes = selection as array
but of course it not work :)
but i guess with your copy and select function it should work
trying now
// www.v-motion.co //
ok now i am totally confused,
ok now i am totally confused, head is spinning :|
on btnClone pressed Do (
local boxes = selection as array
--obj = selection[1]
num = objCount.value-1
type = Clone.state
objArray = (
case type of (
1: for c = 1 to num collect (copy obj)
2: for c = 1 to num collect (instance obj)
3: for c = 1 to num collect (reference obj)
)
)
insertItem boxes objArray 1
select objArray
)
can you just tell me how i can have this (your code) on more than one object
the code i had before worked fine on more objects, and now it doesnt :(
// www.v-motion.co //
write your custom functions
hehe, you replace the single node with array of objects:
while still using Max builtin mapped functions - copy(), instance() and reference(). ah, nor yet change the variable 'obj' into the 'copy obj' and so on.
you have a CopyAndSelect function from me. you can a) extend it to clone instances and references, or b) write another 2 functions for that purpose. and finally rewrite the code dependent on how you wrote your function(s).
my recent MAXScripts RSS (archive here)
Copy is a mapped function
Most mapped functions (like Copy) return OK, not array of objects then called on objectset/collection of objects.
hope this help ;-)
my recent MAXScripts RSS (archive here)
hi anubis now i realize it
hi anubis
now i realize
it only lets me clone one object :(
obj = selection[1]
but i want freedom to clone 2 or 10 objects
instantly
how i change it?
// www.v-motion.co //
yes anubis i really wish i
yes anubis
i really wish i could program
have so many ideas as you know :)
ok, just one question
how can i make a button
which just selects this array?
Button btncselect "C"
on btnCselect pressed Do (
select objArray
)
does not work :D
// www.v-motion.co //
yes ok i forgot in the code
yes ok i forgot in the code here to write obj_copy #()
but i have done it
the code from budi i still get error
> MAXScript Rollout Handler Exception: -- Runtime error: operation requires a collection of nodes, got: OK <<
code:
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
(-- start btndo
sel = getCurrentSelection()
sf = sel
obj_copy=#() -- empty array
----------------------
if (Clone.state == 1) then
(
c=objCount.value
for i=1 to c do
(
mycyl = copy sf
append obj_copy mycyl -- append
)
)
----------------------
select obj_copy -- select copy array colection only
--selectmore obj_copy -- select copy array colection with original selection
)-- end btndo
)createDialog roClone 120 100
i am happy i have ur solution that works
but if i can know why first solution not work
then i learn something even more :D
// www.v-motion.co //
so, a problem has been
so, a problem has been resolved ... :D
congratulation V
My English is poor to explain a lot about it.
so sorry for that...
and thanks to anubis ;D
budi i wrote u email still
budi i wrote u email
still thanks for your help as well!
// www.v-motion.co //