MXSPyCOM - A Program to Enable Editing of Max Script Files In External Code Edit

MXSPyCOM - A Program to Enable Editing of Max Script Files In External Code Edit

jeff.hanna
Participant Participant
3,199 Views
4 Replies
Message 1 of 5

MXSPyCOM - A Program to Enable Editing of Max Script Files In External Code Edit

jeff.hanna
Participant
Participant

https://github.com/JeffHanna/MXSPyCOM/releases

 

A modern version of MXSCOM, to allow for editing & execution of 3ds Max MaxScript and Python files from external code editors. In 2005 Simon Feltman released the first MXSCOM, a small Visual Basic 6 application that took commands and sent them to Autodesk's 3ds Max's internal COM server. This allowed users to choose their own external code editor for editing MaxScript and to be able to have their MaxScript code execute in 3ds Max by way of having the code editor utilize MXSCOM to send the file into 3ds Max and have it executed. Modern versions of Windows can not use Simon Feltman's old MXSCOM.exe program due to it being ActiveX based.

 

MXSPyCOM is a C# based replacement for MXSCOM. It offers the same functionality as MXSCOM but can run on modern versions of Windows. It also supports editing of Python files and having them execute in versions of 3ds Max, starting with 3ds Max 2015, that support Python scripts.

 

To Use:

  • Put MXSPyCOM.exe on your harddrive.
  • Put the initialize_COM_server.ms file in %localappdata%\autodesk\3dsmax\scripts\startup for instance, %localappdata%\autodesk\3dsmax\2017 - 64bit\scripts\startup
  • In your editor of choice add an external tool.
    • For instance, in UltraEdit (www.ultraedit.com) go to Advanced \ User Tools \ Configure Tools
    • On the Tool Configuration dialog insert a new command.
    • Set the Menu Item Name to something like, "Execute Script in 3ds Max".
    • Set the command line to the path where MXSPyCOM.exe is located, a -f command switch and "%f", which UltraEdit replaces with the filepath of the current document. E.g. C:\Program Files\MXSPyCOM\MXSPyCOM.exe -f "%f"
    • Click OK to add the command.

Please visit the release page on GitHub for more information on how to set up external code editors (UltraEdit and Visual Studio are provided as examples) and to get the latest release.

 

A note on Visual Studio: If you use Python Tools for Visual Studio and attach to 3dsmax.exe any breakpoints you have set will get hit. This makes debugging Python scripts for 3ds Max much easier than trying to use 3ds Max's internal editor, which has no debugger or breakpoint capabilities. Attaching a debugger and utilizing breakpoints is probably also achievable in other Python code editors like WingIDE or PyCharm. If MXSPyCOM users determine how to do that, please include that information on this project's WIKI page.

Jeff Hanna
Principal Technical Artist, Volition
3,200 Views
4 Replies
Replies (4)
Message 2 of 5

3dwannab
Advocate
Advocate

Hi,

 

Thank you, What's the switch for Notepad++..

 

I've tried all your examples.


EDIT:

 

I've download UltraEdit (which looks like a cool editor btw) and used the swither:

"C:\Program Files\MXSPyCOM\MXSPyCOM.exe" -f "%f"

But get this error:

 

Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {7FA22CB1-D26F-11D0-B260-00A0240CEEA3} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
   at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
   at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at MXSPyCOM.Program.execute_max_commands(String[] args, String filepath)
   at MXSPyCOM.Program.Main(String[] args)

Would this have anything to do with using max 2016.

0 Likes
Message 3 of 5

3dwannab
Advocate
Advocate

I've found the switcher for NP++ but it still not working from that.

 

 

"C:\Program Files\MXSPyCOM\MXSPyCOM.exe" -f "$(FULL_CURRENT_PATH)"

 

0 Likes
Message 4 of 5

Anonymous
Not applicable

Hi! Anyone tested it with PyCharm? Does it work? 

0 Likes
Message 5 of 5

theeastcoastwest
Participant
Participant

Wanted to say that this is pure gold!

 

Confirmed for working with 3DS Max 2016 + PyCharm.

 

For those interested in PyCharm configuration, some specific guidelines:

 

You need to substitute the %f with $FilePath$ under the Arguments field within the external tool creation window.

 

Jeff, have you by chance found an effective way to configure syntax highlighting and/or autocomplete in an external IDE?

0 Likes