Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Featured Threads
  inspiration alert!!!
(37 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies) Members Gallery
(516 replies)
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

Maxscript help - rotate
show user profile  topofsteel
I've had the hardest time picking up maxscript, really wish they had a robust c# interface. Anyway i'm editing a large site plan and need to move and rotate it before I export it. I had been doing it by hand. :/ The move works, but not the rotate.

for obj in $ do
obj.pos = [500,500,0]

rot_obj = eulerangles x y 250
rotate obj rot_box

Additionally I always apply ProOptimizer and add a UV map, so adding those would be great too. I'm using this as a beginning test project. Thanks.
read 567 times
5/6/2015 1:24:29 AM (last edit: 5/6/2015 1:24:29 AM)
show user profile  herfst1
"obj.pos" works and... "rot_obj" doesn't... so why not try "obj.rot"?

P.S. I'm no expert, just using logic. Could be wrong.
read 565 times
5/6/2015 1:29:07 AM (last edit: 5/6/2015 1:30:17 AM)
show user profile  Garp
@herft: obj.pos is the pos property of obj, rot_obj is a variable name.

@topofsteel: you misspelled the variable: you defined rot_obj but used rot_box.
While we're here, a couple of things. Setting all the objects in the selection to the same location looks like a weird idea. Also, if you're using the same rotation each time around, create the rotation object before the loop, no need to create an identical one at each iteration.
For the rest:
addModifier obj (proOptimizer())
addModifier obj (uvwMap())
More about rotate:
You can use the form: rotate obj a [x,y,z] where a is an angle in degree and the vector [x,y,z] defines the direction around which you rotate. For your example, it would be: rotate obj 250 [0,0,1]
To make it easier, mxs provides the three predefined variables x_axis, y_axis and z_axis, evaluating respectively to [1,0,0], [0,1,0] and [0,0,1]. So you can write: rotate obj 250 z_axis

read 551 times
5/6/2015 2:49:56 AM (last edit: 5/6/2015 3:18:07 AM)
show user profile  herfst1
@ Garp, haha. This is exactly what I'm talking about when I say the friggin' syntax gets me all the time. I've got those maxscript vids bookmarked, will go through them.
read 543 times
5/6/2015 3:10:17 AM (last edit: 5/6/2015 3:10:17 AM)
show user profile  topofsteel
I get the error message "--Unable to convert undefined type to float" The two lines regarding rotation came from the Autodesk help file.

for obj in $ do
obj.pos = [500,500,0]

rot_obj = eulerangles x y 250
obj.rot = rot_box
read 528 times
5/6/2015 10:36:44 AM (last edit: 5/6/2015 10:36:44 AM)
show user profile  Garp
Did you actually read my answer?!
Here. A picture.

read 524 times
5/6/2015 11:01:52 AM (last edit: 5/6/2015 11:02:28 AM)
show user profile  topofsteel
@Garp not before I posted, hadn't refreshed the page. spelling and syntax kill me too. Might as well be using pencil and paper. Thanks for the tips!!
read 496 times
5/8/2015 2:21:57 AM (last edit: 5/8/2015 2:21:57 AM)
#Maxforums IRC
Open chat window