Interface: assemblyMgr

Interfaces > Core Interfaces > assemblyMgr

 

   

Core Interfaces - Quick Navigation

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

Methods:

<node>assemblyMgr.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.

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>assemblyMgr.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>assemblyMgr.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>assemblyMgr.Close <node array>nodes[select:<bool>] 

select default value: true 

Closes the the specified nodes. Returns true on success.

   

<bool>assemblyMgr.Explode <node array>nodes 

Explodes the specified nodes. Returns true on success.

   

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

assembly default value: undefined 

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

   

<bool>assemblyMgr.Detach <node array>nodes 

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

   

<bool>assemblyMgr.CanAssemble <node array>nodes 

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

   

<bool>assemblyMgr.CanDisassemble <node array>nodes 

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

   

<bool>assemblyMgr.CanExplode <node array>nodes 

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

   

<bool>assemblyMgr.CanOpen <node array>nodes 

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

   

<bool>assemblyMgr.CanClose <node array>nodes 

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

   

<bool>assemblyMgr.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>assemblyMgr.CanDetach <node array>nodes 

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

   

<node>assemblyMgr.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>assemblyMgr.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