-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstk_closed_test.py
More file actions
84 lines (65 loc) · 2.6 KB
/
stk_closed_test.py
File metadata and controls
84 lines (65 loc) · 2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import time
from tqdm import tqdm
startTime = time.time()
from comtypes.gen import STKObjects, STKUtil, AgStkGatorLib
from comtypes.client import CreateObject, GetActiveObject, GetEvents, CoGetObject, ShowEvents
from ctypes import *
import comtypes.gen._00020430_0000_0000_C000_000000000046_0_2_0
from comtypes import GUID
from comtypes import helpstring
from comtypes import COMMETHOD
from comtypes import dispid
from ctypes.wintypes import VARIANT_BOOL
from ctypes import HRESULT
from comtypes import BSTR
from comtypes.automation import VARIANT
from comtypes.automation import _midlSAFEARRAY
from comtypes import CoClass
from comtypes import IUnknown
import comtypes.gen._00DD7BD4_53D5_4870_996B_8ADB8AF904FA_0_1_0
import comtypes.gen._8B49F426_4BF0_49F7_A59B_93961D83CB5D_0_1_0
from comtypes.automation import IDispatch
import comtypes.gen._42D2781B_8A06_4DB2_9969_72D6ABF01A72_0_1_0
from comtypes import DISPMETHOD, DISPPROPERTY, helpstring
"""
SET TO TRUE TO USE ENGINE, FALSE TO USE GUI
"""
useStkEngine = True #true不显示窗口,false显示窗口
Read_Scenario = False
############################################################################
# Scenario Setup
############################################################################
if useStkEngine:
# Launch STK Engine
print("Launching STK Engine...")
stkxApp = CreateObject("STKX11.Application")
# Disable graphics. The NoGraphics property must be set to true before the root object is created.
stkxApp.NoGraphics = True
# Create root object
stkRoot = CreateObject('AgStkObjects11.AgStkObjectRoot')
else:
# Launch GUI
print("Launching STK...")
if not Read_Scenario:
uiApp = CreateObject("STK11.Application")
else:
uiApp = GetActiveObject("STK11.Application")
uiApp.Visible = True
uiApp.UserControl = True
# Get root object
stkRoot = uiApp.Personality2
# Set date format
stkRoot.UnitPreferences.SetCurrentUnit("DateFormat", "UTCG")
# Create new scenario
print("Creating scenario...")
if not Read_Scenario:
# stkRoot.NewScenario('Kuiper')
stkRoot.NewScenario('StarLink')
scenario = stkRoot.CurrentScenario
scenario2 = scenario.QueryInterface(STKObjects.IAgScenario)
# scenario2.StartTime = '24 Sep 2020 16:00:00.00'
# scenario2.StopTime = '25 Sep 2020 16:00:00.00'
totalTime = time.time() - startTime
splitTime = time.time()
print("--- Scenario creation: {a:4.3f} sec\t\tTotal time: {b:4.3f} sec ---".format(a=totalTime, b=totalTime))
#stkRoot.ExecuteCommand('Units_get * Report')