Support

Scripting with Python

Posted 5 months ago by Matt Halferty

Post a topic
Answered
M
Matt Halferty Admin

How do I automate access reports 

0 Votes

E

Ethan Poley posted 5 months ago Best Answer

Hey Matt, 

To automate the creation of access reports in Python, we can Python's ability to run connect commands. To do this we have to have a running instance of STK with our scenario where we would like to compute access. Alternatively, you can include this command at the end of a scenario you have written in Python. 


To connect your code editor to your current STK scenario, include the following code: 

from agi.stk12.stkdesktop import STKDesktop
from agi.stk12.stkobjects import *
from agi.stk12.stkutil import *
stk = STKDesktop.AttachToApplication()
root = stk.Root


To generate and view an access report using Python, run the following:


root.ExecuteCommand("ReportCreate */Satellite/<name of satellite> Style \"Access\" AccessObject */Facility/<name of facility> Type Display")


You can replace the Satellite and Facility objects shown here with the objects you wish to compute access between.


Hope this helps!

0 Votes


1 Comments

E

Ethan Poley posted 5 months ago Answer

Hey Matt, 

To automate the creation of access reports in Python, we can Python's ability to run connect commands. To do this we have to have a running instance of STK with our scenario where we would like to compute access. Alternatively, you can include this command at the end of a scenario you have written in Python. 


To connect your code editor to your current STK scenario, include the following code: 

from agi.stk12.stkdesktop import STKDesktop
from agi.stk12.stkobjects import *
from agi.stk12.stkutil import *
stk = STKDesktop.AttachToApplication()
root = stk.Root


To generate and view an access report using Python, run the following:


root.ExecuteCommand("ReportCreate */Satellite/<name of satellite> Style \"Access\" AccessObject */Facility/<name of facility> Type Display")


You can replace the Satellite and Facility objects shown here with the objects you wish to compute access between.


Hope this helps!

0 Votes

Login or Sign up to post a comment