astra/pd-power-supply
USB-PD Power Supply with RP2040 controller
- Version
- 1.1.6
- License
- unset
- Stars
- 0
enclosure.tsx
import { assembly, enclosure } from 'tscircuit'
import { jscadPlanner as j } from 'jscad-planner'
export const mountingCenters = [[-36,-18],[36,-18],[-29.5,18],[36,18]] as const
// Printed bosses sit between the inside floor and PCB underside. Through-M3 clearance.
const boss = j.booleans.subtract(
j.primitives.cylinder({radius:3.4,height:4,resolution:48}),
j.primitives.cylinder({radius:1.6,height:5,resolution:48})
)
export const Mounts = () => <>{mountingCenters.map(([x,y],i)=><chip
key={`mount-${i}`} name={`MOUNT${i+1}`} doNotPlace
pcbX={x} pcbY={y} footprint={<footprint insertionDirection="from_below">
<hole diameter={3.2}/>
<silkscreencircle radius={3.4}/><courtyardrect width={6.8} height={6.8}/>
<keepout shape="circle" radius={3.4} layers={['top','bottom','inner1','inner2']}/>
</footprint>}>
<enclosure.cutoutaperture shape="circle" radius={1.6} margin={0}/>
</chip>)}</>
export const MountBosses = () => <>{mountingCenters.map(([x,y],i)=><assembly.subassembly key={`boss-${i}`} name={`M3_BOSS${i+1}`} cadModel={{jscad:boss,positionOffset:{x,y,z:-2.8}}}/>)}</>
// Grip envelopes on the horizontal shafts; real ALPS body/shaft CAD comes from the import.
const grip = j.colors.colorize([0.12,0.16,0.2],j.primitives.cylinder({radius:10,height:8,resolution:64}))
export const SideKnobs = () => <>{[-21,3].map((x,i)=><assembly.subassembly
key={`grip-${i}`} name={i===0?'COARSE_GRIP':'FINE_GRIP'}
cadModel={{jscad:grip,rotationOffset:{x:90,y:0,z:0},positionOffset:{x,y:-34.5,z:7.3}}}/>)}</>