Example: dental hygienist

3DATS 3ds Max Training MAXScript Cheat Sheet 1/2

3 DATS 3ds Max Training MAXS cript Cheat Sheet 1/2. How and where to enter commands MAXS cript Listener MAXS cript>MAXS cript Listener or F11 ARRAYS (= collection of values and objects of arbitrary types). MAXS cript Editor MAXS cript>New Script a = #( $Box01, $Box02, $Box03 ) array definition with three objects evaluate with CTRL-E or Tools>Evaluate All returns number of elements in array Selecting objects, $ and wildcards a [1].renderable = false access elements of array with brackets [ ]. $ current selection Random Values $Box01 object with the name Box01 . $. = random 0 10 random value between 0 and 10 (integer).

MAXScript Cheat Sheet 1/2 3DATS 3ds Max Training 03/2010 compiled by Markus Boos project|gemini VFX Technical Direction relief7@projectgemini.net http://www.projectgemini.net ...

Tags:

  Training, Sheet, Teach, 3dats 3ds max training maxscript cheat sheet 1 2, 3dats, Maxscript

Information

Domain:

Source:

Link to this page:

Please notify us if you found a problem with this document:

Other abuse

Advertisement

Transcription of 3DATS 3ds Max Training MAXScript Cheat Sheet 1/2

1 3 DATS 3ds Max Training MAXS cript Cheat Sheet 1/2. How and where to enter commands MAXS cript Listener MAXS cript>MAXS cript Listener or F11 ARRAYS (= collection of values and objects of arbitrary types). MAXS cript Editor MAXS cript>New Script a = #( $Box01, $Box02, $Box03 ) array definition with three objects evaluate with CTRL-E or Tools>Evaluate All returns number of elements in array Selecting objects, $ and wildcards a [1].renderable = false access elements of array with brackets [ ]. $ current selection Random Values $Box01 object with the name Box01 . $. = random 0 10 random value between 0 and 10 (integer).

2 Select $Box01 select object with the name Box01 . $ = random random height between 2 and 5 (float). $Tile* objects whose names start with Tile . $.rotation = random z rotation (enter as one line). $'Tile A'* objects whose names start with Tile A (use this eulerangles 0 0 ( random 360 ). for objects with whitespace characters). $. = random blue part of diffuse color $* all objects color 0 0 ( random 0 360 ). Access and Modification of Object Properties Outputting Values to the MAXS cript Listener $.name = table set name of current object to table print $.position print position of current object $ = 10 set width of object Box01 format % objects selected.

3 Selection. output number of selected objects count $ = 5 set radius of object Sphere01 . $.renderable = false turn off renderable property of current object Hierarchies and Animation $.<property> = value general syntax for modifying properties $ = $Wall link tile to wall object Transforming Objects $.children [1].name = Tile_01 set name of first child object animate on with Autokey on, move object at frame 50. move $ [10, 0, 0] move relatively by 10 units in x ( at time 50f ( move $ [0, 0, 5] ) ). rotate $ (eulerangles 90 0 0) rotate relatively by 90 degrees around x animate on with Autokey on, set radius at frame 100.

4 Scale $ [2, 2, 1] scale twice in x and y, z is unchanged ( at time 100f ( $.radius = 10 ) ). $.position = [10, 10, 0] set new absolute position $. = $. + 10 move object up by 10 units ObjectSets ObjectSets are collections of the current scene objects divided into the main 3ds max $.rotation = ( eulerangles 0 0 90 ) rotate by 90 degrees around z object type categories / classes. $.scale = [1, 1, 2] set new scale value: twice as high in z objects all objects in the scene geometry primitives, meshes and other geometry objects Creating Objects, Modifiers and Materials lights lights (includes VRay and other third party lights).

5 Box () create regular box at the origin cameras cameras Box pos:[-5, 5, 0] wirecolor:red create a red box at [-5, -5, 0]. helpers helpers addModifier $ ( Bend() ) apply bend modifier shapes lines, circles, rectangles, splines addModifier $ apply taper modifier with amount 1 and y as ( Taper amount:1 primaryaxis: 1 ) primary axis (enter command as one line) systems systems ( bones). $.material = StandardMaterial() apply standard material spacewarps forces, spacewarps, deflectors etc. $.material = VRayMtl() apply VRay material selection current selection (this is the same as $). $.material = VRayMtl diffuse:green apply green glossy reflective VRay material reflection:gray reflection_glossi- Nifty one-liners.

6 Examples for using ObjectSets to apply a command to a bigger group of objects $. = color 255 0 0 change diffuse color to red (for VRay the name of this property is diffuse, for delete cameras deletes all cameras in current scene standard materials it is diffuseColor !) delete $lights/Fill* delete all lights starting with Fill . hide shapes hides linework Variables and data types, strings, arrays freeze geometry freeze all geometric objects SCALAR VARIABLES (= numbers, standard mathematical operations: +, -, *, /, ^). $*.material = undefined removes all materials of scene w = 10 assign the value 10 to w h = 10 assign the value 10 to h $Tile*.

7 Material = () apply currently selected material in editor to all a=w*h calculate the area a objects whose name starts with Tile . STRINGS (= characters/text/symbols). strPrefix = LIGHT_ assign string to a variable $.name = strPrefix + $.name apply prefix to object name 03/2010. compiled by Markus Boos project|gemini VFX Technical Direction 3 DATS 3ds Max Training MAXS cript Cheat Sheet 2/2. MAXS cript control structures Loops renderHeight = 1080 set render height (vertical resolution). For-Loops are useful for parts of code that need to be executed more than once or, for example, when you would like to change a certain property for many objects.

8 RendSaveFile = true activate writing render to disk for i = 1 to 10 do create 10 boxes at different x positions rendOutputFilename = set render output file path ( P:\\viz01\\ . Box pos: [i * 30, 0, 0] .. for a full list of render parameters, please consult ) the MAXS cript reference for obj in (selection as array) set scale value for cylinders in current selection max quick render equivalent to pushing the render button where classOf obj == Cylinder do ( render camera:$Camera01 frame:100 additional function to kick off renders indepen- = 2 outputfile: P:\\viz01\\ dent of the current render dialog settings ).

9 Conditional Statements Renderer-Specific Settings ( VRay). Conditional statements are used to make a decisions based on comparisons at runtime. They = VRay() set current renderer to VRay allow you to create different branches and to control the program flow. set adaptive sampling min rate If ( $. < 0 ) then set wirecolor to red if object is below 0, other- Subdivision_minRate = 1. $.wirecolor = red wise green else set adaptive sampling max rate $.wirecolor = green Subdivision_maxRate = 2. if ( superclassof $ == Light) then delete$ delete current object if it is a light = true turn on VRay's GI calculation Functions.

10 For a full list of your renderer's parameters, please This is an example function to calculate the volume value from width, length and height. It consult its user manual will return the result, in this case the volume calculation. Generally, functions can be used to encapsulate code of any type or purpose to prevent repetition and clutter within bigger scripts. Rollout Floater Basic Framework function calculateVolume w l h = Function definition: What are the expected The following code is a basic framework for building your own tools with graphical user ( parameters ( width, length, height) and interfaces (such as rollouts, buttons, sliders etc.))