skill
EDA Skillpack
Public Made by Adomby adom
All skills for all EDA capabilities across the Adom ecosystem.
main
John Lauer
Independent end-to-end layout workflow and explicitly scoped Astra ESC source
e17f9f3
23d ago
from bridge import *
import re,math
s=json.load(open(D/'evidence/state.json')); F={p['ref']:p for p in s['footprints']}
tokens=re.findall(r'"(?:\\.|[^"\\])*"|[()]|[^\s()]+',(D/'esc-g431-unplaced.kicad_pcb').read_text())
stack=[];root=None
for t in tokens:
if t=='(':a=[];stack.append(a)
elif t==')':
a=stack.pop()
if stack:stack[-1].append(a)
else:root=a
else:stack[-1].append(json.loads(t) if t.startswith('"') else t)
def children(x,k):return [v for v in x if isinstance(v,list) and v and v[0]==k]
def child(x,k):return next(iter(children(x,k)),None)
P={}
for fp in children(root,'footprint'):
ref=next(v[2] for v in children(fp,'property') if v[1]=='Reference');ps=[]
for p in children(fp,'pad'):
at=child(p,'at');n=child(p,'net')
if n:ps.append(dict(pad=p[1],x=float(at[1]),y=float(at[2]),net=n[-1]))
P[ref]=ps
(D/'evidence/local-pads.json').write_text(json.dumps(P))
for r in ['U5','U4','U6','U2','Q1','Q2']:
print(r,P[r])