ObjectSets represent the main scene object categories in 3ds max. The "constructors" below are all reserved system variables. ObjectSet values are mappable.
Constructors
geometry -- the standard 3ds max categories...
selection -- the current selection
Properties
<objectset>.center : Point3, read-only
Returns center of bounding box of all objects in set.
<objectset>.max : Point3, read-only
Returns maximum corner of bounding box.
<objectset>.min : Point3, read-only
Returns minimum corner of bounding box.
<objectset>.count : Integer, read-only
Returns number of objects in set.
Operators
<objectset>[<integer>] -- accesses member of collection. Indexes start at 1.
<objectset> as array -- converts objectset collection to an array
Associated Methods
Clears current scene node selection.
Deselects given node(s). For example:
deselect $box*
deselects all items whose names start with "box".
Deselects any current selection first, then selects the node(s) you specified.
Adds the specified node(s) to the current selection.
Returns the current selection as an array. This is equivalent to selection as array, but can be significantly faster if there are very large numbers of objects in the scene.
Note: ObjectSets are actually special types of value that denote their sets, stored in reserved system variables of the same name, so you can assign them to other variables and pass them around as function arguments, etc. When storing an ObjectSet to a variable, the ObjectSet value is stored rather than the objects in the ObjectSet. To store the objects currently in the ObjectSet to a variable, first convert the ObjectSet to an array using the as operator.
You can use ObjectSets as the root of a pathname, like this:
$helpers/d*
which limits the pathname searching to the object set you've specified. So, in the above example, it will name only helper objects that start with 'd'.
The order of sequencing is consistent in a stable scene but somewhat arbitrary - it depends on how 3ds max stores its object hierarchy internally which is effected mostly by order of additions and deletions to and from the scene.
The lights and cameras object sets include the target objects, if any, for the lights and cameras. If you want to change a property value for all the lights or cameras, you will need process each object in the ObjectSet individually, testing to make sure it is a light or camera. For example, to increase the multiplier property value for all lights, you would say:
for obj in lights do
if iskindof obj light do
obj.multiplier *= 1.3
Examples
s = selection[1] -- grab the first object in the
-- current selection
move camera[2] [x, y, z + 10] -- move the second camera
-- select everything within a 100 units of $foo
for o in objects where distance o $foo < 100 do selectmore o