To understand the relationship between 3ds Max’s MaxScript and pymxs, I decided to create a standard function library.

Creating the library, I was getting type errors frequently. After trial and error, I started to understand the objects’, what they returned, and the parameters they needed.  For example, many of pymxs’s functions require nodes or the 3ds Max object in the scene. I would input string parameters because in the script listener nodes and object outputs look similar. It was easy to confuse the two.

In addition, I would confuse file property functions and object property functions. They both output things that look like object properties, such as names, transformations, and visibility. But one works on the actual file and the other works on nodes selected in the scene.

Although their outputs appear similar, they are not interchangeable. Functions that operate on file properties cannot be used in place of functions that operate on scene nodes, and vice versa.

File Objects

def get_all_scene_objects():
return rt.getMaxFileObjects(scene_full_path(), quiet=True)
def get_max_object_names():
objects = rt.getMAXFileObjectNames(scene_full_path())
return objects

Scene Objects

def select_all_scene_objs():
rt.select(rt.objects)
objs = list(rt.selection)
if not objs:
logging.info("No objects selected. Scene is empty")
return None
else:
return objs
def get_node_by_name(object):
return rt.getNodebyName(object)
def select_all_scene_objs():
rt.select(rt.objects)
objs = list(rt.selection)
if not objs:
logging.info("No objects selected. Scene is empty")
return None
else:
return objs
def get_node_by_name(object):
return rt.getNodebyName(object)

I’m using PyCharm, and I execute the Python file in 3ds Max by using MaxScript command. This setup doesn’t allow me to have auto-complete in PyCharm for pymxs.

So this exercise is to understand the relationship between pymxs and MaxScript’s and create a useful 3ds Max function library.

In the future, I would like to organize related functions into classes. To add modularity and reusability to my pipeline’s codebase.

category =