Software:
3ds max 2020
Continuing this example,
If you need to select objects (nodes) of a certain type i.e. lights, cameras etc.
You can use the INode class’s GetObject() method to get a reference to the node’s object, or “modified object” in 3ds max terms, and use the object’s GetSuperClassID() method to get the integer id representing the object’s superclass.
In addition, the MaxPlus SuperClassIds class contains convenient constants that can be used to avoid having to check and remember the superclasses numeric ids.
See reference here:
https://help.autodesk.com/view/3DSMAX/2017/ENU/?guid=__py_ref_class_max_plus_1_1_super_class_ids_html
An example of a script that selects all light objects in the scene:
from MaxPlus import SuperClassIds from MaxPlus import SelectionManager def scene_objects(): def list_children(node): list = [] for c in node.Children: list.append(c) list = list + list_children(c) return list return list_children(MaxPlus.Core.GetRootNode()) for o in scene_objects(): obj = o.GetObject() if obj.GetSuperClassID() == SuperClassIds.Light: SelectionManager.SelectNode(o, False)
* note that when copying and pasting a script from this example, the indentation may not be pasted correctly.