Some operations in Softimage require you to create an ActiveX object. For example, if you want to create an XSICollection,
you have to explicitly create it:
set oColl = CreateObject( "XSI.Collection" )
The best way to create an ActiveX object is to use the CreateActiveXObject (XSIFactory) method which is available to any supported scripting language. The principal advantage of this method is that it does not
trigger warning messages in Net View, unlike some of the following scripting languages' native functions:
Tip
The information presented here is a summary of the information available for each language. For more information, please refer
to the documentation provided by the scripting language's vendor or distributor.
CreateObject (VBScript)
Creates and returns a reference to an Automation object. You can use this function to create hooks into Softimage.
Syntax
CreateObject( appname.typename[, pathname] )
Parameters
Parameter
|
Type
|
Description
|
appname
|
String
|
The name of the application providing the object (for example, XSI or XSIMath).
|
classname
|
String
|
The type or class of the object to create (for example, Application, Collection, CreateVector3).
|
pathname
|
String
|
Optional. Full path and name of the file containing the object to retrieve.
|
Example
VBScript Example
' Get an XSICollection and add items to it
Set oCollection = CreateObject( "XSI.Collection" )
oCollection.Add "Camera"
oCollection.Add "Light"
Tip
For more information on this and other VBScript functions, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vbscripttoc.asp.
new ActiveXObject (JScript)
Creates and returns a reference to an Automation object. You can use this function to create hooks into Softimage.
Syntax
new ActiveXObject( appname.classname[, pathname] )
Parameters
Parameter
|
Type
|
Description
|
appname
|
String
|
The name of the application providing the object (for example, XSI or XSIMath).
|
classname
|
String
|
The type or class of the object to create (for example, Application, Collection, CreateVector3).
|
pathname
|
String
|
Optional. Full path and name of the file containing the object to retrieve.
|
Example
JScript Example
// Get an XSICollection and add items to it
var oCollection = new ActiveXObject( "XSI.Collection" )
oCollection.Add( "Camera" )
oCollection.Add( "Light" )
Tip
For more information on this and other JScript functions, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/js56jslrfjscriptlanguagereference.asp.
win32com.client.Dispatch (Python ActiveX)
Creates and returns a reference to an Automation object. You can use this function to create hooks into Softimage.
Syntax
win32com.client.Dispatch( appname.typename )
Parameters
Parameter
|
Type
|
Description
|
appname
|
String
|
The name of the application providing the object (for example, XSI or XSIMath).
|
classname
|
String
|
The type or class of the object to create (for example, Application, Collection, CreateVector3).
|
Example
Python Example
# You need to explicitly import this extension to use Dispatch
import win32com.client
# Get an XSICollection and add items to it
coll = win32com.client.Dispatch( "XSI.Collection" )
coll.Add( "Camera" )
coll.Add( "Light" )
Tip
For more information on this and other Python ActiveX issues, see www.python.org/windows/win32com/QuickStartClientCom.html.
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License