Inheritance
SIObject
Application
XSIApplication
Introduced
1.5
Description
The XSIApplication object derives from the Application; its properties and methods are specific to Softimage, whereas Application contains only generic properties and methods. XSIApplication manages access to high-level objects such as the Softimage active Project, Selection object, Softimage Command objects, etc.
XSIApplication is an intrinsic object that represents the running instance of the Softimage application. An intrinsic (global) object is one that you can refer to by name in your code without creating an instance of it first; in this case the name is Application. In other words, script writers can assume that there is a global variable with the name 'Application' of type 'XSIApplication'.
However, within NetView scripts this object is not available as an intrinsic so it is neccessary to explicitly create an instance of the XSIApplication object. The scripting syntax for explicitly creating an XSIApplication object within NetView is illustrated below in the examples.
In normal (non-Netview) VBScript and JScript code it is possible to drop the "Application." prefix and call methods and properties of this object directly. For example calling "LogMessage" is actually a short form for "Application.LogMessage". This syntactic shortcut is not available to Python or PerlScript.
It is also possible to invoke all Softimage Commands as if they were methods of XSIApplication. This is the best way to invoke commands inside Python and PerlScript and for all script languages that run inside Netview.
Methods
|
|
|
Properties
|
|
|
Examples
1. VBScript Example
' ' hello world from vbscript ' Application.LogMessage "Hello Softimage world" 'In vbscript we don't need to specify 'the Application. prefix LogMessage "Shortcut of Hello World"
2. VBScript Example
' ' How to create an instance of the Application Object ' from VBScript for use within a NetView html page. ' Dim oApplication set oApplication = CreateObject("XSI.Application") 'Use SIObject.Application to convert from Application object 'to XSIApplication Dim oXSIApplication set oXSIApplication = oApplication.Application oXSIApplication.Application.LogMessage "Hello from Netview"
3. JScript Example
/*
hello world from jscript
*/
Application.LogMessage("Hello Softimage world");
//This shortcut is equivalent
LogMessage("Hello from ShortCut code");4. JScript Example
/*
How to create an instance of the Application Object
from JScript for use within a NetView html page.
*/
var oApplication = new ActiveXObject("XSI.Application");
var oXSIApplication = oApplication.Application;
oXSIApplication.LogMessage( "There are " + oXSIApplication.Plugins.Count + " plugins installed" ) ;5. Python Example
# # hello world from pythonscript # Application.LogMessage("Hello Softimage world")
6. Python Example
#Python script example, using the global Application #object to invoke the NewScene command. Application.NewScene( "",0 )
7. Python Example
# # How to create an instance of the Application Object # from pythonscript for use within a NetView html page. # # Normally you create a instance of an automation object using: # import win32com.client; # o=win32com.client.Dispatch('XSI.Application') # however win32com is not a trusted module so you get around # this by defining a vbscript function called getXSIApp() # that returns the Application object. Application = window.getXSIApp() # Note: Python is not a fully functional choice for web programming. # We recommend writing the Python code as Softimage Custom Commands # which are invoked using a little JScript or VBScript embedded in the # html.
8. PerlScript Example
# # hello world from perlscript # $Application->LogMessage("Hello Softimage world");
9. PerlScript Example
# # How to create an instance of the Application Object # from perlscript for use within a NetView html page. # use Win32::OLE; my $oApplication = Win32::OLE->new('XSI.Application') ; my $oXSIApplication = $oApplication->Application;
See Also
Autodesk Softimage v7.5