bedType.ts 1.5 KB

123456789101112131415161718192021222324252627282930
  1. // Map slicer bed-type strings to icon assets shipped under /bed-icons/.
  2. // Source values come straight from the 3MF (curr_bed_type in slice_info.config
  3. // or project_settings.config). BambuStudio and OrcaSlicer disagree on a few
  4. // labels for the same physical plate, so this map normalises both spellings
  5. // to a single icon.
  6. const ICON_BASE = '/img/bed';
  7. interface BedTypeInfo {
  8. icon: string;
  9. label: string;
  10. }
  11. const BED_TYPE_MAP: Record<string, BedTypeInfo> = {
  12. 'cool plate': { icon: `${ICON_BASE}/bed_cool.png`, label: 'Cool Plate' },
  13. 'pc plate': { icon: `${ICON_BASE}/bed_cool.png`, label: 'Cool Plate' },
  14. 'cool plate (supertack)': { icon: `${ICON_BASE}/bed_cool_supertack.png`, label: 'Cool Plate SuperTack' },
  15. 'supertack plate': { icon: `${ICON_BASE}/bed_cool_supertack.png`, label: 'Cool Plate SuperTack' },
  16. 'bambu cool plate supertack': { icon: `${ICON_BASE}/bed_cool_supertack.png`, label: 'Cool Plate SuperTack' },
  17. 'engineering plate': { icon: `${ICON_BASE}/bed_engineering.png`, label: 'Engineering Plate' },
  18. 'high temp plate': { icon: `${ICON_BASE}/bed_high_templ.png`, label: 'High Temp Plate' },
  19. 'textured pei plate': { icon: `${ICON_BASE}/bed_pei.png`, label: 'Textured PEI Plate' },
  20. 'pei plate': { icon: `${ICON_BASE}/bed_pei.png`, label: 'PEI Plate' },
  21. 'smooth pei plate': { icon: `${ICON_BASE}/bed_pei_cool.png`, label: 'Smooth PEI Plate' },
  22. };
  23. export function getBedTypeInfo(bedType: string | null | undefined): BedTypeInfo | null {
  24. if (!bedType) return null;
  25. return BED_TYPE_MAP[bedType.trim().toLowerCase()] ?? null;
  26. }