Back

Customize 3ds Max with Script Buttons

We can use script buttons to assist us with production. First, we need to create a custom toolbar. Select the Customize Menu, and then, Customize User Interface.  Inside the Customize User Interface dialogue box, select Toolbars and choose New to create the toolbar and then assign it a name. Doing this will generate an empty toolbar. Drag and drop the toolbar anywhere on your screen, or dock it in your interface, just like the standard toolbars inside 3ds Max. See Figure 1.

Figure 1

Now we’ll create the buttons.  Right-click over the Listener Window text boxes on the bottom left of the 3ds Max interface and select the Open option.  With the Listener Window open, we’ll create our first script. This script will allow us to apply a threshold to weld vertices and weld selected ones accordingly. The script is two lines:

Script One – Weld Vertices

Welding vertices is one of the most common tasks for 3D Modeling and useful to optimize and check models for disconnections. The script is below:

$.weldThreshold = 1

$.EditablePoly.weldFlaggedVertices ()

If you closed the Customize User Interface dialogue box re-open it. The box is required to be open to add scripts to our toolbar.  With the text pasted in the Listener Window, highlight the text, then drag and drop it onto your toolbar.  Doing this will generate a custom icon on our toolbar. See Figure 2 for Example.

Figure 2

To add the next script, clear the Listener Window by deleting all the text and replacing it with the new scripts, dragging and dropping them onto your toolbar to generate buttons for each one.

Script Two – Place Sphere on Top of Object

Spheres can be used in scenes to reflect information. A neutral gray sphere reflects the direction of light and shadows, while a reflective sphere presents a reflection of the environment used when rendering the scene.  They can be used to block out the base of a character or object before sculpting in software like Mudbox or Zbrush.

newPos = [($.max.x+$.min.x)/2, ($.max.y+$.min.y)/2, $.max.z ]

sphere pos:newPos

Creation Scripts

Simple scripts can be used to insert standard primitives. For example, to insert a box the script is only one line of code:

Box()

The same is true for the other standard primitives.

Modifier Scripts

Adding a modifier to a selected object using a script button is simple. Here is an example adding the Bend Modifier to a selected object:

addModifier $ (Bend())

We can even add buttons to adjust render settings such as the the height and width:

renderWidth = 1920

renderHeight = 1080

Be sure to save your custom toolbar and workspace when you are finished creating your script buttons.

Brian Chapman is an Autodesk Authorized Developer, Digital Artist, Designer, and a CAD Application Specialist for an engineering firm located in Las Vegas, Nevada. Brian shares tips and tricks at procad.blog with a portfolio of digital artwork and renderings at emptypawn.com. Brian’s email is procadman@pro-cad.net

Appears in these Categories

Back