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






Windows & Linux

Description

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

Object Model







Public Methods

Public Method AllInstanceNamesToXMLReturns an XML representation of AllInstanceNames.
Public Method AvailableMarkerTypesThis property is deprecated. Use the AvailableMarkerTypes property from the IAgScVO interface. Retrieves the list of available MarkerTypes
Public Method BeginUpdateSignals the object that the batch update is starting.
Public Method CloseScenarioCloses the scenario. The method throws an exception if no scenario has been loaded.
Public Method EndUpdateSignals the object that the batch update is complete.
Public Method ExecuteCommandExecutes 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 GetLicensingReportReturns a formatted string that contains the license names and their states. The string is formatted as an XML document.
Public Method GetObjectFromPathGets the object instance that matches the path provided
Public Method IsolateMutually isolates unit preference settings in the current instance from those in other instances of the root.
Public Method LoadLoads a scenario/vdf using the specified path. The method throws an exception if there is a scenario already loaded.
Public Method LoadCustomMarkerAdds a custom marker to Application
Public Method LoadScenarioUse Load method. Loads a scenario using the specified path. The method throws an exception if there is a scenario already loaded.
Public Method LoadVDFLoads 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 NewScenarioCreates a new scenario. User must close a scenario before creating a new one; otherwise an exception will occur.
Public Method ObjectExistsChecks whether a currently loaded scenario contains an object with the given path.
Public Method SaveSaves the changes made to the scenario/vdf.
Public Method SaveAsSaves the changes made to the scenario/vdf to a specified path and file name.
Public Method SaveScenarioUse Save method. Saves the changes made to the scenario.
Public Method SaveScenarioAsUse SaveAs method. Saves the changes made to the scenario to a specified path and file name.
Public Method SaveVDFAsSaves the changes made to the scenario to a specified path and file name as a vdf file.

Public Properties

Public Property AvailableFeaturesAllows the user to inquiry about the available features
Public Property CentralBodiesReturns a collection of available central bodies.
Public Property ConversionUtilityReturns the conversion utility interface.
Public Property CurrentScenarioReturns a Scenario object or null if no scenario has been loaded yet.
Public Property IsolatedReturns whether the instance is isolated.
Public Property NotificationFilterThe 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 StdMil2525bSymbolsReturns the interface that enables creating 2525b symbols
Public Property StkPreferencesConfigures STK preferences.
Public Property UnitPreferencesProvides access to the Global Unit table.
Public Property VgtRootReturns 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 
 
 
Start STK and get a reference to IAgStkObjectRoot using a running STK instance
[Python]Copy Code
# NOTE: To run these code snippets, see FAQ "Getting Started STK COM integration using Python" at http://agiweb.force.com/faqs 
# Get reference to running STK instance 
from win32com.client import GetActiveObject 
uiApplication = win32com.client.GetActiveObject('STK11.Application') 
uiApplication.Visible = True 
 
# if using the comtypes Library 
from comtypes.client import GetActiveObject 
uiApplication=GetActiveObject('STK11.Application') 
uiApplication.Visible=True 
 
# Get our IAgStkObjectRoot interface 
root = uiApplication.Personality2 
 
 
Start STK and get a reference to IAgStkObjectRoot starting a new STK instance
[Python]Copy Code
from win32com.client import GetActiveObject 
uiApplication = win32com.client.Dispatch('STK11.Application') 
uiApplication.Visible = True 
 
# Start new instance of STK 
from comtypes.client import CreateObject 
uiApplication = CreateObject('STK11.Application') 
uiApplication.Visible = True 
 
# Get our IAgStkObjectRoot interface 
root = uiApplication.Personality2 
 
 
Open a VDF
[Python]Copy Code
# IAgStkObjectRoot root: STK Object Model Root 
root.LoadVDF(r'C:\Program Files\AGI\STK 11\Data\ExampleScenarios\Intro_STK_Space_Systems.vdf','') 
 
 
Close an open Scenario
[Python]Copy Code
# IAgStkObjectRoot root: STK Object Model Root 
root.CloseScenario 
 
 
Close STK
[Python]Copy Code
# AgUiApplication uiApplication: STK Application 
uiApplication.Quit 
clear uiApplication root 
 
 
Create a new Scenario
[Python]Copy Code
# IAgStkObjectRoot root: STK Object Model Root 
root.NewScenario('Example_Scenario') 
 
 
Set unit preferences for Object Model
[Python]Copy Code
# IAgStkObjectRoot root: STK Object Model Root 
root.UnitPreferences.Item('DateFormat').SetCurrentUnit('UTCG') 
root.UnitPreferences.Item('Distance').SetCurrentUnit('km') 
 
 
Execute Connect command
[Python]Copy Code
root.ExecuteCommand('New / */Target MyTarget') 
 
 
Execute multiple Connect commands
[Python]Copy Code
commandList = [ ['New / */Place MyPlace'],['SetPosition */Place/MyPlace Geodetic 37.9 -75.5 0.0'] ] 
root.ExecuteMultipleCommands(commandList,2) # eExceptionOnError 
 
 
Extract data from Connect result
[Python]Copy Code
result = root.ExecuteCommand('Report_RM */Place/MyPlace Style "Cartesian Position"') 
 
for i in range(0,result.Count): 
    cmdRes = result.Item(i) 
    print(cmdRes) 
 
 

CoClasses that Implement IAgStkObjectRoot

© 2018 Analytical Graphics, Inc. All Rights Reserved.