What is an ISIVTCollection?

When a command has output arguments but does not explicitly specify a return value, it actually returns a special collection called an ISIVTCollection which implements the following methods and properties:

Methods

Name

Parameters

Description

Add

key

Adds an item to the collection as a value associated with a key (String). For example:

vtcol.Add("Native", false);

value

Remove

key

Removes an item identified by key (String) from the collection. For example:

vtcol.Remove("Native");

supports

__NewEnum

--

Provides support for standard collection enumeration. For example:

var eArg = new Enumerator(vtcol);
for ( ; !eArg.atEnd(); eArg.moveNext() ) {
   var myArg = eArg.item();
   Application.LogMessage( myArg == null );
}

 

Properties

Name

Parameters

Description

Item

key or index

Returns or sets the value for an item identified by key (String) or index (Long). Since this the default property for the ISIVTCollection, you can omit the Item when accessing it. For example:

// explicitly calling the Item property
var oldVal = vtcol.Item("CurveKind");
vtcol.Item("CurveKind") = 15;
// omitting the Item when calling the property
var oldVal = vtcol(0);
vtcol(0) = true;

Count

--

Returns the total number of items in the collection. For example:

Application.LogMessage( vtcol.Count );

Value

key

Returns or sets the value for an item identified by key (String) only. For example:

var oldVal = vtcol.Value("CurveKind");
vtcol.Value("CurveKind") = 15;

Examples

The following examples demonstrate the use of the ISIVTCollection:

VBScript Example: Output Arguments vs. the ISIVTCollection

JScript Example: Using the ISIVTCollection

Python Example: Working with the ISIVTCollection returned from a Command



Autodesk Softimage 2011