import { Group, Object3D } from 'three'; /** * Color-based flush (purge) volume estimation compatible with Bambu Studio / OrcaSlicer. * * This is an independent TypeScript implementation of the color heuristic the slicers use * when the user clicks "Recalculate" in the flushing volumes dialog. It was written from a * description of the algorithm (and verified against matrices saved by Bambu Studio), * not copied from the AGPL-licensed slicer sources. * * Not reproduced on purpose: * - Bambu Studio's measured lookup tables (`resources/flush/*`), which override the * heuristic for a dozen Bambu Lab palette colors and some filament-id pairs. * - Support-material special cases (fixed 230 mm³ to support, at least 700 mm³ from support). */ interface FlushVolumeOptions { /** * Volume (mm³) added to every color change. Bambu Studio uses the printer's * `nozzle_volume` here: 92 for the A1 / A1 mini, 107 for the X1 / P1 series. * @default 92 */ nozzleVolume?: number; } /** * Compute a flushing volumes matrix for the given filament colors, in the format Bambu Studio * stores as `flush_volumes_matrix`: a flattened, row-major `n * n` array where * `matrix[from * n + to]` is the volume (mm³) needed to switch from filament `from` to * filament `to`, with a zero diagonal. Values are not multiplied by `flush_multiplier`. * * Colors are hex strings (`#RGB`, `#RGBA`, `#RRGGBB` or `#RRGGBBAA`). Partial alpha is ignored; * fully transparent and unparseable colors are treated as white. * * Only single-nozzle printers are covered: multi-nozzle printers (e.g. H2D) store one * `n * n` block per nozzle, which this function does not produce. */ declare function computeFlushVolumesMatrix(colors: readonly string[], options?: FlushVolumeOptions): number[]; /** * 打印床配置接口 / Print Bed Configuration Interface */ interface PrintConfig { printer_name: string; filament: string; printableWidth: number; printableDepth: number; printableHeight: number; printableArea: readonly [string, string, string, string]; printerSettingsId: string; printSettingsId: string; compression: 'none' | 'standard'; seam_position?: 'nearest' | 'aligned' | 'back' | 'random'; different_settings_to_system?: string[]; /** * 换料冲刷体积矩阵 / Flushing volumes matrix (mm³), flattened row-major `n * n` (from -> to). * 默认根据耗材颜色计算 / Computed from filament colors by default (single-nozzle printers only). * `n` is the number of exported filaments; single-material exports are padded to 2 filaments, * so the matrix then needs 4 entries. A matrix of any other length is ignored. */ flush_volumes_matrix?: number[]; /** 冲刷体积倍率 / Flush multiplier. Not written unless set, so the slicer default applies. */ flush_multiplier?: number; /** * 每次换料的最小冲刷体积,计算矩阵时使用 / Minimum purge per color change used when computing the matrix. * Bambu Studio uses the printer's nozzle volume: 92 for A1 / A1 mini, 107 for X1 / P1. */ nozzleVolume?: number; metadata: Partial<{ Application: string; Copyright: string; ApplicationTitle: string; }>; } declare const defaultPrintConfig: PrintConfig; /** * 将 Three.js 的 Group 或 Mesh 导出为 3MF 文件格式 (BambuStudio 兼容格式) * Export Three.js Group or Mesh to 3MF format (BambuStudio compatible) * @param object Three.js Group 对象或 Mesh 数组 / Three.js Group or Mesh array * @param printJobConfig 打印床配置,可选 / Optional print bed configuration * @returns Blob 数据 / Blob data */ declare function exportTo3MF(object: Group | Object3D, printJobConfig?: Partial): Promise; export { computeFlushVolumesMatrix, defaultPrintConfig, exportTo3MF }; export type { FlushVolumeOptions };