main
John Lauer Review cumulative land candidates and correct complete STEP assembly clearance checks ca3da55
"""CAD-derived explanatory plot, explicitly not a native screenshot or full copper map."""
from pathlib import Path
from PIL import Image,ImageDraw,ImageFont
import json,math
import sexp
R=Path(__file__).resolve().parents[1];O=R/'checkpoints/fuse-diode-land-review-v2'
font=lambda n:ImageFont.truetype('/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf',n)
im=Image.new('RGB',(1700,1030),'#101823');d=ImageDraw.Draw(im);d.text((42,25),'F1 footprint review: preserve the 0.20 mm clearance rule',fill='white',font=font(30))
for ix,(folder,title,sub)in enumerate([('fuse-diode-land-review','Before: clearance failure','Native DRC: 0.1339 mm, below 0.20 mm'),('fuse-diode-land-review-v2','After: bend shifted 0.20 mm','Native DRC: 0 violations / 0 opens')]):
 panel=Image.new('RGB',(790,770),'#182735');p=ImageDraw.Draw(panel);scale=108;xy=lambda a:((float(a[0])-102.5)*scale,(float(a[1])-88.5)*scale)
 b=sexp.parse((R/'checkpoints'/folder/'fuse-diode-land-candidate.kicad_pcb').read_text())
 for s in sexp.find(b,'segment'):
  if sexp.first(s,'layer')[1]!='F.Cu' or sexp.first(s,'net')[-1]!='DUT_POS':continue
  a=xy(sexp.first(s,'start')[1:]);z=xy(sexp.first(s,'end')[1:]);w=float(sexp.first(s,'width')[1])*scale;color='#55cbb0';p.line([a,z],fill=color,width=round(w))
  for x,y in [a,z]:p.ellipse((x-w/2,y-w/2,x+w/2,y+w/2),fill=color)
 for x,label,col in [(105.065,'1: DUT_POS','#55cbb0'),(107.735,'2: DUT_FUSED','#f1b86a')]:
  a=xy([x-.57,91-1.015]);z=xy([x+.57,91+1.015]);p.rectangle((*a,*z),fill=col);p.text((a[0]-8,a[1]-32),label,fill='white',font=font(19))
 p.text((32,665),'DUT_POS: 1.5 / 2.0 mm tracks',fill='white',font=font(22));p.text((32,700),'Same path length; no added vias',fill='#b9c8d6',font=font(21))
 x=40+ix*830;im.paste(panel,(x,185));d.text((x,93),title,fill='white',font=font(26));d.text((x,135),sub,fill='#b9c8d6',font=font(21))
d.text((42,975),'CAD-derived detail • F1 pads + DUT_POS only • Other copper omitted • Unadopted prototype candidate',fill='#b9c8d6',font=font(21));im.save(O/'fuse-escape-comparison.png')
print('Saved explanatory plot; not a native-view acceptance substitute')