main
John Lauer
Continue compact 5 W prototype; record AIFlow continuation fix and isolated cooling envelope work
6cd702a
"""Screen nominal XY cooling envelopes against actual probe centers and tall connectors.
This is a conservative planning view, not a mechanical or thermal acceptance check.
"""
from pathlib import Path
import sys,json,math,hashlib
sys.path.insert(0,str(Path(__file__).parent));import sexp
p=Path(__file__).resolve().parents[1];board=p/'kicad/adom-custom-electronic-load.kicad_pcb'
b=sexp.parse(board.read_text());refs={}
for f in sexp.find(b,'footprint'):
props={v[1]:v[2]for v in sexp.find(f,'property')};at=sexp.first(f,'at');refs[props['Reference']]={'at':[float(x)for x in at[1:]],'model':[m[1]for m in sexp.find(f,'model')]}
# Bounding boxes extracted from fitted generic KiCad STEP, not manufacturer qualification.
header_bbox={'J9':[-1.27,-6.35,-3,1.27,1.27,8.54],'J10':[-1.27,-3.81,-3,1.27,1.27,8.54]}
def project(ref,box):
at=refs[ref]['at'];x,y=at[:2];a=math.radians(at[2]if len(at)>2 else 0);co,si=math.cos(a),math.sin(a)
pts=[(x+co*u-si*v,y-si*u+co*-v)for u in [box[0],box[3]]for v in [box[1],box[4]]]
return [min(t[0]for t in pts),min(t[1]for t in pts),max(t[0]for t in pts),max(t[1]for t in pts)]
headers={r:project(r,bb)for r,bb in header_bbox.items()}
candidates=[{'name':'Centered 50 mm sink','box':[102.46,46,152.46,96]}, {'name':'Offset 50 mm sink','box':[112,35,162,85]}]
for c in candidates:
x0,y0,x1,y1=c['box'];c['probeKeepoutRadiusMm']=2;c['probeConflicts']=[r for r,d in refs.items()if r.startswith('TP')and x0-2<d['at'][0]<x1+2 and y0-2<d['at'][1]<y1+2];c['headerConflicts']=[r for r,bb in headers.items()if max(x0,bb[0])<min(x1,bb[2])and max(y0,bb[1])<min(y1,bb[3])];c['accepted']=False
report={'boardSha256':hashlib.sha256(board.read_bytes()).hexdigest(),'basis':'Nominal 50 x 50 x 10 mm sink and 40 x 40 x 20 mm fan; no assembly accepted','nominalStackMmAboveBoard':4.455+0.2+10+20,'notIncluded':['height tolerance','fan guard','mounting hardware','wire bends','installed airflow','case interface/spreading resistance'],'headerBoundsMm':headers,'candidates':candidates,'nextAction':'Offset candidate moves TP4 to (100.8,77.2), TP8 to (100.8,80), J9 to (154.6,98), rotation -90; native routing and full fitted-body acceptance remain required.'}
(p/'mechanical/cooling-envelope-review.json').write_text(json.dumps(report,indent=2)+'\n')
print(json.dumps(report,indent=2))