max_python
Runs Python code inside 3ds Max for computation, string processing, data shaping, and MaxPlus-only APIs, returning a JSON-serializable result; use it for logic, not scene edits.
Instructions
Execute Python inside Max (2.7 + MaxPlus) -- a second engine, chosen explicitly.
WHEN TO USE THIS (measured on real Max 2016, see tests/bench_*):
pure computation, string building, dict/list work: Python is 7-100x faster than MAXScript (100k loop 6 ms vs 55 ms; 5k string concat <1 ms vs 177 ms)
scene access is the opposite: creating 200 boxes MAXScript 30 ms vs MaxPlus ~260 ms; walking 200 nodes MAXScript 1 ms vs ~2 ms. So: never drive the scene from here. Use it for logic, parsing, data shaping, or MaxPlus-only APIs, then hand the result back.
The script runs with result as the value that gets returned:
result = [n.GetName() for n in ...]
Set result on the last line; anything JSON-serializable works.
CAVEATS on Max 2016: Python is 2.7 and the object API is MaxPlus, which Autodesk removed in 2017 (replaced by pymxs). Code written against MaxPlus will not survive a Max upgrade, unlike MAXScript.
Args:
code: Python source. Assign to result for the return value.
timeout_seconds: how long to wait before giving up.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| timeout_seconds | No |