3ds Max for VS CodeSend MaxScript and Python code from VS Code to Autodesk 3ds Max, with full MaxScript language support. Features
Requirements
InstallationFrom VS Code Marketplace
From
|
| Shortcut | Command | Context |
|---|---|---|
Shift+Enter |
Send File | MaxScript or Python file |
Alt+Shift+E |
Send Selection | Any editor |
Alt+Shift+I |
Select Instance | Any context |
Sending Code
- Open a MaxScript (
.ms) or Python (.py) file in VS Code - Press
Shift+Enterto send the entire file, or select code and pressAlt+Shift+Eto send the selection - If no 3ds Max instance is selected, you will be prompted to choose one automatically
Status Bar
The status bar at the bottom shows the current connection state:
3ds Max: Not Connected— click to select an instance3ds Max: 2025— connected to 3ds Max 2025 (shows the version year)
How It Works
The extension communicates with 3ds Max using the Windows API:
- Finds running 3ds Max windows via
EnumWindows - Locates the MAXScript mini listener window (class
MXS_Scintilla) - Sends commands via
WM_SETTEXTand simulates pressing Enter viaWM_CHAR
For MaxScript files, it sends: fileIn @"C:\path\to\file.ms"
For Python files, it sends: python.executeFile @"C:\path\to\file.py"
Selections are written to a temp file first, then executed via the same mechanism.
Settings
| Setting | Default | Description |
|---|---|---|
3dsmax-vscode.extendSelectionToFullLines |
true |
Extend selection to cover full lines before sending |
3dsmax-vscode.wrapSelectionInParentheses |
true |
Wrap MaxScript selection in () for local variable scope |
Snippets
| Trigger | Description |
|---|---|
fn |
Function definition (short form) |
function |
Function definition (long form) |
ifdo |
If-Do block |
ite |
If-Then-Else block |
struct |
Struct definition |
structgui |
Struct with GUI rollout |
structmod |
Struct module pattern |
rollout |
Rollout dialog |
group |
Rollout group |
on |
Event handler |
for |
For loop |
forcollect |
For-collect expression |
Troubleshooting
"No running 3ds Max instances found"
- Make sure 3ds Max is running
- The window title must contain "Autodesk 3ds Max"
"MAXScript Listener not found"
- Open the MAXScript Listener in 3ds Max:
MAXScript > MAXScript Listeneror pressF11 - Make sure the mini macro recorder is visible (bottom-left status area of the 3ds Max window)
Code doesn't execute
- Click in the mini listener in 3ds Max to make sure it's active, then try sending again
- Check the MAXScript Listener output for error messages
Shift+Enter doesn't send the file
- The keybinding only activates when the file language is
maxscriptorpython - For
.msfiles, the language should be auto-detected. If not, click the language indicator in the VS Code status bar and select "MaxScript"
Development
This section covers how to work on the extension locally, build it, and publish it.
Prerequisites
Local Setup
git clone https://github.com/your-username/3dsmax-vscode.git
cd 3dsmax-vscode
npm install
Running Locally (Testing)
- Open the project folder in VS Code
- Press
F5— this compiles the extension and launches a new VS Code window (Extension Development Host) with the extension loaded - In the Extension Development Host, open a
.msor.pyfile - Test the commands via the keyboard shortcuts or Command Palette (
Ctrl+Shift+P> "3ds Max:")
Watch mode for iterative development — auto-recompiles on file changes:
npm run watch
Then press F5. Any changes you make to TypeScript files are recompiled automatically. Reload the Extension Development Host (Ctrl+R) to pick up changes.
Build Commands
| Command | Description |
|---|---|
npm run compile |
Type-check and build once |
npm run watch |
Watch mode (auto-rebuild on changes) |
npm run package |
Production build (minified) |
Project Structure
3dsmax-vscode/
├── src/
│ ├── extension.ts # Entry point — registers commands
│ ├── winapi.ts # Windows API wrapper (koffi + user32.dll)
│ ├── maxConnection.ts # Connection state and status bar
│ └── commands.ts # sendFile, sendSelection logic
├── syntaxes/
│ └── maxscript.tmLanguage.json # MaxScript syntax grammar
├── snippets/
│ └── maxscript.json # MaxScript code snippets
├── language-configuration.json # Comment, bracket, folding rules
├── package.json # Extension manifest
├── tsconfig.json # TypeScript config
└── esbuild.js # Bundler config
Publishing
One-Time Setup
Create an Azure DevOps organization at https://dev.azure.com (free)
Create a Personal Access Token (PAT):
- Go to your Azure DevOps organization
- Click your profile icon > Personal Access Tokens > New Token
- Name:
VS Code Marketplace - Organization: All accessible organizations
- Scopes: check Marketplace > Manage
- Click Create and copy the token (you won't see it again)
Create a publisher at https://marketplace.visualstudio.com/manage:
- Choose a unique publisher ID (e.g., your GitHub username)
- Set a display name
Update
package.json: replace"publisher": "your-publisher-id"with your actual publisher IDLogin with vsce:
npx @vscode/vsce login <your-publisher-id> # Paste your PAT when promptedYou can upload it manually at https://marketplace.visualstudio.com/manage by clicking your publisher > New Extension > VS Code > drag/drop the .vsix file.
Building a .vsix Package
npx @vscode/vsce package --target win32-x64
This creates a .vsix file you can share directly or install via "Install from VSIX..." in VS Code.
The --target win32-x64 flag is required because the extension includes a native module (koffi) with platform-specific binaries.
Publishing to the Marketplace
# Publish for Windows x64
npx @vscode/vsce publish --target win32-x64
# Or publish for multiple Windows architectures
npx @vscode/vsce publish --target win32-x64 win32-arm64
Version Bumping
npx @vscode/vsce publish patch # 0.1.0 → 0.1.1
npx @vscode/vsce publish minor # 0.1.0 → 0.2.0
npx @vscode/vsce publish major # 0.1.0 → 1.0.0
Sharing via GitHub (Without Marketplace)
If you just want to share the extension via GitHub without publishing to the marketplace:
Push your code to GitHub:
git init git add . git commit -m "Initial commit: 3dsmax-vscode extension" git remote add origin https://github.com/your-username/3dsmax-vscode.git git branch -M main git push -u origin mainBuild a
.vsixpackage:npx @vscode/vsce package --target win32-x64Create a GitHub Release and attach the
.vsixfileOthers can install it via:
Ctrl+Shift+P> "Extensions: Install from VSIX..."
Credits
- MaxScript syntax grammar based on sublime3dsmax by Christoph Buelter and Rogier van Etten
- Communication approach inspired by VSCode-SendTo3dsMax
- Uses koffi for Windows API integration