main
ae007 Project page: AFS_Adom rev A (Rice Eclipse AFS clean-room AI redesign): highlight reel and narrated process video with… cbe460e 7d ago
"""GND stitching vias on a grid (spec.stitchVias as explicit {net,x,y} points), each spot checked against the LIVE copper the
same way as the heatsink vias (gen/tvias.py): inside the GND outer pour on both outer layers (so outside every other pour and
its clearance), clear of every other net's live track, via and pad, hole-to-hole 0.28 mm from every drill. Via 0.6/0.3.
Pitch 8 mm (spec stitchVias.GND.pitchMm); a spot that fails moves on a 0.5 mm search around its grid point."""
import json, math, sys
sys.argv = ['x']
SCR = '/tmp/claude-1001/-home-adom-project/8819fb5f-c2c6-4524-9528-99428cd6b88e/scratchpad'
src = open(SCR + '/gen/tvias.py').read().split("ALL = []")[0]
exec(src)
PITCH = 8.0
outline = board['outline']
pts = []
x = outline[0] + 4.0
ALL = []
# existing GND vias count as stitches: skip grid points within 3 mm of one
gnd_vias = [(v['position']['x'], v['position']['y']) for v in live['vias'] if v['net_name'] == 'GND']
while x < outline[2] - 3.0:
    y = outline[1] + 4.0
    while y < outline[3] - 3.0:
        if not any(math.dist((x, y), g) < 3.0 for g in gnd_vias):
            best = None
            for r in (0, 0.5, 1.0, 1.5, 2.0):
                for a in range(0, 360, 45 if r else 360):
                    c = (round(x + r * math.cos(math.radians(a)), 2), round(y + r * math.sin(math.radians(a)), 2))
                    if in_region(c, 'GND', 'F.Cu', 0.3) and in_region(c, 'GND', 'B.Cu', 0.3) and clear(c, 'GND', 0.3, 0.3, ALL):
                        best = c; break
                if best: break
            if best:
                ALL.append(best); pts.append({"net": "GND", "x": best[0], "y": best[1]})
        y += PITCH
    x += PITCH
spec = json.load(open(SCR + '/AFS_Adom/aiflow/spec.json'))
spec['stitchVias'] = pts
spec['stitchViasNote'] = 'GND stitching vias 0.6/0.3 on an 8 mm grid (gen/stitch.py): every spot inside the GND outer pour on both outer layers and checked against the live copper; grid points within 3 mm of an existing GND via are skipped. Ties the F.Cu/B.Cu GND pours to the In1.Cu plane (Fields: 8 A return squeezed through an F.Cu neck, 7 stitching gaps).'
spec['stitchViaSize'] = {"size": 0.6, "drill": 0.3}
json.dump(spec, open(SCR + '/AFS_Adom/aiflow/spec.json', 'w'), indent=1)
print('stitch vias', len(pts), pts[:6])