Group.AddMember
 
 
 

Group.AddMember

Introduced

v5.0

Description

Adds members to a group.

You can add objects in branch mode, so that properties assigned to the group are inherited by the objects and their children. For example, if you have a hierarchy A->B->C and you add object A to a group in branch mode, then any material assigned to the group applies not only to A but also to B and C.

You can use Group.IsMember to check if an object is a branch member of a group. To change the branch setting of a group member, you have to remove the object and then add it back to the group.

Note: Use AddToPartition to add members to a Partition Group.

C# Syntax

Boolean Group.AddMember( Object in_member, Boolean in_bBranchMember );

Scripting Syntax

oBoolean = Group.AddMember( NewMember, [BranchMember] );

Return Value

Boolean

True if the members were added successfully, and False otherwise.

Parameters

Parameter Type Description
NewMember XSICollection or SceneItem Members to add.
BranchMember Boolean True to add objects in branch mode.

Default Value: False

Examples

JScript Example

NewScene(null, false );
var a = ActiveSceneRoot.AddGeometry( "Cube", "MeshSurface", "A");
a.length.value = 2;
var b = a.AddGeometry("Cube", "MeshSurface", "B");
b.length.value = 2;
Translate( b, 5 );
var c = b.AddGeometry("Cube", "MeshSurface", "C");
c.length.value = 2;
Translate( c, 5 );
// create group
var group = ActiveSceneRoot.AddGroup();
// add members to group
group.AddMember( a, true );
group.AddMember( b, false );
logmessage( "number of members : " + group.members.Count );
// determine which members were added in branch
for ( var i = 0; i < group.members.count; i++ )
{
        var member = group.members(i);
        var bBranchMember = group.members(i).BranchFlag ? "true" : "false";
        logmessage( member + " branch member " + bBranchMember );
}
logmessage( "Extended group members = " + group.expandedmembers.getastext() );
//INFO : number of members : 2
//INFO : A branch member true
//INFO : B branch member false
//INFO : Extended group members = A,B,C