Useful MAXScript Tips
Accessing the 3ds Max SDK
You can load the Autodesk.Max.dll
assembly to use the 3ds Max SDK from MAXScript. Add the following MAXScript code to your start-up scripts and use the MaxGlobal variable to access the 3ds Max SDK as shown in the following example.
fn loadAutodeskMax = (
local Assembly = dotNetClass "System.Reflection.Assembly"
local maxroot = pathConfig.GetDir #maxroot
Assembly.LoadFile (maxroot + "\\Autodesk.Max.dll")
local GlobalInterface = dotNetClass "Autodesk.Max.GlobalInterface"
global MaxGlobal = GlobalInterface.Instance
)
loadAutodeskMax ()
See Autodesk.Max.dll for more information about the assembly.
Executing the MAXScript Code
You can execute MAXScript code using the ExecuteMAXScriptScript()
global function. See the maxscript\\maxscript.h
header for more information. Also, see Calling MAXScript from C++.
Text Output to the Scripting Listener Window
You can output text to the Scripting Listener window as follows:
#include <maxscript/maxscript.h>
#include <maxscript/util/listener.h>
...
the_listener->edit_stream->printf("Hello")
// you could also define a handy macro:
#define DebugPrint (the_listener->edit_stream->printf)
See the maxscript/maxscript.h
header for more information.