Introduction
NodeWorks supports scripting through the C# Script node, allowing multiple script nodes within the editor, each executing different tasks. The integrated script editor provides essential development features, including syntax highlighting, function call tips, auto-completion, and compile error line bookmarks, streamlining the scripting workflow.
Script Compilation
For any script changes to take effect, the script must be compiled. Compilation can be triggered by:
- Clicking the Compile Script button on the node`s user interface.
- Using the script editor Compile menu option.
- Pressing ALT + C.
Additional shortcuts:
- Press ALT + C to compile the script.
- Hold ALT + CTRL during scene loading to skip script compilation.
Scripting capabilities can be expanded by including external assemblies and additional C# files.
Including External Assemblies
To include additional assemblies, use the nxLibrary() function at the top of the script.
By default, Autodesk.Max.dll is included.
void nxLibrary(assembly_path);
static void SimulationStart()
{
...
Including Additional C# Scripts
To reference external C# files, use the nxInclude() function at the top of the script.
void nxInclude(script_path);
static void SimulationStart()
{
...
Path Variables
The following variables can be used to define file paths within the script:
- 3ds Max root folder path: $maxroot
- Path to the scene file: $maxscene
- Environment path variable (retrieved from Windows Environment Variables): $env(string environment_variable_name)
These variables allow for dynamic path resolution, enabling flexible script configurations.