In the previous lessons you have seen some of MAXScript’s useful capabilities; however, nothing that is visible in the interface. MAXScript is also useful for working with regular objects, such as boxes or cylinders. You can draw a box in MAXScript just by entering the box() command:
This creates a box with the default parameters. It is generally better practice to assign an object to a variable, so you can later refer to it by name and manipulate it using that name:
When you use MAXScript to create an object without specifying any parameters, it is important to use empty parentheses, "()". This tells MAXScript to use the default parameters for the object. If you want to specify any of the parameters during creation, such as the size or location of the object, you do not need parentheses.
MAXScript returns the box object name and the position of the box:
This example creates a box, and supplies three parameters: the length, width, and height of the box. The parameter names are followed by a colon and then by the value for that parameter. You can enter all parameters, without any punctuation between them.
MAXScript returns the following statement:
The first part of the statement is called a pathname.
A pathname in MAXScript is similar to a pathname in Windows, such as c:\3dsmax\examples\file.max, which represents a path through a hierarchy of directories pointing to a particular file. In MAXScript, a similar path concept is used. However paths in MAXScript end up pointing to objects, not files. Pathnames in MAXScript always begin with the "$" character. For more information on Pathnames, see the Pathname Literals topic in the MAXScript reference.
The second part of the statement is the object name:Box01, in this case.
The values inside the brackets represent the x, y, and z coordinates of the center of the box.
MAXScript also draws the box in the viewports, as shown in this perspective viewport:
Notice that you can use Undo (as you can with most MAXScript creation and modification commands) to remove the box from the scene.