mirror of
https://github.com/gittrahan/support-fins.git
synced 2026-10-19 02:10:52 -05:00
web: drop the PLA/PETG Material dropdown -- PLA's numbers stay the defaults, PETG's wider gap is the Support gap field's
The dropdown only moved the Support gap (0.2 -> 0.3, already its own field), the Sure hold pad's thickness and tack, and the grams density (2%). Default output is unchanged (sweep vs main: no differences). Startup now reads the Support gap field into PROP.gap, which the material's reset used to cover. The plugins keep their material option until their own PR; options.test.js lists it as plugin-only.
This commit is contained in:
1 parent
1f605c5a5c
commit
b625eedd30
8 files changed
+22
-56
No files matched your search
@@ -35,6 +35,8 @@ function siteControl(id) {
|
||||
const fromSite = (o, v) => (o.percent ? Number(v) / 100 : Number(v));
|
||||
// Options the site shows that a plugin dialog deliberately leaves out (options.json $comment).
|
||||
const SITE_ONLY_CHOICES = { padStyle: ['custom'] };
|
||||
// Options a plugin dialog still has that the site dropped, and why.
|
||||
const PLUGIN_ONLY = { material: 'the site dropped its PLA/PETG dropdown; the plugins\' goes next' };
|
||||
// Every site control that is NOT in options.json, and why. A new control on the site
|
||||
// fails the test below until it is added to the schema or listed here.
|
||||
const SITE_EXCLUDED = {
|
||||
@@ -76,6 +78,7 @@ Deno.test('options.json is well formed', () => {
|
||||
|
||||
Deno.test('every default, range and choice is the website\'s', () => {
|
||||
for (const o of OPTS) {
|
||||
if (PLUGIN_ONLY[o.key]) continue;
|
||||
const site = siteControl(o.site);
|
||||
if (o.type === 'bool') {
|
||||
assert(site.type === 'checkbox', `${o.key}: #${o.site} is not a checkbox`);
|
||||
|
||||
+2
-2
@@ -69,8 +69,8 @@ function coverPitch(coverage) {
|
||||
* Apply the page's clearance settings to FIN / PROP / PAD.
|
||||
*
|
||||
* WHY THIS IS A PARAMETER AND NOT JUST A MODULE EDIT. ui/settings.js sets these objects
|
||||
* directly (applyMaterial for the PLA/PETG profiles, the Support gap and Pad grip
|
||||
* fields) and that works for anything it builds itself. But the real build runs in
|
||||
* directly (the Support gap and Pad grip fields; a plugin's PLA/PETG profile
|
||||
* arrives the same way) and that works for anything it builds itself. But the real build runs in
|
||||
* finworker.js, a module Worker with its OWN instance of fins.js and prop.js: module
|
||||
* state does not cross a Worker boundary, so everything the page set stayed on the
|
||||
* page. PETG picked in Auto mode therefore printed PLA's clearances -- silently, since
|
||||
|
||||
@@ -12,9 +12,7 @@ export default {
|
||||
"The rotate rings around the part. Off hides them; Rotate 90°, Reset and Lay a face flat still turn the part.": "Die Drehringe um das Bauteil. Aus blendet sie aus; 90° drehen, Zurücksetzen und Fläche flach auflegen drehen das Bauteil weiterhin.",
|
||||
"times and filament from {profile}; yours will differ": "Druckzeit und Materialverbrauch geschätzt mit {profile}; tatsächliche Werte hängen von Ihrem Drucker ab.",
|
||||
"Download": "Herunterladen",
|
||||
"The filament you'll print in. PETG fuses to supports much harder than PLA, so PETG loosens the gaps, shrinks the tine bite, and gives the bed pad a gap instead of a bite. PLA keeps the tighter grip.": "Das Filament, mit dem gedruckt wird. PETG verschmilzt deutlich fester mit Stützen als PLA, daher vergrößert PETG die Abstände, verringert den Eingriff der Zacken und versieht den Stützfuß mit einem Spalt statt Verankerung. PLA behält den festeren Halt.",
|
||||
|
||||
"The filament you'll print in. PETG fuses to supports much harder than PLA, so PETG loosens the gaps and gives the bed pad a gap instead of a tack. PLA keeps the tighter grip.": "Das Filament, mit dem gedruckt wird. PETG verschmilzt deutlich stärker mit Stützen als PLA, daher vergrößert PETG die Abstände und versieht den Stützfuß mit einem Spalt statt Haftung. PLA behält den festeren Halt.",
|
||||
"No build for {name}": "Kein Build für {name}",
|
||||
|
||||
"Pad thickness mm": "Stützfußdicke mm",
|
||||
@@ -236,7 +234,6 @@ export default {
|
||||
"Walls": "Stützwände",
|
||||
"Display": "Ansicht",
|
||||
|
||||
"Material": "Material",
|
||||
"Placement": "Platzierung",
|
||||
"Auto — place supports for me": "Auto — Stützen automatisch platzieren",
|
||||
"Full coverage — every overhang": "Volle Abdeckung — jeder Überhang",
|
||||
|
||||
@@ -10,8 +10,6 @@ export default {
|
||||
"The rotate rings around the part. Off hides them; Rotate 90°, Reset and Lay a face flat still turn the part.": "Os anéis de rotação em volta da peça. Desligado os esconde; Girar 90°, Zerar e Apoiar uma face na mesa continuam girando a peça.",
|
||||
"times and filament from {profile}; yours will differ": "tempos e filamento do perfil {profile}; os seus vão variar",
|
||||
"Download": "Baixar",
|
||||
"The filament you'll print in. PETG fuses to supports much harder than PLA, so PETG loosens the gaps, shrinks the tine bite, and gives the bed pad a gap instead of a bite. PLA keeps the tighter grip.": "O filamento que você vai usar. O PETG gruda nos suportes bem mais que o PLA, então com PETG as folgas aumentam, os dentes mordem menos e a base na mesa ganha uma folga em vez de morder a peça. O PLA mantém a pega mais firme.",
|
||||
"The filament you'll print in. PETG fuses to supports much harder than PLA, so PETG loosens the gaps and gives the bed pad a gap instead of a tack. PLA keeps the tighter grip.": "O filamento que você vai usar. O PETG gruda nos suportes bem mais que o PLA, então com PETG as folgas aumentam e a base na mesa ganha uma folga em vez de colar na peça. O PLA mantém a pega mais firme.",
|
||||
"No build for {name}": "Sem versão para {name}",
|
||||
|
||||
"Pad thickness mm": "Espessura da base mm",
|
||||
@@ -212,7 +210,6 @@ export default {
|
||||
"Sway braces": "Escoras laterais",
|
||||
"Walls": "Paredes",
|
||||
"Display": "Exibição",
|
||||
"Material": "Material",
|
||||
"Placement": "Posicionamento",
|
||||
"Auto — place supports for me": "Automático — coloca para mim",
|
||||
"Draw — place them by hand": "Desenhar — posiciono à mão",
|
||||
|
||||
@@ -221,18 +221,6 @@
|
||||
before. Layout only: every control keeps its id, and nothing it builds moved. -->
|
||||
<details class="sec" data-sec="setup" open>
|
||||
<summary><span class="sec-title" data-i18n="Setup">Setup</span><span class="sec-sum" id="sum-setup"></span></summary>
|
||||
<!-- Material: PETG welds to a support far harder than the PLA the numbers
|
||||
were tuned for, so it needs more clearance everywhere. PLA is the default and
|
||||
keeps today's tight grip; PETG widens the support gap + fin-tine standoff,
|
||||
thins the bed pad, and turns the pad's tack into a gap.
|
||||
Applied in ui/settings.js (applyMaterial), which also re-syncs the tunables below. -->
|
||||
<label class="fld row" id="material-fld" data-i18n-title title="The filament you'll print in. PETG fuses to supports much harder than PLA, so PETG loosens the gaps and gives the bed pad a gap instead of a tack. PLA keeps the tighter grip.">
|
||||
<span data-i18n="Material">Material</span>
|
||||
<select id="material">
|
||||
<option value="pla">PLA</option>
|
||||
<option value="petg">PETG</option>
|
||||
</select>
|
||||
</label>
|
||||
<!-- Nozzle: the support widths scale from their 0.4 numbers (web/nozzle.js) so a
|
||||
0.6 or 0.8 nozzle doesn't drop the tines or lay the wall as one line. -->
|
||||
<label class="fld row" id="nozzle-fld" data-i18n-title title="Your printer's nozzle diameter. The walls, contact tips and tines are sized in nozzle lines, so they widen for a bigger nozzle and the tines narrow for a smaller one.">
|
||||
|
||||
+3
-3
@@ -108,8 +108,8 @@ function finOpts() {
|
||||
sway: autoLike() && el('sway').checked ? { on: true, ...swayOpts() } : undefined,
|
||||
// The clearances have to travel WITH the request: the build runs in a
|
||||
// Worker with its own copy of fins.js / prop.js, which never sees what
|
||||
// applyMaterial and the gap fields set on this page's copy (fins.js
|
||||
// applyTunables). Without this, Auto mode always built PLA's numbers.
|
||||
// the gap and pad fields set on this page's copy (fins.js
|
||||
// applyTunables). Without this, Auto mode always built the defaults.
|
||||
tunables: { padH: FIN.padH,
|
||||
padGrab: PAD.grab, padStyle: PAD.style, padCustom: { ...PAD.custom },
|
||||
propGap: PROP.gap,
|
||||
@@ -119,7 +119,7 @@ function finOpts() {
|
||||
}
|
||||
|
||||
/** The Sway braces settings. The gap is passed explicitly -- sway.js takes the
|
||||
* material's number as an option instead of reading FIN/PROP itself. */
|
||||
* clearance (PROP.gap) as an option instead of reading FIN/PROP itself. */
|
||||
export function swayOpts() {
|
||||
const num = (id, d) => (Number.isFinite(el(id).valueAsNumber) ? el(id).valueAsNumber : d);
|
||||
return { uncappedDepth: el('full-brace-depth').checked, gripFrom: num('sway-from', 0),
|
||||
|
||||
+6
-7
@@ -28,10 +28,9 @@ let redoStack = [];
|
||||
|
||||
// EVERY SETTING is undoable too (Matthew: "every action should be redo-able"). The
|
||||
// fields' own handlers apply them, so a restore writes the values back and fires the
|
||||
// same events a hand edit would. `material` first: choosing one rewrites the gap and
|
||||
// pad fields, which the snapshot then sets back on top. Not the build volume: that is
|
||||
// the printer, saved across visits, not an edit to this part.
|
||||
const FORM_IDS = ['material', 'nozzle', 'thr', 'tines', 'tine-density', 'layer-height', 'gap',
|
||||
// same events a hand edit would. Not the build volume: that is the printer, saved
|
||||
// across visits, not an edit to this part.
|
||||
const FORM_IDS = ['nozzle', 'thr', 'tines', 'tine-density', 'layer-height', 'gap',
|
||||
'bed-pad', 'pad-h', 'pad-gap', 'pad-grip', 'pad-margin', 'sway', 'sway-from',
|
||||
'sway-spacing', 'sway-depth', 'full-brace-depth', 'cutout', 'iface', 'coverage', 'plate-only', 'highlight-small', 'show-layers',
|
||||
'show-rings', 'nav-preset'];
|
||||
@@ -69,9 +68,9 @@ document.addEventListener('change', (e) => {
|
||||
histPush();
|
||||
}, true);
|
||||
// ...and the values to compare the NEXT edit against, read once the field's own
|
||||
// handlers have run (bubbling up to window comes after them): choosing a material
|
||||
// rewrites the gap and pad fields. Not a microtask -- a real event runs microtasks
|
||||
// between listeners, before the material handler, and PETG's gap went down as PLA's.
|
||||
// handlers have run (bubbling up to window comes after them), in case a handler
|
||||
// rewrites other fields. Not a microtask -- a real event runs microtasks between
|
||||
// listeners, before the field's own handler.
|
||||
addEventListener('change', (e) => {
|
||||
if (restoring || !FORM_IDS.includes(e.target?.id)) return;
|
||||
settled = readForm();
|
||||
|
||||
+8
-26
@@ -78,7 +78,7 @@ el('fin-mode').addEventListener('change', (e) => {
|
||||
refreshFins();
|
||||
});
|
||||
// Bed pad style (PAD.style in fins/pad.js). Only Custom shows the pad's numbers; the
|
||||
// presets keep theirs fixed (Sure hold's follow the material profile). Switching
|
||||
// presets keep theirs fixed (Sure hold's are FIN.padH and PAD.grab). Switching
|
||||
// to Custom starts it from whichever preset was showing, so a tweak begins from
|
||||
// numbers that are known to print rather than from blanks.
|
||||
const PAD_FIELDS = { h: 'pad-h', gap: 'pad-gap', grip: 'pad-grip', margin: 'pad-margin' };
|
||||
@@ -194,28 +194,9 @@ el('iface').addEventListener('change', () => {
|
||||
refreshFins();
|
||||
});
|
||||
|
||||
// Material profiles (PLA/PETG clearances) live in ../materials.js, shared with the
|
||||
// plugins' engine entry. These objects are read fresh on every build, so applying a
|
||||
// profile + rebuilding is all it takes.
|
||||
export let materialDensity = MATERIAL.pla.density;
|
||||
|
||||
function applyMaterial(name) {
|
||||
const m = MATERIAL[name] || MATERIAL.pla;
|
||||
FIN.padH = m.padH;
|
||||
PAD.grab = m.padGrab;
|
||||
PROP.gap = m.propGap;
|
||||
materialDensity = m.density;
|
||||
// Reflect the profile's clearances in the exposed tunables so the numbers on
|
||||
// screen match what will actually print (and a later hand-tweak starts from the
|
||||
// material's baseline, not PLA's).
|
||||
el('gap').value = m.propGap;
|
||||
syncSectionSums();
|
||||
}
|
||||
|
||||
el('material').addEventListener('change', () => {
|
||||
applyMaterial(el('material').value);
|
||||
debouncedRefresh();
|
||||
});
|
||||
// The grams receipt's filament density: PLA's (../materials.js). The PLA/PETG
|
||||
// dropdown is gone -- PETG's wider gap is the Support gap field's to set.
|
||||
export const materialDensity = MATERIAL.pla.density;
|
||||
|
||||
// Nozzle size scales the support widths (../nozzle.js); this page's copy is set
|
||||
// here for Draw, and the Worker gets it in the build's tunables. It is the
|
||||
@@ -285,7 +266,7 @@ el('highlight-small').addEventListener('change', (e) => {
|
||||
/** Refill each section's collapsed recap from the controls' current values. */
|
||||
export function syncSectionSums() {
|
||||
const sel = (id) => el(id).selectedOptions[0]?.textContent.split(' —')[0] ?? '';
|
||||
el('sum-setup').textContent = `${sel('material')} · ${el('nozzle').value} mm · ${sel('fin-mode')}`;
|
||||
el('sum-setup').textContent = `${el('nozzle').value} mm · ${sel('fin-mode')}`;
|
||||
const grip = el('tine-density').valueAsNumber;
|
||||
el('sum-tines').textContent = el('tines').checked
|
||||
? `${grip <= 20 ? 'light' : grip >= 80 ? 'firm' : 'medium'} grip · ${el('layer-height').value} mm`
|
||||
@@ -330,7 +311,7 @@ el('augment-toggle').addEventListener('click', () => {
|
||||
refreshFins();
|
||||
});
|
||||
|
||||
/** Bring the pad, tine, sway, cutout, material and nozzle state in line with the controls
|
||||
/** Bring the pad, tine, sway, cutout and nozzle state in line with the controls
|
||||
* (a reload can keep the browser's last values). Called once at startup. */
|
||||
export function initSettings() {
|
||||
syncTineGrip();
|
||||
@@ -338,7 +319,8 @@ export function initSettings() {
|
||||
syncSway();
|
||||
CUT.pattern = el('cutout').value; // a reload can keep the browser's last pick
|
||||
PROP.iface = ifaceMode();
|
||||
applyMaterial(el('material').value); // sync density + tunables to the initial choice
|
||||
const gap = el('gap').valueAsNumber; // ...and its last Support gap (wireGap's range)
|
||||
if (Number.isFinite(gap)) PROP.gap = Math.min(0.4, Math.max(0.1, gap));
|
||||
applyNozzle(Number(el('nozzle').value)); // ...and the widths to the remembered nozzle
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user