mohan-bee/mini-mp3-player

Portable, battery-powered MP3 player hardware with USB charging, microSD storage, an MCU, VS10xx audio decoder, headphone output, status controls, and regulated power rails.

Version
1.2.0
License
unset
Stars
0

mechanical/PlayerAssembly.tsx

import models from './model-urls'
import { assembly } from '@tscircuit/core'

/** CAD-only subassemblies: no footprint, nets, BOM items, or routing obstacles. */
export function PlayerAssembly({ exploded = false }: { exploded?: boolean }) {
  return <>
    {Object.entries(models).map(([name, glbUrl]) => {
      const lift = !exploded ? 0 : name.startsWith('cap-') || name === 'mounting-screws' ? 34
        : name === 'lid' ? 22
        : name === 'seam' ? 14
        : name === 'base' ? -28 : name === 'battery' ? -17
        : name === 'divider' ? -8 : 0
      // Fan the layers out so the battery and PCB aren't hidden by the lid.
      const offsetX = exploded && name === 'battery' ? -58 : 0
      const offsetY = exploded && name === 'power-slider' ? -8 : exploded && (name.startsWith('cap-') || ['lid','seam','mounting-screws'].includes(name)) ? 58 : 0
      return <assembly.subassembly key={name} name={`MECH_${name.replace(/-/g, '_')}`}
        displayName={name}
        cadModel={{ glbUrl, modelOriginPosition: {x:0,y:0,z:0},
          positionOffset: {x:offsetX,y:offsetY,z:lift}, modelUnitToMmScale:1,
          modelBoardNormalDirection:'z+' }} />
    })}
  </>
}