// Printer models, and simple line drawings of their shapes, drawn for // Printhive. The drawings suggest a model's form — open frame, enclosed, large // format — rather than depict any product exactly. (function () { const svg = (inner, width = 150) => `${inner}`; // One spool in a drawing, filled with what's loaded there: a colour for a // spool, dashed for an empty slot, plain when nothing is known. const HEX = /^#[0-9a-f]{6}$/i; const spool = (cx, cy, r, slot) => { if (slot && slot.empty) return ``; const fill = slot && HEX.test(slot.colour || '') ? slot.colour : null; return fill ? `` : ``; }; // An AMS lite: a stand with four spools around a hub. const amsLite = (x, slots) => ` ${spool(x - 9, 40, 7, slots[0])}${spool(x + 9, 40, 7, slots[1])} ${spool(x - 9, 58, 7, slots[2])}${spool(x + 9, 58, 7, slots[3])}`; // An AMS on top of an enclosed printer: a box showing four spools. const amsTop = (x, width, slots) => { const step = width / 4; let spools = ''; for (let i = 0; i < 4; i += 1) spools += spool(x + step / 2 + i * step, 23, 5, slots[i]); return `${spools}`; }; const toolhead = (x, y) => ` `; const shapes = { // A1: a bed on a base, an upright gantry, an AMS lite alongside. open: (slots) => svg(` ${toolhead(50, 49)} ${amsLite(126, slots)}`), // A1 mini: a single column holding the gantry out over the bed. openMini: (slots) => svg(` ${toolhead(58, 47)} ${amsLite(122, slots)}`), // A2L: the A1's form, stretched to a larger bed. openLarge: (slots) => svg(` ${toolhead(52, 47)} ${amsLite(132, slots)}`), // P1P: a bare cube frame. frame: () => svg(` ${toolhead(56, 53)} `, 140), // P1S, P2S, X1C, X1E, X2D: an enclosed box with an AMS on top. box: (slots) => svg(` ${amsTop(30, 66, slots)} ${toolhead(56, 52)}`, 126), // H2S, H2D, H2C: a wide enclosed box with an AMS on top. large: (slots) => svg(` ${amsTop(28, 94, slots)} ${toolhead(58, 52)}${toolhead(78, 52)}`), // Anything else: a plain box with a nozzle. generic: () => svg(` ${toolhead(63, 50)} `, 140), }; // ams is only a suggestion — a P1S might have an AMS, an AMS 2 Pro or an AMS HT. const models = [ { id: 'A1 mini', shape: 'openMini', ams: 'ams_lite' }, { id: 'A1', shape: 'open', ams: 'ams_lite' }, { id: 'A2L', shape: 'openLarge', ams: 'ams_lite' }, { id: 'P1P', shape: 'frame', ams: 'ams' }, { id: 'P1S', shape: 'box', ams: 'ams' }, { id: 'P2S', shape: 'box', ams: 'ams_2_pro' }, { id: 'X1C', shape: 'box', ams: 'ams' }, { id: 'X1E', shape: 'box', ams: 'ams' }, { id: 'X2D', shape: 'box', ams: 'ams_2_pro' }, { id: 'H2S', shape: 'large', ams: 'ams_2_pro' }, { id: 'H2D', shape: 'large', ams: 'ams_2_pro' }, { id: 'H2C', shape: 'large', ams: 'ams_2_pro' }, { id: 'Other', shape: 'generic', ams: 'none' }, ]; const amsTypes = [ { id: 'none', label: 'No AMS (external spool)' }, { id: 'ams_lite', label: 'AMS lite (full or empty only)' }, { id: 'ams', label: 'AMS' }, { id: 'ams_2_pro', label: 'AMS 2 Pro' }, { id: 'ams_ht', label: 'AMS HT' }, ]; const find = (id) => models.find((m) => m.id === id) || null; window.PRINTER_MODELS = { models, amsTypes, find, // `slots`: the first AMS unit's four slots, as { empty, colour }, to colour in. art: (id, slots = []) => (shapes[(find(id) || {}).shape] || shapes.generic)(slots), }; }());