-
Notifications
You must be signed in to change notification settings - Fork 0
/
runMCD.py
53 lines (42 loc) · 1.07 KB
/
runMCD.py
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
import sys
import os
import comtypes.client as cc
# lenth of command line arguments
l = len(sys.argv)
# print usage help
def printHelp():
print("usage: runMCD.exe pxczPath")
print("argument: pxczPath path to .pxcz file to run")
# verify that there is only one command line argument
if (l != 2):
printHelp()
print("Expect exactly one argument, found: " + str(l))
sys.exit(0)
# path to workflow
p = sys.argv[1]
# verify that file extension is correct
if not p.endswith(".pxcz"):
printHelp()
print("Expected .pxcz file")
print("Invalid file extension: " + p)
sys.exit(0)
# verify that file exists
if not os.path.isfile(p):
printHelp()
print("File not found: " + p)
sys.exit(0)
# get absolute path to workflow
p = os.path.abspath(p)
print("Path to .pxcz file:")
print(p)
# create ModelCenter Desktop COM object
print("Creating ModelCenter Application Object")
mcao = cc.CreateObject("ModelCenter.Application")
# load path to workflow
print("Loading Workflow")
mcao.loadModel(p)
# run workflow
print("Running Workflow")
mcao.run("")
# done !
print("Script Complete")