slicerSettings.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * Types for the vendored OrcaSlicer process-settings metadata.
  3. *
  4. * The JSON under `src/data/slicer/` is generated by
  5. * `scripts/generate-slicer-schema.mjs` from the `three-slicer` package, which
  6. * extracts it from OrcaSlicer's own `PrintConfig.cpp` and `Tab.cpp`. These
  7. * types describe that generated shape.
  8. */
  9. /** A value the user has set for one process option, in its slicer-side form. */
  10. export type SettingValue = string | number | boolean | Array<string | number | boolean>;
  11. /**
  12. * OrcaSlicer's `ConfigOptionType` names, as they appear in the extracted schema.
  13. * The plural forms are per-extruder vectors.
  14. */
  15. export type OptionType =
  16. | 'coBool'
  17. | 'coBools'
  18. | 'coInt'
  19. | 'coFloat'
  20. | 'coFloats'
  21. | 'coPercent'
  22. | 'coFloatOrPercent'
  23. | 'coFloatsOrPercents'
  24. | 'coEnum'
  25. | 'coString';
  26. /** OrcaSlicer's setting visibility tiers, mirrored by the panel's mode switch. */
  27. export type OptionMode = 'simple' | 'advanced' | 'expert' | 'develop';
  28. export interface ProcessOption {
  29. type: OptionType;
  30. mode: OptionMode;
  31. label: string;
  32. tooltip?: string;
  33. /** Unit shown after the input ("mm", "mm/s²", "%"). */
  34. sidetext?: string;
  35. /**
  36. * Bounds, normalised out of their C++ source form by the generator. Typed as
  37. * string too because the JSON carries both shapes; coerce with
  38. * ``numericBound`` rather than assuming a number.
  39. */
  40. min?: number | string;
  41. max?: number | string;
  42. enum_values?: string[];
  43. enum_labels?: string[];
  44. default?: SettingValue;
  45. }
  46. export type ProcessSchema = Record<string, ProcessOption>;
  47. export interface ProcessGroup {
  48. group: string;
  49. options: string[];
  50. }
  51. export interface ProcessPage {
  52. page: string;
  53. icon?: string;
  54. groups: ProcessGroup[];
  55. }
  56. export type ProcessUiTree = ProcessPage[];