main
John Lauer Compare cooling options with dimensioned rough 2D layouts and probe reservations 2114785
from pathlib import Path
import html,json
P=Path(__file__).resolve().parents[1]/'docs/cooling-options'
# Dimensions are nominal bodies. All mounting/clearance budgets are explicit concepts.
cases=[
('A','Current R10 reference',72,104,76.2,76.1,69,'151 × 120 mm actual envelope','Historical assembly, not this schematic arrangement'),
('B','Preferred 50 mm chipset cooler',72,104,50,50,12,'137 × 114 mm planning envelope','Seller dimensions; replacement tach fan may add height'),
('C','40 mm chipset + 4010 fan',72,104,40,40,45,'127 × 114 mm planning envelope','38 mm sink depth; 40 mm fan controls the projection'),
('D','45 mm blower + ATS fin bank',72,104,45,80,30,'132 × 114 mm planning envelope','45 blower + 10 duct + 25 sink; assembly is a concept'),
('E','Thermalright AXP90-X36',72,104,94.5,95,36,'181.5 × 114 mm planning envelope','Manufacturer dimensions; 12 V auxiliary power needed'),
('F','Noctua NH-L9i',72,104,95,95,37,'182 × 114 mm planning envelope','95 × 95 conservative body from manufacturer infosheet'),
('G','Documented compact CPU tower',72,104,94,94,110,'181 × 114 mm planning envelope','Silver Soul 110 reference; not the unmeasured AliExpress tower'),
('H','ThinkPad laptop assembly',72,104,185,86,13,'272 × 114 mm ILLUSTRATIVE ONLY','Unverified reseller size; not a manufacturer fit drawing'),
('I','Smaller PCB + preferred cooler',60,85,50,50,12,'125 × 95 mm EXPLORATION TARGET','60 × 85 PCB not placed/routed; preserves no acceptance claim')]
BG='#101820';TX='#e5edf5';GREEN='#215a46';BLUE='#245b78';GOLD='#e8b465'
svg=[f'<svg xmlns="http://www.w3.org/2000/svg" width="1800" height="1590" viewBox="0 0 1800 1590"><rect width="1800" height="1590" fill="{BG}"/>']
def text(x,y,s,size=18,color=TX):svg.append(f'<text x="{x}" y="{y}" font-family="Arial,sans-serif" font-size="{size}" fill="{color}">{html.escape(s)}</text>')
def rect(x,y,w,h,fill,stroke='#60768b',dash=''):svg.append(f'<rect x="{x}" y="{y}" width="{w}" height="{h}" rx="3" fill="{fill}" stroke="{stroke}" stroke-width="1.5" '+(f'stroke-dasharray="{dash}"' if dash else '')+'/>')
text(35,45,'Cooling choices • identical top-view scale • dimensions in millimetres',30)
text(35,80,'Green = PCB   Blue = cooler body   Teal = proposed probe lane   Orange dashed = planning boundary',20)
text(35,110,'No 3D or collision claim. Cooling sits beside the PCB; Q1 must move to the edge/contact interface.',19)
for i,(id,title,bw,bh,cw,ch,z,env,note) in enumerate(cases):
 col=i%3;row=i//3; ox=20+col*595;oy=140+row*470
 rect(ox,oy,575,450,'#18232f','#314657')
 text(ox+15,oy+32,id+'  '+title,21)
 s=1.85; x=ox+20;y=oy+80
 if id=='A':
  rect(x,y,151*s,120*s,'none',GOLD,'7 5');rect(x+5*s,y+8*s,72*s,104*s,GREEN)
  rect(x+52*s,y+20*s,76.2*s,76.1*s,BLUE)
  text(x,y+230,'Baseline outline only; component positions schematic',15)
 else:
  rect(x,y,(bw+15+cw)*s,(max(bh,ch)+10)*s,'none',GOLD,'7 5')
  px=x+5*s;py=y+5*s
  rect(px,py,bw*s,bh*s,GREEN)
  rect(px+10*s,py+12*s,18*s,(bh-24)*s,'#247d80')
  cx=px+(bw+5)*s;cy=py+(bh-ch)/2*s
  rect(cx,cy,cw*s,ch*s,BLUE)
  for hx in [px+5*s,px+(bw-5)*s]:
   for hy in [py+5*s,py+(bh-5)*s]:svg.append(f'<circle cx="{hx}" cy="{hy}" r="4" fill="{GOLD}"/>')
  # Interface area is proposed, not a routed MOSFET location.
  rect(px+(bw-3)*s,py+(bh/2-6)*s,8*s,12*s,'#d49c47')
  text(cx+5,cy+ch*s/2,f'{cw:g} × {ch:g}',16)
  text(px,py+bh*s+22,f'PCB {bw:g} × {bh:g}',16)
  if id=='D':
   rect(cx,cy,45*s,45*s,'#377c9d');rect(cx+10*s,cy+55*s,25*s,25*s,'#426078')
  if id=='H':text(cx+5,cy+20,'SIZE UNVERIFIED',16,GOLD)
 text(ox+15,oy+338,env,21,GOLD)
 text(ox+15,oy+371,f'Cooler/body height: {z:g} mm'+(' nominal' if id!='A' else ' assembly'),18)
 # wrap note
 import textwrap
 for n,line in enumerate(textwrap.wrap(note,58)):text(ox+15,oy+402+n*21,line,16)
svg.append('</svg>');(P/'layouts.svg').write_text(''.join(svg))
(P/'layout-data.json').write_text(json.dumps(cases,indent=2))
import cairosvg
cairosvg.svg2png(url=str(P/'layouts.svg'),write_to=str(P/'layouts.png'))

svg=[f'<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="760" viewBox="0 0 1200 760"><rect width="1200" height="760" fill="{BG}"/>']
text(30,40,'Preferred 50 mm cooler: two packing choices',28)
text(30,75,'Same scale • 2D concepts • contact stack / airflow / probe travel still unresolved',18)
for x,bw,env,title,side in [(40,72,137,'Beside existing-size PCB',True),(670,80,90,'Dedicated on-board cooling bay',False)]:
 s=3; y=160
 text(x,120,title,22)
 rect(x,y,env*s,114*s,'none',GOLD,'7 5')
 px=x+15;py=y+15
 rect(px,py,bw*s,104*s,GREEN)
 if side:
  rect(px+10*s,py+12*s,18*s,80*s,'#247d80')
  rect(px+77*s,py+27*s,50*s,50*s,BLUE)
  text(px+79*s,py+52*s,'50 × 50',18)
 else:
  rect(px+2.5*s,py+27*s,50*s,50*s,BLUE)
  rect(px+57.5*s,py+12*s,20*s,80*s,'#247d80')
  text(px+5*s,py+52*s,'50 × 50',18)
 text(x,550,f'PCB {bw} × 104 mm',22)
 text(x,585,f'Planning carrier {env} × 114 mm',22,GOLD)
 text(x,620,'Probe lane reserved; positions not routed',17)
 text(x,650,'Height = mounting stack + nominal 12 mm cooler',17)
text(30,710,'The 80 mm PCB is an exploration target. Cooler covers board area; every needed probe point must remain exposed.',18)
svg.append('</svg>')
(P/'preferred-layouts.svg').write_text(''.join(svg))
cairosvg.svg2png(url=str(P/'preferred-layouts.svg'),write_to=str(P/'preferred-layouts.png'))