Error When Executing Code from PyCharm

Error When Executing Code from PyCharm

Huston94
Enthusiast Enthusiast
3,012 Views
1 Reply
Message 1 of 2

Error When Executing Code from PyCharm

Huston94
Enthusiast
Enthusiast

Hi there,

 

I have my PyCharm project setup to use the “3dsmaxpy.exe” python interpreter to execute code to 3ds Max from PyCharm. But it seems to not be working.

 

 

For pymxs, it throws an error saying:

 

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.3.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 20, in do_import
    module = self._system_import(name, *args, **kwargs)
ImportError: No module named pymxs

 

 

For PySide it throws an error saying:

 

Traceback (most recent call last):
  File "C:/Users/hpetty/Desktop/Python Scripts/AspectRatioChanger/AspectRatioChanger_ui.py", line 40, in <module>
    main()
  File "C:/Users/hpetty/Desktop/Python Scripts/AspectRatioChanger/AspectRatioChanger_ui.py", line 23, in main
    w = QtGui.QWidget(MaxPlus.GetQMaxWindow())
  File "C:\Program Files\Autodesk\3ds Max 2017\MaxPlusExtend.py", line 314, in GetQMaxWindow
    maxHwnd = MaxPlus.QtHelpers.GetQMaxWindowWinId()
  File "C:\Program Files\Autodesk\3ds Max 2017\MaxPlus.py", line 40334, in GetQMaxWindowWinId
    return _MaxPlus.QtHelpers_GetQMaxWindowWinId()
RuntimeError: Unknown MaxPlus Exception

 

 

When executing anything with MaxPlus module, it also throws the same error as PySide. Basically I have not gotten anything to successfully execute from PyCharm to 3ds Max. Not sure if its something I'm doing wrong or if this functionality just doesn't work yet. Any advice would be great. Thanks.

0 Likes
Accepted solutions (1)
3,013 Views
1 Reply
Reply (1)
Message 2 of 2

drew_avis
Autodesk
Autodesk
Accepted solution

Even if you've configured PyCharm to target 3dsmaxpy.exe, it won't run it in the 3ds Max process, and it will not be able to execute pymxs or MaxPlus code.  You need a "script server" to send your code over the wire to a process running in Max.  There are a couple of projects out there that will let you do this.  Check out:

https://github.com/JeffHanna/MXSPyCOM/blob/master/Program.cs

https://github.com/ADN-DevTech/3dsMax-SampleCode/tree/master/MaxscriptServer

 

I believe either of these will work for you.  Big caveat though: you won't be able to debug in PyCharm.

 

Hope that helps,

Drew



Drew Avis
Content Experience Designer