So there’s python in 3dsmax … but no autodesk shell or editor for it .. arg
But there is hope
Sublime Text 2
I found this youtube video by Gary Davis. He goes through work by Christoph Bülter, Johannes Becker that integrates 3dsmax and the sublime text editor
Here’s my notes on the setup. See more on Chrisoph’s Bitbucket
1.Install sublime text 2
Install sublime text 2 (v3 is in beta and not supported at the moment )
2.Install the Package control
https://bitbucket.org/cb109/sublime3dsmax
Open Sublime text and go to view > show console
Copy and paste this text
https://sublime.wbond.net/installation#st2
import urllib2,os,hashlib; h = '7183a2d3e96f11eeadd761d777e62404' + 'e330c659d4bb41d3bdf022e94cab3cd0'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
3.Install the 3dsMax package
Close and restart sublime text
Open sublime text and go to tools > command palette. Then type install to find the Package control: Install Package
Using the package control will allow you to easily install the max package by typing 3dsMax into the search box and clicking on the link.
4.Setup the Sublime Text hotkeys for the 3dsMax commands
There are two available commands: send_file_to_max and send_selection_to_max. Sending files will check if they are valid maxscript files (.ms, .mcr).
To set shortcuts for the commands, edit your Key Bindings – User file and bind to any key you like. In Sublime Text go to Preferences > Key Bindings – User. Add your options between the []. Close the file and save the changes.
The following mimics the MAXScript Listener keys :-
[ { "keys": ["ctrl+e"], "command": "send_file_to_max" }, { "keys": ["shift+enter"], "command": "send_selection_to_max"} ]
How it works
It works by sending a fileIn maxScript command directly to the console window. It does work, but I found it occasionally flaky. Its important to save the sublime text file first (ctrl+s ) before using ctrl+e to run the script in max.
If it works you should see something like this in the MaxScript Listener window:-
fileIn (@"C:\Users\Ken Turner\Documents\maxscripts\KenzorsScripts\test_colour.ms");OK
This is my test_colour.ms script
for obj in geometry do obj.wirecolor = blue
Related Links
Artur Leao
Artur Leao has extended this Idea to work with pycharm
http://www.youcandoitvfx.com/maxplus-and-pycharm-update/
He has some example python scripts such as pyside_simple.py
Chris Arlt
http://knowledge.cf-studios.com/index.php?/archives/40-python-in-3ds-max-using-maxplus.html/
Blur
And the blur team have there own python plugin
https://code.google.com/p/blur-dev/wiki/Py3dsMax
And some PyQt examples