Sunday, June 14, 2009

Learning MAXscript Day_002: Functions


Refer to the screenshot above,
1st line of the script box() which I assign a box geometry class function.
2nd line of the script is move $box01 [15,10,0] which I move the box geometry that i just created to coordinate X:15 Y:10 Z:0.
3rd line of the script is showProperties $box01 which I use the showProperties function to display the properties(list of parameters that available) for box01.
4th line of the script is $box01.height = 80 which is set the height of box one to integer value 80 by using the .height function.
5th line of the script is $box01.heightsegs = 8 which I set the heightsegments of box01 to 8.
6th line of the script is myBox = $box01 which I set a variable "myBox" equals to box01.
7th line of the script is myBend = bend () which I set a varible "myBend" equals to a bend modifier.
8th line of the script is showProperties myBend which I list the available parameters of bend modifier.
9th line of the script is myBend.bendangle = 90 which I assign the bend angle value of the bend modifier to 90 degree.
10th line of the script is addmodifier myBox myBend which I use the addmodifier function to apply a bend modifier on top of the modifier stack of the geometry Box01.

Here's the snippet of addmodifier function which you can find in MAXscript online help.

Node Common Properties, Operators, and MethodsNode Common Properties, Operators, and Methods

addModifier [before:index] -- mapped

Applies the modifier to all instances of the node(s) to which the function is applied. The optional before: keyword argument can be used to insert the modifier into the node's modifier stack just before the indexed modifier, counting from the top of the stack.

Since 3ds Max 3, addModifier() does not preserve the sub-object selection that might be active in the modifier stack when adding the modifier. If you want to add a modifier and preserve the sub-object selection, use the modPanel.addModToSelection() method described in Modify Panel.

If is a collection, an instance of the modifier is placed on each of the nodes in the collection. Unlike interactively applying a modifier to a selection, the position and size of each modifier instance's gizmo corresponds to position and size of the node the modifier instance is applied to. To apply a modifier to a collection in the same manner that 3ds Max applies modifiers, use the modPanel.addModToSelection() method described in Modify Panel.


That's all for second day. I wish I could procedurally script a cg scene in the future. :)

0 Comments:

Post a Comment

<< Home