Description
Represents the automation interface supported by the root object of the Automation Object Model.
Public Methods
Public Properties
Interfaces
CoClasses that Implement IAgStkObjectRoot
Example
Load a VDF
| [C#] |
|---|
// Pass an empty string if there is no password to the VDF.
root.LoadVDF(vdfPath, vdfPassword);
|
|
Load a VDF
| [Visual Basic .NET] |
|---|
' Pass an empty string if there is no password to the VDF.
root.LoadVDF(vdfPath, vdfPassword)
|
|
Start STK Engine and get a reference to IAgStkObjectRoot
| [Python - STK API] |
|---|
# Start new instance of STK Engine
from agi.stk13.stkengine import STKEngine
stk = STKEngine.StartApplication(noGraphics=False) # optionally, noGraphics = True
# Get the IAgStkObjectRoot interface
root = stk.NewObjectRoot()
|
|
Get a reference to IAgStkObjectRoot using a running STK instance
| [Python - STK API] |
|---|
# Get reference to running STK instance
from agi.stk13.stkdesktop import STKDesktop
stk = STKDesktop.AttachToApplication()
# Get the IAgStkObjectRoot interface
root = stk.Root
|
|
Start STK and get a reference to IAgStkObjectRoot
| [Python - STK API] |
|---|
# Start new instance of STK
from agi.stk13.stkdesktop import STKDesktop
stk = STKDesktop.StartApplication(visible=True) #using optional visible argument
# Get the IAgStkObjectRoot interface
root = stk.Root
# ...
# Clean-up when done
stk.ShutDown()
|
|
Open a VDF
| [Python - STK API] |
|---|
# IAgStkObjectRoot root: STK Object Model Root
root.LoadVDF(r'C:\Program Files\AGI\STK_ODTK 13\Data\ExampleScenarios\Intro_STK_Space_Systems.vdf', '')
|
|
Close an open Scenario
| [Python - STK API] |
|---|
# IAgStkObjectRoot root: STK Object Model Root
root.CloseScenario()
|
|
Create a new Scenario
| [Python - STK API] |
|---|
# IAgStkObjectRoot root: STK Object Model Root
root.NewScenario('Example_Scenario')
|
|
Set unit preferences for Object Model
| [Python - STK API] |
|---|
# IAgStkObjectRoot root: STK Object Model Root
root.UnitPreferences.Item('DateFormat').SetCurrentUnit('UTCG')
root.UnitPreferences.Item('Distance').SetCurrentUnit('km')
|
|
Execute Connect command
| [Python - STK API] |
|---|
root.ExecuteCommand('New / */Target MyTarget')
|
|
Execute multiple Connect commands
| [Python - STK API] |
|---|
commandList = [['New / */Place MyPlace'], ['SetPosition */Place/MyPlace Geodetic 37.9 -75.5 0.0']]
root.ExecuteMultipleCommands(commandList, AgEExecMultiCmdResultAction.eExceptionOnError)
|
|
Extract data from Connect result
| [Python - STK API] |
|---|
result = root.ExecuteCommand('Report_RM */Place/MyPlace Style "Cartesian Position"')
for i in range(0, result.Count):
cmdRes = result.Item(i)
print(cmdRes)
|
|
Start STK and get a reference to IAgStkObjectRoot
| [MATLAB] |
|---|
% Create an instance of STK
uiApplication = actxserver('STK.Application');
uiApplication.Visible = 1;
% Get our IAgStkObjectRoot interface
root = uiApplication.Personality2;
|
|
Create instance of AgStkObjectRoot in STK Engine application
| [MATLAB] |
|---|
% 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('STKX13.Application');
rootEngine = actxserver('AgStkObjects13.AgStkObjectRoot');
|
|
Open a VDF
| [MATLAB] |
|---|
% IAgStkObjectRoot root: STK Object Model Root
root.LoadVDF('C:\Program Files\AGI\STK_ODTK 13\Data\ExampleScenarios\Intro_STK_Space_Systems.vdf', '');
|
|
Close an open Scenario
| [MATLAB] |
|---|
% IAgStkObjectRoot root: STK Object Model Root
if ~isempty(root.CurrentScenario)
root.CloseScenario();
end
|
|
Close STK
| [MATLAB] |
|---|
% AgUiApplication uiApplication: STK Application
uiApplication.Quit;
clear uiApplication root
|
|
Get a reference to the AgStkObjectRoot using the running STK instance
| [MATLAB] |
|---|
% Get reference to running STK instance
uiApplication = actxGetRunningServer('STK.Application');
% Get our IAgStkObjectRoot interface
root = uiApplication.Personality2;
|
|
Create a new Scenario
| [MATLAB] |
|---|
% IAgStkObjectRoot root: STK Object Model Root
root.NewScenario('Example_Scenario');
|
|
STK window layout settings
| [MATLAB] |
|---|
% AgUiApplication 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] |
|---|
% IAgStkObjectRoot root: STK Object Model Root
root.UnitPreferences.Item('DateFormat').SetCurrentUnit('UTCG');
root.UnitPreferences.Item('Distance').SetCurrentUnit('km');
|
|
Execute Connect command
| [MATLAB] |
|---|
root.ExecuteCommand('New / */Target MyTarget');
|
|
Execute multiple Connect commands
| [MATLAB] |
|---|
commandList = {'New / */Place MyPlace';'SetPosition */Place/MyPlace Geodetic 37.9 -75.5 0.0'};
root.ExecuteMultipleCommands(commandList, 'eExceptionOnError');
|
|
Extract data from Connect result
| [MATLAB] |
|---|
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
|
|