Add json only input.

This commit is contained in:
jmsgrogan 2017-10-20 17:59:05 +01:00
parent c9c98f91dc
commit afbacca3f4
21 changed files with 89611 additions and 118 deletions

View file

@ -0,0 +1,28 @@
import os
import sys
import random
import json
import product_gen.generate_lamp
from argparse import ArgumentParser
if __name__ == "__main__":
shape_params = json.loads(sys.argv[1])
shape = shape_params['shape']
output = shape_params['output']
if not os.path.exists(os.getcwd() + "/" + output):
os.makedirs(os.getcwd() + "/" + output)
height = 100.0 + random.random()*150.0
radius = 20.0 + random.random()*100.0
color = [18.0, 18.0, 18.0]
product_gen.generate_lamp.generate(shape, height, radius, color, output)
shape_parameters = {"shape": shape,
"height": height,
"radius": radius,
"color": color}
with open(os.getcwd() + "/" + output + "/"+ output + '.json', 'w') as outfile:
json.dump(shape_parameters, outfile)