Now that the news are out, I’m pretty excited to see what people will start doing with python and 3dsmax, meanwhile I would like to share with you my setup that I’ve been running for the last couple of months.
Thanks to the work of Sven Fraeys and his ExternalMaxscriptIDE, I was able to setup PyCharm running along 3dsmax as an external IDE for python scripting, which is pretty awesome after years of Maxscript IDE…. It actually makes me cry if I have to go back and do something in Maxscript again… either for the language or the IDE.
There’s not to much to say about it so I’ll be just posting the steps on how to get the setup going, so let me know if you run into issues, I’ll gladly help out.
Okay, first, all credit for ExternalMaxscriptIDE goes out for Sven Fraeys (http://www.svenfraeys.com) which is the foundation for all the stuff that I did. Having that said, here goes:
1. Download ExternalMaxscriptIDE : https://dl.dropbox.com/u/1652825/Max…ScriptIDE.html
2. Copy ” ExternalMaxScriptIDE ” directory to your local scripts directory “$userScripts”
3. Run the ExternalMaxScriptIDE_install.ms , this will copy the startup and run ExternalMaxScriptIDE
4. Install Pycharm – http://www.jetbrains.com/pycharm/download/index.html
5. Download the MaxPlus.zip here and unzip it to a folder of your choice (ex. C:YCDIVFX_MaxPlus)
6. Open Pycharm and open the directory where you unzipped the previous file.
7. Go to File -> Settings or press Alt+F7 and search for Project Interpreter
8. Your default project interpreter should be Python 2.7.3 (C:Python27_64python.exe) if not, don’t worry go to the next step.
9. Click Configure interpreters and if you don’t have an interpreter set, click the + button and add your Python interpreter (C:Python26python.exe)
10. With the project interpreter selected on the top list view, click on the Paths tab.
11. Click the + button and add your default 3dsmax 2014 root folder (C:Program FilesAutodesk3ds Max 2014)
12. Back on the Packages tab, you should see a warning to install “distribute”, click on it and then another for “pip”, install that too. (Optional)
13. Now click the Install button and search for “nose”, install “nose” package (Description: nose extends unittest to make testing easier/Author:Jason Pellerin) (Optional)
14. Now search and install “coverage” package. (Optional)
15. Open 3dsmax 2014
16. I’ve added a few configurations to run the examples and a “main configuration” that basically runs the main.py file, feel free to create your own files and a new configuration for it.
17. run.py takes one argument “-f” with the file you want to run
18. Open main.py and hit Run you should see “hello world” in the maxscript window 🙂
Hope this works out for you, let me know if you find any issues. I’ll make a separate post regarding the remote debugging.
The syntax for run.py is: “python run.py -f c:pathfilenametorun.py”
I’m new to python so please bare with me and my messy code 🙂
How the setup looks on my machine:
26 Responses
vectorman
Thank you for the post, I’ve been trying to install the ExternalMaxscriptIDE and am getting the following error any ideas? Thanks
false
— Error occurred in OpenConnection(); filename: C:UsersXAppDataLocalAutodesk3dsMax2014 – 64bitENUscriptsExternalMaxScriptIDEExternalMaxScriptIDE_system.ms; position: 3046; line: 110
— Frame:
— userScriptsPath: “C:UsersXAppDataLocalAutodesk3dsMax2014 – 64bitENUscripts”
— maxHndl: undefined
— maxHandlePointer: undefined
— dllPath: “C:UsersXAppDataLocalAutodesk3dsMax2014 – 64bitENUscriptsExternalMaxScriptIDEMaxScriptReceiverForm.dll”
— sysPointer: undefined
— maxHwnd: undefined
— assembly: dotNetClass:System.Reflection.Assembly
— maxScriptReceiverForm: undefined
— called in anonymous codeblock; filename: C:UsersXAppDataLocalAutodesk3dsMax2014 – 64bitENUscriptsstartupExternalMaxScriptIDE_startup.ms; position: 230; line: 5
— Frame:
— Error occurred during fileIn in #C:UsersXAppDataLocalAutodesk3dsMax2014 – 64bitENUscriptsExternalMaxScriptIDEExternalMaxScriptIDE_system.ms; line number: 110
— Runtime error: dotNet runtime exception: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.
Artur Leao
Hi, that seems to be either an issue with administrative rights or some remote/network loading error with the DLL. I would try to run 3dsmax with administrative rights to see if solves the issue.
You also might want to have a look here regarding the ExternalMaxscriptIDE: http://www.svenfraeys.com/tools/external-maxscript-ide/
Hope this helps!
vectorman
Thanks, I’ll check out the ExternalMaxscriptIDE website…
sai
Hi,
thanks for this install tips,but I have encountered some problem.
run main.py and the error message show up.
any help please.
C:Python27python.exe C:/Autodesk/MaxPlus/main.py
Traceback (most recent call last):
File “C:/Autodesk/MaxPlus/main.py”, line 6, in
MaxPlus.Core.WriteLine(“hello world”)
File “C:Autodesk3ds Max 2014MaxPlus.py”, line 32330, in WriteLine
return _MaxPlus.Core_WriteLine(*args)
RuntimeError: Unknown MaxPlus Exception
Process finished with exit code 1
Artur Leao
Hi, I think the correct command-line to run that would be:
C:Python27python.exe C:/Autodesk/MaxPlus/run.py -f C:AutodeskMaxPlusmain.py
Keep in mind that you need 3dsmax to be open for this to work. You can also run this directly inside 3dsmax, this way you just need to use the python.execute command.
jalnaga
Hello, Artur Leao, thanks for install tips, but I have encountered some problem.
When I tried your suggestion, I received this error message.
C:Python27_64>python C:/MaxPlus/run.py -f C:MaxPlusmain.py
Traceback (most recent call last):
File “C:/MaxPlus/run.py”, line 24, in
mxs.Run()
File “C:MaxPlusMXSRunner.py”, line 17, in Run
subprocess.call(callparams)
File “C:Python27_64Libsubprocess.py”, line 524, in call
return Popen(*popenargs, **kwargs).wait()
File “C:Python27_64Libsubprocess.py”, line 711, in __init__
errread, errwrite)
File “C:Python27_64Libsubprocess.py”, line 948, in _execute_child
startupinfo)
WindowsError: [Error 2]
I’m using Python 2.7.5, not 2.7.3. Can it be a reason of this problem?
Any help please.
Artur Leao
Hi, yes you need 2.7.3 64 bit
Actually, you can point the interpreter to the python build bundled in 3dsmax, it should be in the 3dsmax root folderpython.
Cheers!
julo
Hi,
Thanks for the tutorial but I have the same problem as Jalnaga:
“F:Autodesk3ds Max 2014pythonpython.exe” F:/MaxPlus/run.py -f F:MaxPlusmain.py
Traceback (most recent call last):
File “F:/MaxPlus/run.py”, line 24, in
mxs.Run()
File “F:MaxPlusMXSRunner.py”, line 17, in Run
subprocess.call(callparams)
File “F:Autodesk3ds Max 2014pythonlibsubprocess.py”, line 493, in call
return Popen(*popenargs, **kwargs).wait()
File “F:Autodesk3ds Max 2014pythonlibsubprocess.py”, line 679, in __init__
errread, errwrite)
File “F:Autodesk3ds Max 2014pythonlibsubprocess.py”, line 896, in _execute_child
startupinfo)
WindowsError: [Error 2] Le fichier spécifié est introuvable
Process finished with exit code 1
3dsmax is running.
I tried to install a fresh version of python 2.7.3 64bits with the same result.
“Le fichier spécifié est introuvable” means roughly Unable to find the specified file.
Any help would be appreciated 🙂
ps : sorry for my english
Artur Leao
I think I figured it out, make sure in settings.ini that “external” is pointing to the correct path where MaxscriptIDE.exe is located. I’m working on fixing the zip file and will post an updated version.
julo
It worked, thx 😉
stascrash
thank you!
I was looking in a way of using eclipseIDE with maxPlus, do you know if this is possible?
Seth
Thanks for sharing this excellent tutorial on python and 3DsMax. I’ll be trying it out soon.
knoppix
When i try to run ExternalMaxscriptIDE_install 3ds max 2014 gives me this error:
–Runtime error: fileIn: can’t open file – “$userScriptsstartupExternalMaxScriptIDE_startup.ms”
What’s the reason of it?
Artur Leao
Did you copy the ExternalMaxscriptIDE files into the 3dsmax user scripts folder?!
florian
hi arthur, i stumble uppon the problem, that installation works fine but i cannot execute the main.py, pycharm gives me the following error message:
“C:Program FilesAutodesk3ds Max 2014pythonpython.exe” C:/MaxPlus/run.py
Traceback (most recent call last):
File “C:/MaxPlus/run.py”, line 4, in
from mxsrunner import *
ImportError: No module named mxsrunner
Process finished with exit code 1
I think it’s a stupid mistake of mine but i cannot get behind, it would be too kind of you if you could spend a second of your time.
Artur Leao
Make sure you have the MaxPlus directory in your environment variables under PYTHONPATH.
Sune
I had to add the “packages” folder under PyCharms paths tab, since it wasn’t being found. This got rid of the the ImportError, related to mxsrunner
Next I had an exception where mxsrunner calls subprocess with callparams.
I had to change the following line in settings.ini to point to my own dir:
External = C:UsersKameleonWorkCODEYCDIVFXMaxPlusExternalsMaxscriptIDE
Now PyCharm completes running main.py, but 3dsMax listener displays the following:
”
— ERROR
— Error occurred in anonymous codeblock; started from filename: F:UsersRovsingsgadeDocuments3dsMaxYCDIVFX_MaxPlusYCDIVFX_MaxPlus-masterrun.ms
”
Any clues?
Sune
I’ve just realized that these points are both in in the readme.txt 🙂 Sorry!
Artur Leao
Hi Sune, that’s fine and I’m glad you sorted it out. Is the problem solved now?!
I did some changes in the whole structure after writing this post so something might be broken 🙂
If main.py is giving you an error, try running a file with just an import MaxPlus and print out something.
Cheers!
Sune
Yeah I got it working, just had to provide the full path to the script I want to run:
Script Parameters: -f FullPathmain.py
Thanks 🙂
Espen
I got to point 2.. then it didn’t work.. that is how installinginstructions normaly work..
Artur Leao
Hi Espen, you need to put the files inside your C:UsersYOURUSERNAMEAppDataLocalAutodesk3dsMax2014 – 64bitENUscripts folder then run step 3.
Let me know if this helps.
DDuffy
Nearly there I think. But getting this error:
File “C:Program FilesAutodesk3ds Max 2015MaxPlus.py”, line 33338, in WriteLine
return _MaxPlus.Core_WriteLine(*args)
RuntimeError: Unknown MaxPlus Exception
Appreciate any help given
Daniel Santana
Can you tell us, when does this error occurs? Either way, Unknown exception is a very vague error :).
DDuffy
Hey,
Apologies for the ambiguity 🙂
when I try to run the main.py in PyCharm I get this error within the PyCharm output window.
Daniel Santana
Hi, can you try to run this from within 3ds Max? Try running this
python.execute "MaxPlus.Core.WriteLine(\"hello world\")"
and see if this happen. If so, its most likely something wrong with python in 3dsmax. Do you have blur python installed? It can cause the MaxPlus python initialization to fail.