Commit e4efcf24 authored by lode_leroy's avatar lode_leroy
parent 971b6b2d
#!/usr/bin/python
import sys
import os
from optparse import OptionParser
from pycam.Gui.SimpleGui import SimpleGui
from pycam.Importers.TestModel import TestModel
gui = SimpleGui()
inputfile = None
outputfile = None
display = False
for arg in sys.argv[1:]:
if arg == "-gui":
display = True
elif arg[0] != '-':
if not inputfile:
inputfile = arg
elif not outputfile:
outputfile = arg
if not inputfile:
gui.model = TestModel()
gui.mainloop()
else:
gui.open(inputfile)
if display:
# check if we were started as a separate program
if __name__ == "__main__":
inputfile = None
outputfile = None
parser = OptionParser(usage="usage: %prog [--gui] [inputfile [outputfile]]")
parser.add_option("", "--gui", dest="display",
action="store_true", default=False,
help="ignore 'outputfile' and show the GUI window")
(options, args) = parser.parse_args()
if len(args) > 0:
inputfile = args[0]
if len(args) > 1:
outputfile = args[1]
if len(args) > 2:
parser.error("too many arguments given (%d instead of %d)" % (len(args), 2))
gui = SimpleGui()
if not inputfile:
gui.model = TestModel()
gui.mainloop()
else:
gui.generateToolpath()
if outputfile:
gui.save(outputfile)
gui.open(inputfile)
if options.display:
gui.mainloop()
else:
gui.generateToolpath()
if outputfile:
gui.save(outputfile)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment