Softimage SDK Programmer's Guide > Script Development > Working with Arrays (and Other Collections) in Softimage > Groups vs. Collections and Arrays >

# Using the Object Model to Access Groups

Currently, the object model only supports creating a group and adding members to it. If you need to remove members from a group or remove the group itself, you can use the native Softimage commands:

- To remove items from a group.

- To remove a group from the scene.

Tip

Don't forget that if you use object pointers when working with the native Softimage commands, you can mix many of the object model functions and the native Softimage commands seamlessly. The examples of using the groups commands demonstrate how to use object pointers.

To create a group with the object model

    ' Set my workspace
    Set oRoot = ActiveProject.ActiveScene.Root

    ' Create a new model called "MyModel"
    Set oModel = oRoot.AddNull( "MyModel" )

    ' Create a new polymesh sphere called "MySphere"
    Set oSphere = oRoot.AddGeometry( "Sphere", _
    	"MeshSurface", "MySphere" )

    ' Create a new group containing the sphere
    Set oGroup = oRoot.AddGroup( oSphere, "MyGroup" )

    ' Print the names of the group members
    LogMessage oGroup & " contains... "
    For Each o In oGroup.Members
       LogMessage o.Name
    Next

To add items to a group with the object model

    ' Create a torus called "MyTorus"
    Set oTorus = oRoot.AddGeometry( "Torus", _
       "MeshSurface", "MyTorus" )

    ' Add it to the group
    Set oGroup = oGroup.AddMember( oTorus )