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 = shape_params["height"]
radius = shape_params["radius"]
color = [random.random()*255.0,
random.random()*255.0,
random.random()*255.0]
product_gen.generate_lamp.generate(shape, height, radius, color, output)
shape_parameters = shape_params
shape_parameters["color"] = color
with open(os.getcwd() + "/" + output + "/"+ output + '.json', 'w') as outfile:
json.dump(shape_parameters, outfile)