Setting the active project

To set the active project, you use CreateProject to get an XSIProject object and then assign the XSIProject object to the XSIApplication.ActiveProject2 property.

Application.LogMessage( Application.ActiveProject2.Path ) 

# In this example, I use the path to an existing project
sPath = "C:\\Users\\blairs\\Documents\\Support\\Project" 
oProj = Application.CreateProject( sPath ) 

# ActiveProject2 is a property that takes an XSIProject object
Application.ActiveProject2 = oProj 

Application.LogMessage( Application.ActiveProject2.Path ) 

# INFO : C:\Program Files\Autodesk\Softimage 2011 Subscription Advantage Pack\Data\XSI_SAMPLES
# INFO : C:\Users\blairs\Documents\Support\Project

You can use CreateProject on an existing project, and you’ll get back the object for that project. However, CreateProject will re-create any of the missing default folders (like Actions, Audio, Backup, and so on). If you’re using a customized set of project folders, you can avoid this by using the deprecated ActiveProject property:

p1 = "C:\\Program Files\\Autodesk\\Softimage 2011 Subscription Advantage Pack\\Data\\XSI_SAMPLES"
Application.ActiveProject = p1

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s