Feature slicer engine#391
Open
iesteem wants to merge 31 commits into
Open
Conversation
The gcode comment 'estimated first layer printing time' was incorrectly using machine.prepare_time (start custom gcode duration) instead of the actual first layer print time. This was masked in desktop builds where the full start gcode (~19s of homing/heating) coincidentally looked plausible, but was clearly broken in the cloud engine where start gcode is stripped for safety, leaving only ~1s. Fixed by computing the real first layer time as: layers_time[0] - prepare_time which matches the existing layer_duration calculation at line 1343.
…ents to SliceEngine
… of enable_pressure_advance bool
…c ConfigOptionVectorBase API
…nsorted extruder retract keys - Sort m_extruder_retract_keys alphabetically so std::is_sorted assertion passes and binary search operations work correctly. Moved retract_length_toolchange and retract_restart_extra_toolchange to their proper positions. - Add null check for filament_diameter option in validate_presets() to prevent SIGSEGV when the config key is missing from 3MF files.
Merge system printer + filament presets under the project config before passing to Print::apply(), mirroring the desktop PresetBundle::full_config() layered merge. Without this, filament-level keys (hot_plate_temp_initial_layer, nozzle_temperature, etc.) never reach the GCode generator.
Instead of clearing all G-code to empty strings, walk the inherits chain to find the official Snapmaker printer preset and source its default G-code values (machine_start_gcode, change_filament_gcode, etc.). Falls back to nozzle-diameter-matched U1 preset when no official ancestor is found. Filament/print-level G-code keys remain cleared for cloud safety. --keep-custom-gcode semantics unchanged.
…ustom presets - Compute m_output_path before any early-return path so JSON is always written to the correct filename (was ".json" when slicing failed early). - Apply FullPrintConfig::defaults() as baseline before 3MF loading to prevent Print::apply() crashes on missing config options. This mirrors PresetBundle::full_fff_config() in the desktop pipeline. - Add apply_printer_preset_config() to merge the printer preset config from system or project-embedded presets into m_config. - Refactor validate_filament_official(bool enforce): when enforce=false (--allow-custom-presets), non-official filaments produce warnings instead of errors. Add has_inline_filament_config() fallback for 3MF files where filament config values are embedded directly in project_settings.config without a named preset definition. - Always run filament validation; the enforce flag controls severity rather than whether validation runs at all.
- apply_printer_preset_config: iterate config keys and only fill nil values instead of blindly applying the whole preset config, so project config values are not overwritten. - validate_filament_official: extract find_ancestor and walk_chain lambdas to DRY up parent lookup and circular-inheritance detection shared between enforce and non-enforce paths. Non-enforce path now also reports FILAMENT_UNKNOWN_ANCESTOR instead of silently accepting it.
- apply_printer_preset_config() now uses build_full_print_config() to resolve the complete printer config (defaults + system preset + project overlay) and merge missing keys into m_config. If system presets are unavailable, report PRINTER_PRESET_MISSING as a fatal error. - Restore FullPrintConfig::defaults() application before load_3mf() as baseline, so build_full_print_config() has a complete config to resolve on top of. - Remove blind FullPrintConfig defaults from apply_printer_preset_config (now handled at run() level) and dead guess_nozzle_str helper. - Validate critical printer parameters (printable_area, printable_height) after merge and report CONFIG_MISSING errors if absent.
- After preset merge, detect whether printable_area and printable_height are still at FullPrintConfig defaults (200x200 rect, 100.0mm). If so, the U1 preset was not applied — report PRINTER_PRESET_NOT_APPLIED and fail slicing. - Only modifies the engine, no changes to libslic3r.
…ment, CLI granularity, resource path auto-detection - EngineConfig: remove enforce_official_presets/clear_custom_gcode/data_dir (dead), add substitute_printer flag for printer preset substitution control - CLI: add --allow-custom-printer-presets and --allow-custom-filament-presets for per-category preset enforcement; remove -d/--data-dir, --keep-custom-gcode, --no-filament-substitution (no backward compat) - Resource path: auto-detect ../resources (Ubuntu packaging) before ./resources fallback and ORCA_RESOURCES env var - validate_printer_official(): check printer preset via direct file lookup under resources/profiles/Snapmaker/machine/ since PresetBundle::find_preset binary search misses Snapmaker system presets - substitute_printer_params(): load official parent config from disk and fill nil values (includes G-code naturally via preset substitution) - validate_filament_official(): add file-based fallback for Snapmaker and OrcaFilamentLibrary filaments missed by find_preset - Remove apply_official_presets() (G-code now handled by printer substitution) - Simplify load_system_presets() (always resources/profiles, no --data-dir) - Suppress libslic3r log spam during preset loading/validation via set_logging_enabled(false)
…resets Generic filaments like 'Generic PETG HF' are stored as 'Generic PETG HF @System.json' under OrcaFilamentLibrary/filament/. The file-based fallback now also checks the @System suffix variant.
… single-extruder plates The per-plate extruder trimming logic was truncating all filament arrays (type, color, diameter, etc.) to size 1 when only one extruder was used on a plate. This broke extruder assignment for model volumes referencing non-zero extruder IDs (e.g., extruder 3 on a plate that only uses extruder 3). Fix: only disable the prime/wipe tower for single-extruder plates, but keep filament arrays at their full size so volume-to-extruder mapping works correctly for any extruder index.
…ation order P1: - ScopedLogSuppressor: RAII guard replacing bare set_logging_enabled(false/true), ensures log state is restored even on exception during preset loading - run() header comment documenting m_config mutation pipeline order P2: - fill_nil_from(): extract duplicated is_scalar/is_nil config fill pattern used by substitute_printer_params() and apply_printer_preset_config() - Path constants: SNAPMK_MACHINE_DIR, SNAPMK_FILAMENT_DIR, ORCA_FILAMENT_DIR - is_official_machine_file() / is_official_filament_file(): replace inline file-exists lambdas in validate_printer_official() and validate_filament_official()
…nel fixes (Snapmaker#401) * Fix 3MF persistence for Local-Z project settings Fixes Snapmaker#125. Add Local-Z Full Domain and related mixed-filament project settings to the project config and import allow-lists so they survive 3MF save/load and model import. * Load Local-Z settings from imported 3MF geometry Fix geometry-only 3MF import so saved Local-Z project settings override the current unsaved state even when importing into a non-empty scene. Mirror the print-tab Local-Z booleans as well so the UI does not drift back to the old preset values. * Keep Local-Z infill option in sync with subdivision mode Default Apply subdivision to infill to off while Subdivide Mix Layer is disabled, auto-enable it when subdivision is enabled, and clear dependent Local-Z child settings when subdivision is disabled so saved project config does not retain stale active child values. * bugfix: mix dialog error/warning panel oversized on first display - Reorder Show+Layout before SetLabel so hidden LB_AUTO_WRAP Label gets valid width for wrapping, preventing NSTextField from reporting overly wide intrinsicContentSize - Clean up i18n keys: drop colons (Filaments:/Target Color:), fix cycle card title Pattern→Filaments - Sync zh_CN translations * Refresh print tab after importing Local-Z settings After geometry-only 3MF import, reload the print tab when Local-Z settings were imported so the visible Subdivide Mix Layer controls match the project config used for slicing. * Do not import Local-Z process settings with geometry File -> Import 3MF should preserve the current project's process parameter state. Stop applying saved Local-Z project/print settings during geometry-only 3MF import; those settings are still loaded when opening a project with config. * Fix inherited plate bed type dirty state * i18n: add zh_CN translation for "Apply subdivision to infill" * docs: add inline comments explaining double-Layout macOS workaround in MixedFilamentDialog The error/warning labels use LB_AUTO_WRAP, which requires two Layout() passes on macOS: the first lands the panel's actual width after Show(), the second re-wraps the label text at the correct width. Without this, a single Layout can query a stale zero-width from CalcMin and produce an oversized dialog on first display. --------- Co-authored-by: ratdoux <radugheorghiu96@gmail.com> Co-authored-by: ZhangZheng <67276816+LuckZAE@users.noreply.github.com>
…ic + vendor loading - load_system_presets: only load OrcaFilamentLibrary + Snapmaker vendors to prevent other vendors from clearing incompatible Snapmaker presets - find_in_system: add linear scan fallback when binary search fails (known PresetCollection ordering issue with Snapmaker presets) - validate_filament_official Case 1: non-official system presets now walk inherits chain instead of immediately reporting unsupported vendor - Add suffix-stripping heuristic: strip OrcaSlicer copy suffix (e.g. ' - 拷贝') from filament_settings_id to match base system preset
Instead of trying to parse suffix patterns (' - 拷贝', ' N'),
iterate all loaded official presets and find the one that is the
longest prefix of the unknown filament name. This handles all
OrcaSlicer/Bambu copy naming conventions uniformly.
- When names differ: 'Custom filament X replaced with official preset Y for cloud safety' - When names are the same (prefix match): 'config values updated from official preset'
PRINTER_SUBSTITUTED: match FILAMENT_SUBSTITUTED format — show
'replaced with X for cloud safety' or 'config values updated'
depending on whether names differ.
PRESET_MODIFIED_GCODES: 'Modified G-code keys found' → 'Custom
G-code detected (X) — disabled for cloud safety'.
FILAMENT_CUSTOM_INLINE: remove jargon ('inline', 'per-extruder
config values'), show 'custom filament without a preset
definition — accepted in allow-custom mode'.
When a user-modified printer preset (e.g. 'Snapmaker U1 (0.6 nozzle) - 拷贝') is exported in a 3MF and the cloud engine cannot find it, iterate all loaded official printer presets and match by longest prefix. Mirrors the same logic already applied to filament presets.
* Fix 3MF persistence for Local-Z project settings Fixes Snapmaker#125. Add Local-Z Full Domain and related mixed-filament project settings to the project config and import allow-lists so they survive 3MF save/load and model import. * Load Local-Z settings from imported 3MF geometry Fix geometry-only 3MF import so saved Local-Z project settings override the current unsaved state even when importing into a non-empty scene. Mirror the print-tab Local-Z booleans as well so the UI does not drift back to the old preset values. * Keep Local-Z infill option in sync with subdivision mode Default Apply subdivision to infill to off while Subdivide Mix Layer is disabled, auto-enable it when subdivision is enabled, and clear dependent Local-Z child settings when subdivision is disabled so saved project config does not retain stale active child values. * bugfix: mix dialog error/warning panel oversized on first display - Reorder Show+Layout before SetLabel so hidden LB_AUTO_WRAP Label gets valid width for wrapping, preventing NSTextField from reporting overly wide intrinsicContentSize - Clean up i18n keys: drop colons (Filaments:/Target Color:), fix cycle card title Pattern→Filaments - Sync zh_CN translations * Refresh print tab after importing Local-Z settings After geometry-only 3MF import, reload the print tab when Local-Z settings were imported so the visible Subdivide Mix Layer controls match the project config used for slicing. * Do not import Local-Z process settings with geometry File -> Import 3MF should preserve the current project's process parameter state. Stop applying saved Local-Z project/print settings during geometry-only 3MF import; those settings are still loaded when opening a project with config. * Fix inherited plate bed type dirty state * i18n: add zh_CN translation for "Apply subdivision to infill" * docs: add inline comments explaining double-Layout macOS workaround in MixedFilamentDialog The error/warning labels use LB_AUTO_WRAP, which requires two Layout() passes on macOS: the first lands the panel's actual width after Show(), the second re-wraps the label text at the correct width. Without this, a single Layout can query a stale zero-width from CalcMin and produce an oversized dialog on first display. * Fix painted region rebuild after mixed filament edits * same layer pointillism comment --------- Co-authored-by: ratdoux <radugheorghiu96@gmail.com> Co-authored-by: ZhangZheng <67276816+LuckZAE@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description