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){