main
John Lauer Refresh heatsink table icon to the refined photo-informed CAD de486ce
"""Photo-informed refinement; not a substitute for the ATS login-gated STEP."""
from pathlib import Path
import cadquery as cq,json,hashlib,shutil
R=Path(__file__).resolve().parents[1];P=R/'components/ats-fpx040040035-66-c2-r0';(P/'review').mkdir(exist_ok=True)
for name in ['hero.glb','cad/catalog-envelope.step']:
 dst=P/'review'/('superseded-'+Path(name).name)
 if not dst.exists():shutil.copy2(P/name,dst)
base=cq.Workplane('XY').box(40,40,3,centered=(True,True,False))
# Rounded integral diagonal tabs; exact outline and bore remain inferred.
for sign in [-1,1]:
 ear=cq.Workplane('XY').center(sign*19.75,sign*19.75).slot2D(15.778,8,45).extrude(3)
 base=base.union(ear).cut(cq.Workplane('XY').center(sign*22.5,sign*22.5).circle(1.6).extrude(3))
fins=[]
for i in range(10):
 y=-19.4+i*(38.8/9)
 # Slight extrusion taper, visible in the supplier photograph.
 f=cq.Workplane('XY').workplane(offset=3).center(0,y).rect(40,1.2).workplane(offset=32).rect(40,.8).loft(combine=True)
 f=f.cut(cq.Workplane('XY').box(2.4,44,32,centered=(True,True,False)).translate((0,0,3)))
 fins.append(f.val())
a=cq.Assembly(name='ATS_FPX040040035_66_C2_R0_photo_informed');a.add(base.val(),name='Base_and_rounded_tabs',color=cq.Color(.025,.22,.78))
for i,f in enumerate(fins):a.add(f,name=f'Fin_{i+1:02}',color=cq.Color(.025,.22,.78))
a.save(str(P/'cad/photo-informed.step'))
s=base.val()
for f in fins:s=s.fuse(f)
bb=s.BoundingBox();assert s.isValid();assert abs(bb.zlen-35)<1e-6
report={'status':'photo-informed nominal CAD, not manufacturer CAD','source':'https://www.qats.com/DataSheet/ATS-FPX040040035-66-C2-R0','manufacturerCAD':'Exact product page links fused STEP behind Login.aspx; not obtained','verifiedCatalogMm':{'body':[40,40,35],'mountOffset':[45,45]},'modeledEnvelopeMm':[bb.xlen,bb.ylen,bb.zlen],'inferred':{'finCount':10,'baseThicknessMm':3,'finRootThicknessMm':1.2,'finTipThicknessMm':.8,'transverseReliefWidthMm':2.4,'tabRadiusMm':4,'boreDiameterMm':3.2},'volumeMm3':s.Volume(),'modelAluminumMassGAt2p7':s.Volume()*.0027,'catalogMassG':51.6,'notQualified':['exact extrusion dimensions','tab perimeter and bore','TIM thickness','machining and Q1 tap','thermal rating'],'valid':s.isValid(),'revision':'photo-informed-r2'}
(P/'review/geometry-r2.json').write_text(json.dumps(report,indent=2)+'\n')
print(json.dumps(report))