XSIApplication.ActiveProject2
 
 
 

XSIApplication.ActiveProject2

Introduced

v6.0

Description

Returns or sets the active XSIProject object.

Note: If you are setting the active project with scene currently loaded, a file browser will prompt you to save the current scene as a new file the next time you save the scene. This is because you are now in a new project so the location of the 'current' scene file has changed.

Note: This method could return an invalid object in python, use XSIApplication.ActiveProject3 instead.

C# Syntax

// get accessor
Project rtn = XSIApplication.ActiveProject2;
// set accessor
XSIApplication.ActiveProject2 = Project;

Examples

1. JScript Example

// 
// This example demonstrates how to set the current project with jscript
//
// Backup the current project
var sOriginalProjectPath = Application.ActiveProject2.Path
Application.LogMessage( "Original Active Project: " + sOriginalProjectPath );
// Set the active project to be XSI_Samples
var sPath = XSIUtils.BuildPath(
        Application.InstallationPath(siFactoryPath), 
        "Data", "NewProject"
);
Application.ActiveProject2 = Application.CreateProject(sPath);
Application.LogMessage ( "New Active Project: " + Application.ActiveProject2.Path );
// Set back the original project
Application.ActiveProject2 = Application.CreateProject( sOriginalProjectPath );
Application.LogMessage ( "New Active Project: " + Application.ActiveProject2.Path );// INFO : Original Active Project: C:\Program Files\Autodesk\Softimage 2011 289 ship/Data/NewProject
// INFO : Original Active Project: C:\Program Files\Autodesk\Softimage 2011 289 ship/Data/NewProject
// INFO : New Active Project: C:\Program Files\Autodesk\Softimage 2011 289 ship/Data/NewProject
// INFO : New Active Project: C:\Program Files\Autodesk\Softimage 2011 289 ship/Data/NewProject

2. Python Example

#
# This example demonstrates how to set the current project with python
#
app = Application
from win32com.client import constants as cns
# Backup the current project
sOriginalProjectPath = app.ActiveProject3.Path;
app.LogMessage( "Original Active Project: " + sOriginalProjectPath );
# Set the active project to be XSI_Samples
sPath = app.InstallationPath( cns.siFactoryPath );
sPath += "/Data/NewProject";
app.ActiveProject3 = app.CreateProject2( sPath );
app.LogMessage( "New Active Project: " + app.ActiveProject3.Path );
# Set back the original project
app.ActiveProject3 = app.CreateProject2( sOriginalProjectPath );
app.LogMessage( "New Active Project: " + app.ActiveProject3.Path );

See Also

XSIApplication.CreateProject