Description
Returns an instance of the STK Object Model Root Object
Property type
Read-only property
Syntax
| [Visual Basic .NET] |
|---|
Public Property StkRootObject() As Object
|
| [C#] |
|---|
public Object StkRootObject {get;}
|
| [Managed C++] |
|---|
public: __property IUnknown^ get_StkRootObject();
|
| [Unmanaged C++] |
|---|
public: HRESULT get_StkRootObject( IUnknown ** ppRetVal );
|
| [Java] |
|---|
public Object getStkRootObject();
|
Remarks
Example
The example demonstrates how to retrieve current scenario's start time via the STK Object Model.
| Accessing the STK Object Model in a plugin | Copy Code |
|---|
IAgStkObjectRoot root = Site.StkRootObject as IAgStkObjectRoot;
IAgScenario sc = root.CurrentScenario as IAgScenario;
object startTime = sc.StartTime;
|
|
The next example demonstrates an attempt to close a scenario which is not allowed via read-only object root. The Object Model handles such situations by throwing an automation exception warning the user that the requested operation is prohibited.
| Exception when attempting to execute a prohibited operation | Copy Code |
|---|
IAgStkObjectRoot root = Site.StkRootObject as IAgStkObjectRoot;
try
{
root.CloseScenario();
}
catch(Exception ex)
{
Site.Message(AgEUtLogMsgType.eUtLogMsgWarning, ex.Message);
}
|
|
See Also