Python Bindings

What is PyMaxwell? 

PyMaxwell is a Python binding for Maxwell Render SDK. That means the user can open, create, edit and save Maxwell scenes easily by Python scripting.

What can I do with PyMaxwell?

PyMaxwell Python module allows the user to open MXS, MXI and MXM files, edit them and save them to disk. You can also create new scenes, materials, etc. from the scratch as well. It is a very useful tool when you need for example to edit an MXS sequence, avoiding the need to open them one by one in Maxwell Studio to change a parameter.

Example: The following Python script shows how can we activate the shadow pass to all materials of all MXS from within a directory:

from pymaxwell import *
mxslist = getFilesFromPath('c:/scenes/','mxs');
scene = Cmaxwell(mwcallback);
for file in mxslist:
  scene.readMXS('c:/scenes/' + file);
  scene.setRenderParameter('DO SHADOW PASS CHANNEL',1);
  it = CmaxwellMaterialIterator();
  material = it.first(scene);
  while not material.isNull():
    ok = material.setMatteShadow( True );
    material =;
  scene.writeMXS('c:/scenes/' + file);

How can I get started with PyMaxwell?

The Maxwell Render Suite includes a very handy Python editor, the PyMaxwell application, a good starting point to create your own scripts. That editor has a complete function help, function and class auto-completion, syntax highlighting and more. Please see the video-tutorials to learn the basics of the Python editor. In addition, the Maxwell installation includes a set of examples to execute the most common operations, which are a good starting point to learn how to use PyMaxwell. 

You can find this collection of scripts in your Maxwell application folder, in the /scripts/python sub-folder. 

The PyMaxwell editor icon

Writing a script using the PyMaxwell editor

Can I use PyMaxwell outside Maxwell Render?

Of course, you can use the PyMaxwell Python module in your own Python installation. In fact, Maxwell provides PyMaxwell for the most common Python versions* (2.6, 2.7, 3.1 and 3.2 are supported). They are located in your Maxwell application folder, inside the /python/pymaxwell sub-folder**.

See this video-tutorial to learn more about how to install these modules in your Python installation.

*Note:most common Python packages installation paths are:
  •     Windows: C:\Python26\Lib\site-packages\
  •     Linux: /usr/lib/python2.6/dist-packages/
  •     OSX: /Users/username/.local/lib/python2.6/site-packages/
**OSX Note: PyMaxwell modules are located in the Libs/pymaxwell sub-folder of the Maxwell Render installation directory.