mybox = box()
The following lines prepare our box for more complex transformations. They change the number of box segments on all sides, and put a check mark into the Generate Mapping Coords. box in the Parameters rollout:
MAXScript has changed the appropriate settings in the Parameters rollout:
Any time you change a property of a 3ds Max object, MAXScript immediately reflects the change in the scene and in the user interface.
You can also create modifiers and add them to an object.
Creating a modifier is pretty simple. You use the addModifier command and specify the name of the modifier you want to use and its appropriate parameters.
To create a Twist modifier set to 30 degrees and apply it to your box,
The box in your Perspective viewport is now twisted and the interface shows the new Twist modifier in the modifier stack display, together with its parameters:
Changing a modifier is similar to changing a creation parameter. Again, because you used a variable name for your object, and you added a modifier to that object variable, you now have easy access to the new modifier properties of your object.
To change the angle of the twist modifier to 60 degrees,
The twist of your box is now more pronounced and the Angle parameter of the Twist modifier displays the new value:
From here on, you can add and change other modifiers as you like. The syntax is the same for all modifiers. To find out the names of other modifiers, search for the "Modifier : MAXWrapper" topic in the MAXScript Reference.
If you entered the above commands, click Undo twice to bring the box back to its original state.
MAXScript has several syntax forms that mirror the main UI tools, such as the Auto Key button, the time slider, and the active coordinate system.
In the following example, you turn on the Auto Key button, set the slider to several different values, and adjust the properties of your box, just as you would do using the software’s UI:
Drag the slider around, and you will see that MAXScript has animated the box, and placed keyframes at 0 and 100.
When you use MAXScript to animate objects, the actual Auto Key button in the UI does not come on, nor does the time slider move; these things happen within MAXScript.
In this example, the time was given as a simple number. If no unit is specified, MAXScript interprets this as a frame number. You can also use one of the various time literals in the following manner: