From 250e89f18ae01373eb3e213b2f951fe384966b12 Mon Sep 17 00:00:00 2001 From: Phil Merricks Date: Tue, 2 Jun 2026 12:05:11 +0100 Subject: [PATCH] fix: slot assignment dialog now matches "PLA Silk", "Matte PLA" etc. to PLA slots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _normalizeMaterialKey now scans all space-separated words in a slot label and returns the first known base material type found. This handles both "modifier first" ("Matte PLA") and "modifier last" ("PLA Silk", "PLA Matte") patterns, which arise when users label slots with full product-style names while OrcaSlicer writes only the base type (PLA, PETG, …) in GCode comments. Dash-suffix composites ("PLA-CF", "PETG-CF") contain no space and are unchanged, preserving correct incompatibility with their base types. Co-Authored-By: Claude Sonnet 4.6 --- web/themes/default/app.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/web/themes/default/app.js b/web/themes/default/app.js index 5e5c786..04e5bc2 100644 --- a/web/themes/default/app.js +++ b/web/themes/default/app.js @@ -912,6 +912,7 @@ function closeSettings(){ var _slotEditIndex=-1; var _slotEditLoaded=false; var _MAT_PRESETS=['PLA','PETG','ABS','ASA','TPU','PA','PC','HIPS']; +var _BASE_MATERIAL_TYPES=['PLA','PETG','ABS','ASA','TPU','TPE','PA','PC','HIPS','PEI','PEEK']; function updateSlotEditFeedButton(){ var btn=document.getElementById('btn-slot-edit-feed'); if(!btn)return; @@ -1984,6 +1985,20 @@ function _normalizeMaterialKey(material){ var key=(material||'').toUpperCase().replace(/[^A-Z0-9+]/g,''); // Orca often uses PLA for PLA+, while AMS may report PLA+. if(key==='PLA+'||key==='PLAPLUS') return 'PLA'; + // Handle modifier+base patterns in either order: "Matte PLA", "Silk PETG", + // "PLA Silk", "PLA Matte". OrcaSlicer always writes the base type in GCode + // (filament_type = PLA), but users label slots with the full product-style name. + // Scan each space-separated word; return the first one that is a known base material. + // Dash-suffix variants ("PLA-CF", "PETG-CF") contain no space and fall through + // unchanged, preserving correct incompatibility with their base types. + var trimmed=(material||'').trim(); + if(trimmed.indexOf(' ')>=0){ + var words=trimmed.toUpperCase().split(/\s+/); + for(var i=0;i=0) return w; + } + } return key; } function _materialsCompatible(a,b){