Getting Started With Max, MaxScript, Python & PyZMQ

maxscript
python
max

#1

I’m learning the basics of creating a workflow utilizing a server-based communications network between 3DS Max, Python, and potentially some other apps like Photoshop.

I’ve the intention to manage everything from a Python-driven server and process which would say things like launch this max file, render it with these settings, do these photoshop actions to the resulting files, then report back to the server with status updates.

I’ve the intention of using the ZeroMQ PyZMQ Python port to help facilitate this, but am conceptually unclear on how to connect a 3DS Max instance to the PyZMQ server and Python “manager” script.

My biggest question at this point is after I launch a 3DS Max instance—what are the common approaches for binding instructions from external Python scripts to that instance? For example, if I have 4 threads each launching 3DS Max instances to render jobs—how does my use of the following know which instance of Max to be launched in:

import MaxPlus
MaxPlus.Core.EvalMAXScript("
–maxScript actions taken here
")

Is that something that libraries like ZMQ “magically” handle from within the scope of different instances? Is there some sort of name-spacing approach to be taken?

I’m very new to this entire approach and apologize if any of these questions are nonsensical. I’ve had a hard time finding documentation related to my use case.


#2

Since you’ll be launching the max instances to perform a specific task, you might be better off using the updated batch system and passing the data and scripts directly as arguments. See example python task and the list of commandline options.


#3

Thanks! That looks like it might be a little more straightforward as I’m better understanding how to structure my approach.

BTW; you seem to be the common denominator in the most helpful answers I’ve found across several different forums. Autodesk really should put you on payroll