AGI AgStkPlugin 11 Send comments on this topic.
StkRootObject Property (IAgStkPluginSite)
See Also  Example





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

StkRootObject property returns an instance of  STK Object Model root object.  Note that the returned root object is restricted (read-only).  Changes to the application state by calling a method or setting a property of the STK Object Model are not allowed. For example, it is possible to perform the unit conversions or retrieve the values of most of the properties exposed by the STK Object Model, but operations such as closing or opening a scenario are prohibited.

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
// IAgStkPluginSite Site; 
 
IAgStkObjectRoot root = Site.StkRootObject as IAgStkObjectRoot; 
// Get the scenario object 
IAgScenario sc = root.CurrentScenario as IAgScenario; 
// Get the scenario's start time 
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
// IAgStkPluginSite Site; 
 
IAgStkObjectRoot root = Site.StkRootObject as IAgStkObjectRoot; 
// Attempts to close a scenario from within a plugin 
// will generate an automation exception. 
try 

    root.CloseScenario(); 

catch(Exception ex) 

    Site.Message(AgEUtLogMsgType.eUtLogMsgWarning, ex.Message); 
}

See Also

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1