Interface: assemblyMgr

Represents the interface to the Assembly Manager. Used to put objects together to Assemblies, test and manipulate the Assemblies.

Methods:

<node>Assemble <node array>nodes [name:<string>] [classDesc:<class>] [select:<bool>]

name default value: undefined

classDesc default value: undefined

select default value: true

Create a new Assembly using the nodes in the <node array>.

A Create Assembly dialog will be displayed if either the name or the classDesc is not specified. The classDesc is passed a MAXClass, an instance of which will be used as the assembly head. This MAXClass must be for a helper object. You can create a scripted plugin that extends helper to use as assembly head, exposing the properties you desire for the assembly head.

Note:

In Autodesk VIZ, the category for the scripted plugin must be "Assembly Heads" in order for the class to appear in the Create Assembly dialog. In 3ds Max, all helper classes will appear in the dialog.

Example:

object1 = Cylinder() --create a cylinder

$Cylinder:Cylinder01 @ [0.000000,0.000000,0.000000]

object2 = Box() --create a box

$Box:Box01 @ [0.000000,0.000000,0.000000]

object3 = OmniLight()

$Omni_Light:Omni01 @ [0.000000,0.000000,0.000000]

obj_array = #(object1, object2, object3)

#($Cylinder:Cylinder01 @ [0.000000,0.000000,0.000000], $Box:Box01 @ [0.000000,0.000000,0.000000], $Omni_Light:Omni01 @ [0.000000,0.000000,0.000000])

 

--Create a new Assembly out of the objects, name it Test01 and use

--a Dummy as the head. new_ass will contain the assembly head.

new_ass = assemblyMgr.assemble obj_array name:"Test01" classDesc:Dummy

$Dummy:Test01 @ [0.000000,0.000000,-8.000000]

 

 

<bool>Disassemble <node array>nodes

Disassembles the specified nodes. Returns true on success.

Example:

--Continuing with the assmbly from the above example...

obj_array

#($Cylinder:Cylinder01 @ [0.000000,0.000000,0.000000], $Box:Box01 @ [0.000000,0.000000,0.000000], $Omni_Light:Omni01 @ [0.000000,0.000000,0.000000])

--We cannot disassemble the original array because it does not

--contain the head object!

assemblyMgr.Disassemble obj_array

false

--Let’s append the head to the array and try again...

append obj_array $Test01

#($Cylinder:Cylinder01 @ [0.000000,0.000000,0.000000], $Box:Box01 @ [0.000000,0.000000,0.000000], $Omni_Light:Omni01 @ [0.000000,0.000000,0.000000], $Dummy:Test01 @ [0.000000,0.000000,-8.000000])

--Now that we supplied all objects of the assembly,

--the Disassemble method worked.

assemblyMgr.Disassemble obj_array

true

 

<bool>Open <node array>nodes [clearSelection:<bool>]

clearSelection default value: true

Opens the the specified nodes. Returns true on success. When clearSelection is supplied as false, the selection will not be cleared.

<bool>Close <node array>nodes [select:<bool>]

select default value: true

Closes the the specified nodes. Returns true on success.

<bool>Explode <node array>nodes

Explodes the specified nodes. Returns true on success.

<bool>Attach <node array>nodes [assembly:<node>]

assembly default value: undefined

Attach the specified nodes to the assembly. Returns true on success.

<bool>Detach <node array>nodes

Detaches the specified nodes from the assembly. Returns true on success.

<bool>CanAssemble <node array>nodes

Returns true if the <node array> contains nodes that can be assembled.

<bool>CanDisassemble <node array>nodes

Returns true if the <node array> contains nodes that can be disassembled.

<bool>CanExplode <node array>nodes

Returns true if the <node array> contains nodes that can be exploded.

<bool>CanOpen <node array>nodes

Returns true if the <node array> contains nodes that can be opened.

<bool>CanClose <node array>nodes

Returns true if the <node array> contains nodes that can be closed.

<bool>CanAttach <node array>nodes assembly:<node>

assembly default value: undefined

Returns true if the nodes in <node array> can be attached to the assembly

<bool>CanDetach <node array>nodes

Returns true if the nodes in <node array> can be detached

<node>IsAssembly <node array>nodes

Returns the Head Node of the Assembly comprised by the nodes specified by <node array> , or undefined if the nodes do not form an Assembly.

<bool>FilterAssembly <node>assemblyHead <value>filterSClassID <&node array>filteredNodes

filteredNodes is Out parameter

Filters all nodes of the specified superclass that are contained in the assembly with the specified head and passes them out to the supplied filterNodes array. Returns true on success.

Examples:

--Assembly contains a Cylinder,a Box and a Dummy Helper as head:

test_array = #($Box01, $Cylinder01)

#($Box:Box01 @ [0.000000,0.000000,0.000000], $Cylinder:Cylinder01 @ [0.000000,0.000000,0.000000])

--Check for assembly with the lights only

assemblyMgr.IsAssembly test_array

undefined

--Now check with all assembly nodes including the Head

test_array = #($Box01, $Cylinder01, $Omni01, $Test01)

#($Box:Box01 @ [0.000000,0.000000,0.000000], $Cylinder:Cylinder01 @ [0.000000,0.000000,0.000000], $Omni_Light:Omni01 @ [0.000000,0.000000,0.000000], $Dummy:Test01 @ [0.000000,0.000000,-8.000000])

a_head = assemblyMgr.IsAssembly test_array

$Dummy:Test01 @ [0.000000,0.000000,-8.000000]

--a_head now contains the Head of the Assembly containing the above objects!

 

--Find all light objects in assembly a_head

AssemblyMgr.FilterAssembly a_head Light &lightnodes

true

-- lightnodes now contains all nodes corresponding to objects of superclass Light

lightnodes

#($Omni_Light:Omni01 @ [0.000000,0.000000,0.000000])

--Find all camera objects in assembly a_head

AssemblyMgr.FilterAssembly a_head Camera &camnodes

true

--There are no cameras in the assembly!

camnodes

#()

 

See also

Interface:IAssembly