51 lines
2 KiB
Python
51 lines
2 KiB
Python
import os
|
|
import product_gen.generate_lamp
|
|
import product_gen.render_lamp
|
|
|
|
from argparse import ArgumentParser
|
|
|
|
def run(height, radius, color, output_id):
|
|
thickness = 3.0
|
|
shade = product_gen.generate_lamp.generate_shade(height, radius, thickness)
|
|
work_dir = os.getcwd()
|
|
shade.exportStl(work_dir + "/shade_" + output_id + ".stl")
|
|
|
|
base_height = 20.0
|
|
base_radius = 15.0
|
|
thickness = 3.0
|
|
base = product_gen.generate_lamp.generate_base(base_height,
|
|
base_radius,
|
|
thickness)
|
|
base.exportStl(work_dir + "/base_" + output_id + ".stl")
|
|
|
|
chord_height = 150.0
|
|
chord_radius = 2.0
|
|
thickness = 1.0
|
|
chord = product_gen.generate_lamp.generate_chord(chord_height,
|
|
chord_radius,
|
|
thickness)
|
|
chord.exportStl(work_dir + "/chord_" + output_id + ".stl")
|
|
|
|
product_gen.render_lamp.render_lamp(work_dir + "/shade_" + output_id + ".stl",
|
|
work_dir + "/base_" + output_id + ".stl",
|
|
work_dir + "/chord_" + output_id + ".stl",
|
|
work_dir + "/lamp_" + output_id + ".png",
|
|
color = color)
|
|
|
|
if __name__ == "__main__":
|
|
parser = ArgumentParser()
|
|
parser.add_argument('-height', type=float, help='Height.')
|
|
parser.add_argument('-radius', type=float, help='Radius.')
|
|
parser.add_argument('-r', type=float, help='Red intensity.')
|
|
parser.add_argument('-g', type=float, help='Green intensity.')
|
|
parser.add_argument('-b', type=float, help='Blue intensity.')
|
|
parser.add_argument('-o', type=str, help='Output identifier.')
|
|
parser.add_argument('-s', type=int, help='Stage identifier.')
|
|
|
|
args = parser.parse_args()
|
|
color = [args.r, args.g, args.b]
|
|
if args.s == 0:
|
|
color = [18.0, 18.0, 18.0]
|
|
|
|
run(args.height, args.radius, color, args.o)
|
|
|