modern form of croaking, added '*draw_automatic' as final output

This commit is contained in:
Philip Eisenlohr 2017-04-14 15:07:43 -04:00
parent 4ffca8f0dc
commit c34716a0da
1 changed files with 14 additions and 13 deletions

View File

@ -153,34 +153,31 @@ parser.add_option("-p", "--port", type="int", dest="port", metavar='int',
help="Mentat connection port [%default]") help="Mentat connection port [%default]")
parser.add_option("-v", "--verbose", action="store_true", dest="verbose", parser.add_option("-v", "--verbose", action="store_true", dest="verbose",
help="write Mentat command stream also to stdout [%default]") help="write Mentat command stream also to stdout [%default]")
parser.set_defaults(port = 40007) parser.set_defaults(port = 40007,
parser.set_defaults(verbose = False) verbose = False)
(options, args) = parser.parse_args() (options, args) = parser.parse_args()
if options.verbose:
file={'croak':sys.stderr}
else:
file={'croak':sys.stdout}
try: try:
import py_mentat import py_mentat
except: except:
file['croak'].write('error: no valid Mentat release found') damask.util.croak('error: no valid Mentat release found')
sys.exit(-1) sys.exit(-1)
outputLocals = {} outputLocals = {}
file['croak'].write('\033[1m'+scriptName+'\033[0m\n\n') damask.util.report(scriptName,'waiting to connect...')
file['croak'].write( 'waiting to connect...\n')
try: try:
py_mentat.py_connect('',options.port) py_mentat.py_connect('',options.port)
# prevent redrawing in Mentat, should be much faster. Since py_connect has no return value, try this to determine if failed or not # prevent redrawing in Mentat, should be much faster.
# Since py_connect has no return value, try this to determine if failed or not
output(['*draw_manual'],outputLocals,'Mentat') output(['*draw_manual'],outputLocals,'Mentat')
except: except:
file['croak'].write('Could not connect. Set Tools/Python/"Run as Separate Process" & "Initiate"...\n') damask.util.croak('Could not connect. Set Tools/Python/"Run as Separate Process" & "Initiate"...')
sys.exit() sys.exit()
file['croak'].write( 'connected...\n')
damask.util.croak('connected...')
output(['*remove_all_servos', output(['*remove_all_servos',
'*sweep_all', '*sweep_all',
@ -190,6 +187,10 @@ output(['*remove_all_servos',
cmds = servoLink() cmds = servoLink()
output(cmds,outputLocals,'Mentat') output(cmds,outputLocals,'Mentat')
output(['*draw_automatic',
],outputLocals,'Mentat') # script depends on consecutive numbering of nodes
py_mentat.py_disconnect() py_mentat.py_disconnect()
if options.verbose: if options.verbose: