skill
EDA Skillpack
Public Made by Adomby adom
All skills for all EDA capabilities across the Adom ecosystem.
main
from geometry import *
s=json.load(open('evidence/final-routing-state.json'));calls=[json.loads(l) for l in open('evidence/calls.jsonl')];commits=[c for c in calls if c['verb']=='kicad_route_net' and not c['args'].get('dryRun') and c['result'].get('success')];zones=json.load(open('outer-pours.json'))+json.load(open('kelvin-pad-keepouts.json'));keep=unary_union([Polygon(z['polygon']) for z in zones if z.get('type')=='keepout']);out={}
for net,ref,shunt,c in [('GND','U6.3','R32.2',commits[0]),('GND_OUT','U6.4','R32.1',commits[1])]:
ids=set(c['result']['itemIds']);track=unary_union([LineString([list(t['start'].values()),list(t['end'].values())]).buffer(t['width']/2) for t in s['segments'] if t['uuid'] in ids]);p=next(p for p in pads if p['name']==ref);q=next(p for p in pads if p['name']==shunt);protected=track.union(p['g']).difference(q['g']);other=[]
for t in s['segments']:
if t['net_name']==net and t['layer']=='F.Cu' and t['uuid'] not in ids:other.append(LineString([list(t['start'].values()),list(t['end'].values())]).buffer(t['width']/2))
for v in s['vias']:
if v['net_name']==net:other.append(Point(v['position']['x'],v['position']['y']).buffer(v['size']/2))
for pad in pads:
if pad['net']==net and pad['name'] not in [ref,shunt]:other.append(pad['g'])
hits=protected.intersection(unary_union(other));out[ref]={'net':net,'inputPadOutsideKeepoutMm2':p['g'].difference(keep).area,'protectedTraceOutsideKeepoutMm2':protected.difference(keep).area,'otherSameNetCopperIntersectionMm2':hits.area,'scope':'Exact live trace/via geometry plus input pad shapes and committed keepout outlines. Filled polygons are not exposed by zone_state; no claim of direct filled-polygon intersection measurement.'}
print(json.dumps(out,indent=2));Path('evidence/kelvin-geometry-audit.json').write_text(json.dumps(out,indent=2))