main
John Lauer Record gentle fan hero demonstration and reconcile accepted copper plan 789bee4
"""Reconcile declared pour boundaries to the accepted native board; no copper edits."""
from pathlib import Path
import hashlib,json
import sexp
P=Path(__file__).resolve().parents[1];board=P/'kicad/adom-custom-electronic-load.kicad_pcb';raw=board.read_bytes();expected='653e54e711552eb2f16b6d01cd144fd82645a52c30ff11e39699b760402af51a';assert hashlib.sha256(raw).hexdigest()==expected
b=sexp.parse(raw.decode());zones=[]
for z in sexp.find(b,'zone'):
 assert not sexp.first(z,'keepout')
 n=sexp.first(z,'name')[1];net=sexp.first(z,'net')[1];layer=sexp.first(z,'layer')[1];connect=sexp.first(z,'connect_pads');assert connect[1]=='yes'
 points=[[float(x[1]),float(x[2])]for x in sexp.find(sexp.first(sexp.first(z,'polygon'),'pts'),'xy')]
 zones.append({'name':n,'net':net,'layers':[layer],'polygon':points,'priority':int((sexp.first(z,'priority')or['priority',0])[1]),'connection':'solid','clearance':float(sexp.first(connect,'clearance')[1]),'minThickness':float(sexp.first(z,'min_thickness')[1])})
assert len(zones)==7
f=P/'design/spec.json';j=json.loads(f.read_text());before=j['pours'];j['pours']=zones;f.write_text(json.dumps(j,indent=2)+'\n')
(P/'design/pour-spec-reconciliation.json').write_text(json.dumps({'boardSha256':expected,'scope':'Declared planned zone boundaries reconciled to accepted native board; not a filled-connectivity or thermal proof','before':before,'after':zones},indent=2)+'\n')
print('Reconciled seven existing native zone boundaries. Board unchanged.')