-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathmain.py
30 lines (22 loc) · 850 Bytes
/
main.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
from src.ASMBL_parser import Parser
import json
import argparse
import os
def arg_parser_json(arg):
if arg is None:
return arg
if not os.path.exists(arg):
raise argparse.ArgumentTypeError("The file %s does not exist!" % arg)
else:
return json.load(open(arg, 'r')) # return a dict from the json
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser(description='ASMBL Code Creation Tool')
arg_parser.add_argument('--config', '-C', type=arg_parser_json, default='config.json',
metavar='FILE', help='path to json config file')
args = arg_parser.parse_args()
print('parsing files...')
asmbl_parser = Parser(args.config)
print('saving output...')
asmbl_parser.create_output_file(asmbl_parser.merged_gcode_script)
print('complete')
pass