Frequently Asked Questions

The answers to the following Frequently Asked Questions should help you locate relevant information regarding some often used areas of MAXScript. It also provides direct links to some general programming topics of interest, and solutions to problems prompted by user questions on the online support forums.

MAXScript Syntax and Terminology

How do I understand the function definitions in this document?

What Are Mapped Operations in MAXScript?

What is Scope of variables?

When do I use If...Then and when If...Do?

When do I use () after a function?

What is the difference between 'undefined' and 'unsupplied' values?

What is the difference between '=' and '==' operators?

What is the differences between Arrays and BitArrays?

How do I get the file name of the current scene?

The Wonderful World of Classes and Class Instances

General Advanced Topics

How do texture coordinates work?

How are Transformations calculated in 3ds Max and MAXScript?

Practical Questions

Working With Vectors

How do I make a vector from a vertex position?

How do I find the angle between two vectors?

How do I find the angle between 3 vertices?

How do I rotate a vector around the Z axis?

Working with MAXScript Values

Why does Execute return 'undefined' when accessing a loop variable?

How do I create a multi-dimensional array?

How do I calculate the Volume of an Object?

How do I check if a string contains only numbers?

How do I remove duplicate arrays from an array?

How do I filter a string including empty entries?

Working With Files

How do I set the default path for file operations in MAXScript?

Accessing Object Properties

How do I change a property in multiple objects at once?

How do I change the Shadow type of a Light?

How do I get the object by object name?

How do I access the Alpha values shown in the viewport?

How do I change the text in a Text Shape dynamically?

How do I Sort a MultiMaterial By Material ID?

Working with Scripted UI

How do I access UI elements to change their properties?

How do I display a value in a Rollout?

How do I update the items in a dropdownList or listBox?

How do I call the dropdownList Selected handler as a function?

How do I uncheck a MacroScript button correctly?

Working with Scene Nodes

How do I create a line between two points?

How Do I instance Modifiers and Controllers inside the same object?

How do I get a Space Warp by Binding?

How do I delete randomly a specified percentage of geometry objects?

How do I Create a Button to Show the Next Object?

How do I batch-process multiple .MAX files?

Can I use data from external files to control my scene or animation?

Working with Editable Meshes

How Do I Get the Local Rotation of a Face?

How do I Split a Mesh by UV Elements?

How do I align the UVW_Modifier's Gizmo to a selected face?

How Do I Select a Face of an Editable Mesh by its Index?

How Do I Get Faces With Normals Facing Away?

Working with Editable Polys

How do I build Unconnected Edges Selections from EPoly Edge Selection?

How do I remove mid-edge EPoly Vertices?

How do I Select Edges Between Material IDs?

Working with Animation

How do I link the rotation of an object to the scene time?

How do I keep a Plane aligned to 3 Point Helpers?

Writing Better and Faster Scripts

Disable Viewport Redraws when making changes to scene objects

Disable Undo system when possible

Modify Panel can be slow -change to Create Panel when possible

Use the 'flagForeground' node viewport state method

Never get a single pixel when you can get a whole line

Only calculate once if possible

Cache freqeuntly used functions and objects

Dice your data into smaller pieces

Use bitArrays instead of Arrays when possible

Pre-initialize arrays when final size is known

Recursive functions can be faster

matchPattern is faster than findString

Do not use return, break, exit or continue

Use StringStream to build large strings

Use name values instead of strings when possible

Try not to use Execute function if there is an alternative

For Loop By Index Vs For Loop Through Collection Performance

For Loop Collect Vs For Loop Do Performance

Optimizing Particle Flow Script Operator For Loops For Speed

Using Bsearch For Fast Table Lookup

How To Make It Better?