3ds Max 2014 Extension Release – Introducing Python!

On Monday of this week Autodesk released the 3ds Max 2014
Extension. This includes a python module that allows you to execute python
scripts within 3ds Max. There are a new set of APIs that came from the MaxPlus
work. You can see here for the complete details: http://area.autodesk.com/products/features/extension3dsmax.
Visit here: http://www.autodesk.com/me-sdk-docs
where you will find the new python docs.
After installing the extension, there are two new Python directories
in your 3ds max install location. The first is the Python runtime here:

  • %ADSK_3DSMAX_x64_2014%\python
  • %ADSK_MAXDES_x64_2014%\python

There are also several samples included here:

  • %ADSK_3DSMAX_x64_2014%\scripts\Python
  • %ADSK_MAXDES_x64_2014%\scripts\Python

You can execute any of those scripts from your MAXScript
Listener window. For example, these are kinda fun:

  • python.ExecuteFile "demoSphereBorg.py"
  • python.ExecuteFile "demoAnimation.py"

 

You will find that Python scripts are searched under the
following directories:

  • User Scripts directory
    %USERPROFILE%\AppData\Local\Autodesk\3dsMax\2014 – 64bit\<LangID>\scripts
  • User Startup Scripts directory
    %USERPROFILE%\AppData\Local\Autodesk\3dsMax\2014 – 64bit\<LangID>\scripts\startup
  • Scripts directory
    %ADSK_3DSMAX_x64_2014%\scripts
    %ADSK_MAXDES_x64_2014%\scripts
  • Startup Scripts
    %ADSK_3DSMAX_x64_2014%\scripts\startup
    %ADSK_MAXDES_x64_2014%\scripts\startup
  • The system search %PATH%
    Because there are no configurable directories, I would not suggest this approach if you must use a specific location. A better approach would be to use language features to accees your configurable environment. You might specify in the MAXScript or Python environment your own environment variable. For example, use %YOUR_ENVIRONMENT% environment variable that could be pulled from MAXScript and Python to allow your environment to change, and also have the most configurability in the future.

The good news is that the feature uses standard
Python conventions, so anyone knowing Python already should be able to learn the
3ds Max APIs quickly. Simply import MaxPlus to gain access the 3ds Max Python APIs. There
is also a central “Factory” that is used to create objects.

Well, this is just a start in
this exciting new territory. Python is certainly a growing community; even
Revit has explored Python!


Comments

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading