Running the OLE Demo

The example supplied consists of 2 files: -- a MAXScript script containing a grapher interface

oledemo.xls -- an Excel spreadsheet with some data and a VBA script to call the grapher

To run the example, make sure you've registered 3ds Max as an OLE server as described in Setting Up MAXScript OLE Automation, start 3ds Max and open the script file in a script Editor window. You'll see it contains definitions for six functions and a call to registerOLEInterface() to expose some of those functions. Select the whole script and press number pad ENTER to evaluate it. This defines the functions and exposes them through OLE.

Start Excel and open the oledemo.xls spreadsheet (in the scripts directory). It contains one worksheet and one module sheet and defines a new Max menu. The worksheet contains some example data to be charted and the module sheet contains the VBA scripts that implement the menu commands in the new 3ds Max menu.

Bring up the sheet1 worksheet. It contains a table of numbers representing quarterly sales figure for a number of regions. Drag-select all the label and figure cells and choose the Max > Build Animated Chart menu. This opens a connection to 3ds Max and passes the selected column labels and figures to the appropriate functions in the exposed interface. It then brings 3ds Max to the front which chugs away for a bit building the labeled bar chart and animating the bars over the range of quarters given. Drag the slider to see the bars animate. Business graphs in 3ds Max!

The Max > Render Movie menu in Excel invokes another of the exposed MAXScript functions that creates and animates a camera in the bar chart scene and then sets off a render to an AVI file. (If you want to interrupt the render, hold down the ESC key until it stops at the beginning of the next frame - currently the MAXScript renderer interface only looks at the ESC key between frames).