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

# Removing Collections and CollectionItems

When you want to remove individual collection items from a collection, you can use the Remove method. You can also remove the collection from the scene using the RemoveChild method of the Model (on the scene root) object or use the RemoveAll method to leave the collection empty (but still in the scene).

To remove an item with the Remove method

To remove an item from a collection, use the collection's Remove method. For example, if you already created oCollection and oItem:

    oCollection.Remove "CameraInterest"
    oCollection.Remove item
    LogMessage "Collection= " & oCollection

To empty a collection with the RemoveAll method

To remove all items from a collection, use the collection's RemoveAll method. For example, if you already created oCollection:

    oCollection.RemoveAll
    LogMessage "Object Count = " & oCollection.Count

To remove a collection from the scene

To remove the collection itself from the scene, use the RemoveChild method of the root. For example, if you already defined the oRoot and oCollection objects:

    oRoot.RemoveChild( oCollection )