Hi,
I'm new to maxscript and I managed to make this little script to attach every selected objects together.
objArr = for i in $ collect i
mainObj = objArr[1]
count = objArr.count
undo off(
convertTo objArr Editable_Poly
for i = 2 to count do (
polyOp.attach mainObj objArr[i]
)
)
I used google a lot to make this first script and I don't quite understand that part:
objArr = for i in $ collect i
if I used only $ instead to select my objects, only one object on 2 was attached...
Can someone please help me understand why it was doing that and what this for loop does exactly?
Thank you!
By
Comments (4)
Comment policy
the reason
only merges 2 objects is because in this case objArr is assigned the reference (points to) the actual $selection which changes dynamically depending on what you have selected.
or
or collect loop that you used all will return an array of references to the objects themselves and will not change with your selection, which is what you need.
thanks for the hint, I understand that better :)
Read this thread. Don't use
Read this thread.
Don't use $, use this:
but this for loop is unnecessary. You don't need to loop through all objects to make an
array, because Selection as array will give you what you want
Just deleted html tags
Miauu's code without html tags ;)