AGI STK Objects 11 Send comments on this topic.
IAgStkObjectRoot Interface





Description

Represents the automation interface supported by the root object of the Automation Object Model.

Object Model







Public Methods

Public Method AllInstanceNamesToXML Returns an XML representation of AllInstanceNames.
Public Method AvailableMarkerTypes This property is deprecated. Use the AvailableMarkerTypes property from the IAgScVO interface. Retrieves the list of available MarkerTypes
Public Method BeginUpdate Signals the object that the batch update is starting.
Public Method CloseScenario Closes the scenario. The method throws an exception if no scenario has been loaded.
Public Method EndUpdate Signals the object that the batch update is complete.
Public Method ExecuteCommand Executes a custom CONNECT action. The method throws an exception if the command has failed.
Public Method ExecuteMultipleCommands Executes multiple CONNECT actions. The behavior of the method when encountering an exception varies depending on the setting of the Action parameter. See the help for AgEExecMultiCmdResultAction.
Public Method GetLicensingReport Returns a formatted string that contains the license names and their states. The string is formatted as an XML document.
Public Method GetObjectFromPath Gets the object instance that matches the path provided
Public Method Isolate Mutually isolates unit preference settings in the current instance from those in other instances of the root.
Public Method Load Loads a scenario/vdf using the specified path. The method throws an exception if there is a scenario already loaded.
Public Method LoadCustomMarker Adds a custom marker to Application
Public Method LoadScenario Use Load method. Loads a scenario using the specified path. The method throws an exception if there is a scenario already loaded.
Public Method LoadVDF Loads a vdf using the specified path. The method throws an exception if there is a scenario already loaded. If the password isn't needed, enter an empty string.
Public Method NewScenario Creates a new scenario. User must close a scenario before creating a new one; otherwise an exception will occur.
Public Method ObjectExists Checks whether a currently loaded scenario contains an object with the given path.
Public Method Save Saves the changes made to the scenario/vdf.
Public Method SaveAs Saves the changes made to the scenario/vdf to a specified path and file name.
Public Method SaveScenario Use Save method. Saves the changes made to the scenario.
Public Method SaveScenarioAs Use SaveAs method. Saves the changes made to the scenario to a specified path and file name.
Public Method SaveVDFAs Saves the changes made to the scenario to a specified path and file name as a vdf file.

Public Properties

Public Property AvailableFeatures Allows the user to inquiry about the available features
Public Property CentralBodies Returns a collection of available central bodies.
Public Property ConversionUtility Returns the conversion utility interface.
Public Property CurrentScenario Returns a Scenario object or null if no scenario has been loaded yet.
Public Property Isolated Returns whether the instance is isolated.
Public Property NotificationFilter The event notification filter is used to temporarily disable only the root events to prevent them from being raised. The event filtering can be used to improve client application performance.
Public Property StdMil2525bSymbols Returns the interface that enables creating 2525b symbols
Public Property StkPreferences Configures STK preferences.
Public Property UnitPreferences Provides access to the Global Unit table.
Public Property VgtRoot Returns an instance of VGT root object.

Example

Load a VDF
[C#] Copy Code
// Pass an empty string if there is no password to the VDF. 
root.LoadVDF(vdfPath, vdfPassword); 
 

Load a VDF
[Visual Basic .NET] Copy Code
' Pass an empty string if there is no password to the VDF.
root.LoadVDF(vdfPath, vdfPassword)

Start STK and get a reference to IAgStkObjectRoot
[MATLAB] Copy Code
%Create an instance of STK 
uiApplication = actxserver('STK11.application'); 
uiApplication.Visible = 1; 
 
%Get our IAgStkObjectRoot interface 
root = uiApplication.Personality2; 
 
 
Create instance of AgStkObjectRoot in STK Engine application
[MATLAB] Copy Code
% Before instantiating AgStkObjectRoot an instance of AgSTKXApplication or an STK X control must be created 
% This also requires a STKX license to be present 
STKXApplication = actxserver('STKX11.application'); 
rootEngine = actxserver('AgStkObjects11.AgStkObjectRoot'); 
 
 
Open a VDF
[MATLAB] Copy Code
% IAgStkObjectRoot root: STK Object Model Root 
root.LoadVDF('C:\Program Files\AGI\STK 11\Data\ExampleScenarios\Intro_STK_Space_Systems.vdf',''); 
 
 
Close an open Scenario
[MATLAB] Copy Code
% IAgStkObjectRoot root: STK Object Model Root 
root.CloseScenario; 
 
 
Close STK
[MATLAB] Copy Code
% AgUiApplication uiApplication: STK Application 
uiApplication.Quit; 
clear uiApplication root 
 
 
Get a reference to the AgStkObjectRoot using the running STK instance
[MATLAB] Copy Code
% Get reference to running STK instance 
uiApplication = actxGetRunningServer('STK11.application'); 
 
% Get our IAgStkObjectRoot interface 
root = uiApplication.Personality2; 
 
 
Create a new Scenario
[MATLAB] Copy Code
% IAgStkObjectRoot root: STK Object Model Root 
root.NewScenario('Example_Scenario'); 
 
 
STK window layout settings
[MATLAB] Copy Code
% COM.STK11_application uiApplication: STK Application 
% Loop through the available windows to close the Timeline and maximize the 
% 3D window 
timelineWindow = ''; 
for i=0:uiApplication.Windows.Count - 1 
    window = uiApplication.Windows.Item(i); 
    if (strcmp(window.Caption,'3D Graphics 1 - Earth')) 
        window.WindowState = 'eWindowStateMaximized'; 
    elseif (strcmp(window.Caption,'')) 
        timelineWindow = window; 
    end 
end 
timelineWindow.Close; 
 
 
Set unit preferences for Object Model
[MATLAB] Copy Code
% IAgStkObjectRoot root: STK Object Model Root 
root.UnitPreferences.Item('DateFormat').SetCurrentUnit('UTCG'); 
root.UnitPreferences.Item('Distance').SetCurrentUnit('km'); 
 
 
Execute Connect command
[MATLAB] Copy Code
root.ExecuteCommand('New / */Target MyTarget'); 
 
 
Execute multiple Connect commands
[MATLAB] Copy Code
commandList = {'New / */Place MyPlace';'SetPosition */Place/MyPlace Geodetic 37.9 -75.5 0.0'}; 
root.ExecuteMultipleCommands(commandList,'eExceptionOnError'); 
 
 
Extract data from Connect result
[MATLAB] Copy Code
result = root.ExecuteCommand('Report_RM */Place/MyPlace Style "Cartesian Position"'); 
 
for i = 0:result.Count-1 
    cmdRes = result.Item(i); 
    fprintf(' %s \n', cmdRes); 
end 
 
 

CoClasses that Implement IAgStkObjectRoot

© 2016 Analytical Graphics, Inc. All Rights Reserved.

STK Programming Interface 11.0.1