Share

Node Group-Related Methods

group <node_collection> [name:<string> ] [prefix:<string> ] [select:<boolean> ] 

Makes a group of the given nodes and returns the group node. You can optionally specify the group name or group name prefix. Not specifying a name or specifying a group name prefix ensures that the group name assigned is unique. Specifying select:true selects the group after it is made.

Note: This function returns the group on success, and OK on failure. You can test the result using isvalidnode():
result = group $box*
if (isvalidnode result) do ...

FOR EXAMPLE:

group $box* name:"boxes"--makes a group of all box*'s named "boxes".
group selection--groups current selection.
ungroup <group_head_node> -- mapped 

Ungroups one level of a group node.

FOR EXAMPLE:

ungroup $group001--ungroups group $group001
explodeGroup <group_head_node> -- mapped 

Ungroups all levels in a group node.

attachNodesToGroup <node_collection> <targetNode> 

Attaches a node collection to an existing group. Nodes that are already members of a group cannot be attached to another group.

<node_collection> is an array of nodes to be attached to the group of targetNode.

<targetNode> must be a group member or a group head node and cannot be a member of <nodeCollection>.

Available in 3ds Max 2010 and higher.

detachNodesFromGroup <node_collection> 

Detaches the specified nodes from the groups they belong to.

<node_collection> is an array of nodes that must be detached from their group heads. All members of <nodeCollection> must be open group members.

Available in 3ds Max 2010 and higher.

isGroupHead <node> 

Returns true if node is group head, false otherwise.

isOpenGroupHead <node> 

Returns true if <node> is the head of a group, and that group is open.

isGroupMember <node> 

Returns true if node is in a group, false otherwise.

isOpenGroupMember <node> 

Returns true if <node> is a member of a group, and that group is open.

setGroupOpen <group_head_node> <boolean> 

Sets whether the group is set as open or closed. If <boolean> is true , the group is set as open. If <boolean> is false the group is closed.

Warning:

Use the following methods with care. You can place nodes in states that are impossible to accomplish using the 3ds Max user interface.

setGroupMember <node> <boolean> 

Sets whether the node is a group member or not. If <boolean> is true , node is set as a group member. If <boolean> is false and the node is a group member, the node is set as not being a group member and is unlinked from the group head.

Note:

If you set a node to be a group member using this method, you need to set the node to be a child of a group head. Otherwise, the node name is not shown in the Select By Name dialog.

FOR EXAMPLE:

setGroupHead $dummy001 true
append $group003.children $dummy001
setGroupHead <node> <boolean> 

Sets whether the node is flagged as a group head or not. If <boolean> is true , node is flagged as a group head. If <boolean> is false , the node is set as not being a group head.

Note:

If you flag a node as a group head using this method, the node's mesh will not be displayed in the viewports and its properties will not be shown in the Modify panel. If you flag a group head node as not being a group head using this method, you will not be able to Open or Explode the group using the Group menu command.

FOR EXAMPLE:

-- create a set of spheres, group them, and test group head and member of group
mySpheres=for i = 1 to 5 collect sphere pos:(random [-100,-100,0] [100,100,0])
group MySpheres name:"MyGroup"
isGroupHead $MyGroup-- returns true
isGroupMember $sphere001-- returns true
-- check to see if group is open. Open group and test member of group
isOpenGroupHead $MyGroup-- returns false
setGroupOpen $MyGroup true
isOpenGroupMember $sphere001-- returns false
-- create a new set of spheres, append the group to the set, and then group them all
NewSpheres=for i= 1 to 3 collect sphere pos:(random [-100,-100,0] [100,100,0])
append NewSpheres $MyGroup
group NewSpheres name:"BiggerGroup"
-- open the group head, test member of group, and then close the groups.
setGroupOpen $BiggerGroup true
isOpenGroupMember $MyGroup
setGroupOpen $MyGroup false
setGroupOpen $BiggerGroup false

Was this information helpful?