diff options
Diffstat (limited to 'gen')
-rwxr-xr-x | gen | 35 |
1 files changed, 35 insertions, 0 deletions
@@ -0,0 +1,35 @@ +#!/usr/bin/env python + +from jinja2 import Environment, FileSystemLoader, select_autoescape +import os.path + +basedir=os.path.dirname(__file__) + +env = Environment( + loader=FileSystemLoader(os.path.join(basedir, 'templates')) +) + +chip = env.get_template('CHIP.j2') + +resc_parameters = [ + # size x, size y, pad x, pad y, pad center-center, grid x, grid y, terminal x, heights + (10, 5, 0.90, 0.70, 1.30, 6, 2, (0.10, 0.30), [15, 35, 37, 40]), + (16, 8, 1.10, 1.00, 1.70, 6, 4, (0.15, 0.40), [40]), + (20, 12, 1.30, 1.50, 1.90, 8, 4, (0.15, 0.65), [40]), + (32, 16, 1.60, 1.80, 2.80, 10, 4, (0.25, 0.75), [40]), + (32, 25, 1.60, 2.70, 2.80, 10, 6, (0.25, 0.75), [40]), + (50, 25, 1.80, 2.70, 4.40, 14, 6, (0.35, 0.85), [40]), + (63, 32, 1.80, 3.20, 5.60, 16, 8, (0.35, 0.85), [40]), +] + +for (sx, sy, px, py, pcc, gx, gy, tx, heights) in resc_parameters: + tx = (tx[0] + tx[1]) / 2 + print("RESC{:02}{:02}".format(sx, sy)) + gx = gx*0.5 + gy = gy*0.5 + for h in heights: + key = "RESC{:02}{:02}X{:02}".format(sx, sy, h) + print(" " + key) + kicad_mod = chip.render({"key": key, "sx": sx, "sy": sy, "px": px, "py": py, "pcc": pcc, "gx": gx, "gy": gy, "h": h}) + with open("{}.kicad_mod".format(key), "w") as f: + f.write(kicad_mod) |