summaryrefslogtreecommitdiff
path: root/gen
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2017-11-30 20:51:02 +0100
committerTrygve Laugstøl <trygvis@inamo.no>2017-11-30 20:51:02 +0100
commitefa60d73f8912f518a89072653efbceeeac28385 (patch)
tree62228f27165c3538d6c4cb1cec099fe1c840f520 /gen
downloadIPC-7351-footprints-generator-efa60d73f8912f518a89072653efbceeeac28385.tar.gz
IPC-7351-footprints-generator-efa60d73f8912f518a89072653efbceeeac28385.tar.bz2
IPC-7351-footprints-generator-efa60d73f8912f518a89072653efbceeeac28385.tar.xz
IPC-7351-footprints-generator-efa60d73f8912f518a89072653efbceeeac28385.zip
o Initial import.
Diffstat (limited to 'gen')
-rwxr-xr-xgen35
1 files changed, 35 insertions, 0 deletions
diff --git a/gen b/gen
new file mode 100755
index 0000000..6e850f6
--- /dev/null
+++ b/gen
@@ -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)