Loop copy object, translate with local pivot and rotate

Hello,

I'm trying to do like in this picture : http://imageshack.us/a/img855/5153/explanation.jpg

I wrote these lines, but I don't know how to make it work :

-- size of the object
dim_selobj =  (selobj.max - selobj.min)
 
-- object.min pivot
selobj.pivot = selobj.min
 
-- object coordonate
selobj_x = selobj.pos.x
selobj_y = selobj.pos.y
selobj_z = selobj.pos.z
 
for i = 1 to 10 do
(
		rot_angle_z = 45 -- theta angle
		rot_angle = eulerangles 0 0 rot_angle_z
		rotate selobj rot_angle
		selobj_copy_x = copy selobj
		in coordsys local selobj_copy_x.pos = [-i * dim_selobj[1] + selobj_x,selobj_y,dim_selobj[3]]
 
)

Comments

Comment viewing options

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

between your two posts i

between your two posts i changed your script a bit. just run it in empty scene...
maybe this helps you.

the difference is i do work with my last instance/copy instead with the base/start object.

rotationDegree = 13
instanceCount = 23
 
selobj = box length:4 width:8 height:4
 
 
 
-- size of the object
dim_selobj =  (selobj.max - selobj.min)
 
-- object.min pivot
selobj.pivot = selobj.min
 
-- object coordonate
selobj_x = selobj.pos.x
selobj_y = selobj.pos.y
selobj_z = selobj.pos.z
 
 
 
lastObj = selObj
 
for i = 1 to instanceCount-1 do
(
 
		tmpIns = instance lastObj
 
		in coordsys local tmpIns.pos = [tmpIns.pos[1]+dim_selobj[1],tmpIns.pos[2],tmpIns.pos[3]]
 
 
		rot_angle = eulerangles 0 0 -rotationDegree
		rotate tmpIns rot_angle
 
 
		lastObj = tmpIns
 
 
)
Rodman's picture

Thank you ! It works !

I'm gonna adapt it to my code and i'll tell you the result. :)

Rodman

Rodman's picture

New problem

Every script with a loop done on the rotate will be false if the result is a float value. I'm disappointed to see that 3ds max needs more precisions.

You can read this to see how much it's not precise :
http://area.autodesk.com/forum/autodesk-3ds-max/maxscript/how-to-increas...

Rodman

barigazy's picture
Rodman's picture

I don't know which video to

I don't know which video to see. But from what i see, there is a spline and I don't want to use it, and moreover I don't want to animate.

The problem in my script is the loop is made on the first object. But the loop should be on the last object created.This is my problem.

Thanks for your help by the way. :)

Rodman

Comment viewing options

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