ObjectSet Values
 
 
 

Value > Collections > Collection Types > ObjectSet Values

 

   

Values and Collections - Quick Navigation

ObjectSets represent the main scene object categories in 3ds Max. The "constructors" below are all reserved system variables. ObjectSet values are mappable.

   

Constructors

objects  --all the objects
geometry  --the standard 3ds Max categories...
lights
cameras
helpers
shapes
systems
spacewarps
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

clearSelection()

Clears current scene node selection.

   

deselect <PathName>

Deselects given node(s).

EXAMPLE:

deselect $box* --deselects all items whose names start with "box".
select <PathName>

Deselects any current selection first, then selects the specified nodes.

   

selectMore <PathName>

Adds the specified node(s) to the current selection.

   

getCurrentSelection()

Returns the current selection as an array. This is similar to selection as array, however selection as array returns a copy of the selection.

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 in a variable, the ObjectSet value is stored rather than the objects in the ObjectSet. Thus, if the scene changes and the ObjectSet is affected by this change, the value assigned to the variable will also change dynamically to reflect the scene changes.

To store a snapshot of 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,

FOR EXAMPLE

$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 cameras[2] [x, y, z + 10]  --move the second camera
--select everything within a 100 units of $foo
select (for o in objects where distance o $foo < 100 collect o)
See Also