#!/usr/bin/env python3 """ SN-L00 Component Placement Script for 6HP Eurorack Board at origin (0,0) to (28,100) Run in KiCad PCB Editor: Tools → Scripting Console Then: exec(open('scripts/place_6hp.py').read()) """ import pcbnew board = pcbnew.GetBoard() def mm(val): return pcbnew.FromMM(val) def place(x, y): return pcbnew.VECTOR2I(mm(x), mm(y)) # Component positions for 6HP (28mm x 100mm) layout # Board origin at (0,0), components placed relative to that placements = { # Top - OLED display (rotated 90°, 13mm wide when rotated) "MOD3": (14, 18, 90), # Audio jacks "J3": (7, 40, 0), # RETURN_IN "J4": (21, 40, 0), # TRIG_OUT # Button "SW1": (14, 54, 0), # RP2040-Zero module "MOD2": (14, 70, 0), # Signal conditioning ICs "U2": (6, 85, 0), # 74LVC1G17 "U4": (22, 85, 0), # MCP6001 # Resistors "R2": (3, 90, 0), "R3": (7, 90, 0), "R4": (11, 90, 0), "R5": (15, 90, 0), "R6": (19, 90, 0), "R7": (23, 90, 0), # Decoupling caps "C4": (3, 85, 90), "C5": (11, 85, 90), "C6": (25, 85, 90), # LED "D5": (25, 90, 0), # Protection diodes "D3": (6, 94, 0), "D4": (22, 94, 0), # Power section "J2": (14, 94, 0), # Eurorack power header "D2": (3, 94, 90), # Protection diode "U3": (25, 94, 180), # LDO - moved right "C2": (3, 90, 90), # Input cap "C3": (25, 90, 90), # Output cap - moved right } print("Placing components for 6HP Eurorack layout...") placed = 0 not_found = [] for ref, (x, y, rot) in placements.items(): fp = board.FindFootprintByReference(ref) if fp: fp.SetPosition(place(x, y)) fp.SetOrientationDegrees(rot) placed += 1 print(f" {ref} -> ({x}, {y}) rot={rot}°") else: not_found.append(ref) print(f"\nPlaced {placed} components") if not_found: print(f"Not found: {', '.join(not_found)}") pcbnew.Refresh() print("\nDone! Save (Ctrl+S), then export DSN for routing.")