Locating Information in this Help File > Locating Sample Scripts >

# Online Help Script Examples

| Quick Navigation - Main Index

The following sample scripts can be found at various places in this Help file as illustrations of certain features. They could be used directly or with small changes in the daily practice or as a starting point for your own scripts. This index should help you locate them quickly.

## Sample Scripts

My First Utility Example

  Shows the creation of simple Scripted Utility.

Skyscraper Extrusion

  Illustrates the usage of EditablePoly extrusion functions

Atmospheric Effects Test Bed

  Illustrates the creation of Atmospheric effects.

Custom Compositing Example

  Shows how to combine two images into one, in this case for anaglyph (red/cyan) stereo display.

Save Multi-Frame Image File

  Shows the correct way for saving multi-frame image files.

Convert Bitmap to Script

  Shows a way to convert a bitmap to MAXScript in order to distribute bitmaps as part of the script code.

NetRender Examples

  Shows the correct way to work with the NetRender interfaces.

TrackBarKeyLimit

  Implements a limit spinner to control the number of keys allowed to be displayed in TrackBar using a trackbar filter callback function.

## Scripted Functions

ApplyPlanarMap

  Shows the application of planar mapping

CalculateVolumeAndCenterOfMass

  Reimplements the Measure Utility's functionality for finding the Volume and Center Of Mass of Geometry Objects.

drawLineBetweenTwoPoints

  Shows how to create a simple line between two points in space.

EdgeVerts

  Returns the two vertices used by an edge in an Editable Mesh.

FlipObjNormals

  Flips all normals of an Editable Mesh by reversing vertex order.

getLocalFaceRotation

  Returns the local face rotation as displayed in the Transform Type-In.

getFilesRecursive

  Returns all files matching a pattern from a given root and all its sub-directories.

TimeFromSolarTime

  Returns the time value stored in a Daylight_Slave_Controller

getFaceSmoothGroupB

  Gets the Editable Mesh Smoothing Groups

setFaceSmoothGroupB

  Sets the Editable Mesh Smoothing Groups

maybe_saveMaxFile

  Shows a replacement function for saveMaxFile to check for existing files and prompting before overwriting.

maybe_saveNodes

  Shows a replacement function for saveNodes to check for existing files and prompting before overwriting.

setNodeWorldRotation

  Sets a node's rotation relative to world space

sortMultiSubById

  Sorts the sub-materials of a Multi/Sub material by their Material IDs.

splitMeshByUVElements

  Splits a mesh to elements based on the UVW Face Elements.

UpperCase

  Converts a mixed case string to upper case to demonstrate the use of various string value related methods.

## MacroScripts

Nitrous NPR Settings MacroScript

  Provides dynamic controls over all aspects of the current NPR (Stylized) visual style of the Nitrous Graphics Manager viewports.

Viewport Shading Explorer MacroScript

  Provides a User Interface to explore the advanced viewport shading settings like Ambient Occlusion, Indirect Illumination, Depth Of Field etc. available when using Direct3D drivers in 3ds Max 2010 and higher.

PolyToElement MacroScript

  Shows how to split every polygon in an EditablePoly into an Element.

Render to RamPlayer

  Illustrates the usage of rollouts and rolloutFloaters in macroScripts

SubObject Vertex

  Illustrates the definition of Macro Scripts

SuperExpertMode

  Implements a Super Expert Mode with just the viewports and main menu visible.

Parameter Wire altExectute

  Illustrates the definition of alternative execute handlers in MacroScripts

MicroListener

  Illustrates the use of the Execute method to convert strings into MAXScript expressions.

Grow/Shrink/Loop/RingSkinSelection

  Implement Skin Selection Grow/Shrink, Loop and Ring ActionItems to be used in QuadMenus when skinning.

## Editable Mesh Selection Converter MacroScripts

Edge2FaceSel

  Convert Edge to Face Selection in Editable Meshes

Edge2PolySel

  Convert Edge to Polygon Selection in Editable Meshes

Edge2VertSel

  Convert Edge to Vertex Selection in Editable Meshes

Face2EdgeSel

  Convert Face to Edge Selection in Editable Meshes

Face2VertSel

  Convert Face to Vertex Selection in Editable Meshes

Vert2EdgeSel

  Convert Vertex to Edge Selection in Editable Meshes

Vert2FaceSel

  Convert Vertex to Face Selection in Editable Meshes

SelOpenEdges

  Select Open Edges in Editable Meshes

## Scripted Plug-ins

Extended Rect Shape Plugin

  Illustrates the creation of Scripted Shape Plug-ins

lightMaster

  Illustrates the application of Scripted Plug-in Methods. See also threeLights.

threeLights

  Illustrates the application of Scripted Plug-in Methods. See also lightMaster.

Negative renderEffect

  Illustrates the creation of Scripted RenderEffect Plug-ins

Normal Spline Modifier Plug-in

  Illustrates the creation of Scripted Modifier Plug-ins

SaddleDeform simpleMod

  Illustrates the creation of Scripted SimpleMod Plug-ins

SquareTube simpleObject

  Illustrates the creation of Scripted SimpleObject Plug-ins

Supa Mod modifier

  Illustrates the creation of Scripted Modifier Plug-ins

SupaGlass material

  Illustrates the creation of Scripted Material Plug-ins

Super Blur FX renderEffect

  Illustrates the creation of Scripted RenderEffect Plug-ins

Super Color Balance FX renderEffect

  Illustrates the creation of Scripted RenderEffect Plug-ins

Super Fog Env atmospheric

  Illustrates the creation of Scripted Atmospheric Plug-ins

Texture Plane SimpleObject

  Illustrates the creation of Scripted SimpleObject Plug-ins with UVW Coordinates

Tower plugin

  Illustrates the creation of Scripted SimpleObject Plug-ins

## How To Tutorials:

How To ... Develop A Transform Lock Script

  Developing a simple script for checking all Transformation locks.

How To ... Remove All Materials

  Creating a very simple script removing all materials from the scene.

How To ... Quickly Rename Selected Objects

  Developing a simple renaming utility to change the names of selected objects

How To ... Select Non-Quad Polygons

  Example of accessing and selecting Polygons in an EditablePoly object.

How To ... Assign Materials Automatically

  Shows how to use MAXScript callbacks to automate material assignment

How To ... Move Objects to a Surface

  Shows how to use the intersectRay function to find surface points on objects.

How To ... Output Object Data To File

  Shows the basic of writing object data to an external text file.

How To ... Output Geometry Data To Text File - Part One

  Shows the basic of writing mesh geometry data to an external text file.

How To ... Read Geometry Data From Text File - Part One

  Shows the basic of reading object data from an external text file.

How To ... Output Geometry Data To Text File - Part Two

  Enhances the mesh geometry output script with support of smoothing groups, material ids and edge visibility.

How To ... Read Geometry Data From Text File - Part Two

  Enhances the input script developed in Part One to support the new data added by the preceding tutorial.

How To ... Create a Quick Preview

  Implements a simple viewport preview and automatic RAMplayer loading

How To ... Access the Z-Depth channel

  A small experiment creating objects based on the Z-Depth of the camera

How To ... Create a MonoChrome RenderEffect

  A simple example of a scripted RenderEffect plug-in

How To ... Create Custom Mesh Object

  Shows how to create a custom mesh object

How To ... Create Scripted Geometry Plug-in

  An example of a scripted geometry plug-in

How To ... Create a Dalmatian TextureMap Plug-in

  An example of a scripted texture map plug-in in the famous polka-dot dog look

How To ... Access Windows System Data

  Shows an approach to access system data that is not directly exposed to MAXScript

How To ... Sort TrackView Alphabetically

  Shows an approach to sort the objects in the TrackView

How To ... Flatten a SplineShape

  Example of modifying a slineShape by moving knots and bezier vectors

How To ... Draw a Freehand Spline

  Example of drawing a spline with the mouse in the ground plane.

How To ... Enhance the Morpher Modifier With Floating Controls

  Example of dynamic UI creation, time and change callbacks usage to create a floater with controls linked interactively to a Morpher modifier.

How To ... Change Objects At Render Time

  An example of changing object properties at render time using callback scripts.

How To ... Develop a Vertex Renderer

  An example of a scripted vertex realtime renderer.

### How To ... Script Particle Flow

How To ... Transfer ParticleFlow Particle Motion To Scene Objects

  An example of moving scene objects using Particle Flow particles.

How To ... Affect Particle Flow Particles by Mass

  An example of applying a Force to particles based on their mass.

### How To ... Develop a Bitmap Painting Tool In Nine Easy Steps

How To ... Develop a Bitmap Painting Tool - Basic Utility

  The first step of the tool creation - The basic tool with a single point brush without strokes support.

How To ... Develop a Bitmap Painting Tool - Strokes Support

  The second iteration of the tool adds continuous stroke drawing.

How To ... Develop a Bitmap Painting Tool - Brush Size and Color

  The third iteration of the tool adds control over the size and color of the brush.

How To ... Develop a Bitmap Painting Tool - Airbrush and Shapes

  The fourth iteration of the tool adds circular brush shape support and an Airbrush option with variable strength.

How To ... Develop a Bitmap Painting Tool - Smooth Brushes

  The fifth iteration of the tool adds a brush with smooth falloff

How To ... Develop a Bitmap Painting Tool - Load and Save

  The sixth iteration of the tool adds bitmap file loading and saving. Finally, you can store your work of art to disk!

How To ... Develop a Bitmap Painting Tool - Erase Changes

  The seventh iteration of the tool adds an eraser option to the right mouse button and a Commit Changes menu option to permanently bake the changes to the image.

How To ... Develop a Bitmap Painting Tool - Unwrap UV Coordinates

  The eight iteration of the tool adds UV texture coordinates unwrapping and realtime updates of the bitmap as diffusemap on a selected object.

How To ... Develop a Bitmap Painting Tool - 3D Painting

  The ninth iteration of the tool adds 3D Painting on a selected object in the viewport.

### How To ... Develop Tools Using DotNet

How To ... Copy The Last Rendered Image To The Windows Clipboard

  This tutorial demonstrates how to use a DotNet class to put the last rendered image into the Windows Clipboard.

How To ... Call a MAXScript Function Periodically using DotNet

  This tutorial demonstrates how to use a DotNet Timer object to call a MAXScript function at given intervals without the need for a rollout.

How To ... Generate Hash Checksums using DotNet

  This tutorial demonstrates how to use a DotNet Timer object to call a MAXScript function at given intervals without the need for a rollout.

How To ... Print Using DotNet

  This tutorial demonstrates how to use a DotNet form to display a file from disk and then print it as multiple pages to the printer.

### How To ... Develop An XView Geometry Checker

How To ... Develop A Face AreaXViewChecker - Part 1

  This tutorial demonstrates how to define and register MAXScript functions with the XView Checker interface introduced in 3ds Max 2010 to perform a Face Area test on geometry objects.

How To ... Develop A Face AreaXViewChecker - Part2

  This tutorial expands on the previous example by adding multiple checker modes and custom text and display override functions.

How To ... Develop A Face AreaXViewChecker - Part3

  This tutorial continues the development of the Face Area Geometry Checker by implementing sticky settings via an INI file.

How To ... Develop A Face AreaXViewChecker - Part4

  This tutorial finishes the development of the Face Area Geometry Checker by implementing a MacroScript to place in the Viewport Menus.