JScript Example: Using the ISIVTCollection

 
 
 

This example demonstrates how to retrieve the output arguments from the SetExpr command via the ISIVTCollection.

/*
	This example sets an expression on a parameter using the SetExpr command 
	and then accesses the new Expression object(s) via the ISIVTCollection
*/
// Create the object and set the expression
NewScene( "", false );
var oDonut = CreatePrim( "Torus", "NurbsSurface" );
var ivtRtn = SetExpr( oDonut+"*/kine.local.pos", "RAND(1,-5,5)" );

// The new Expression object is contained inside an XSICollection
// which is returned wrapped in an ISIVTCollection
var xsiColl = ivtRtn("ExprObj");
try {
	Application.LogMessage( "'ExprObj' contains " + xsiColl.Count + " expression(s)" );
} catch(e) {
	Application.LogMessage( "Could not find 'ExprObj'" );
}

// Output:
// INFO : 'ExprObj' contains 3 expression(s)