Skip to content

Fix multiple issues: PETG-HF type, Chinese comments, Klipper wizard, spiral lift, color matching, prime tower, filament preprocessing, by-object print, filament density, calibration models, login persistence, filament selections#190

Open
kbaker827 wants to merge 13 commits intoSnapmaker:mainfrom
kbaker827:fix/misc-filament-chinese-klipper

Conversation

@kbaker827
Copy link

@kbaker827 kbaker827 commented Mar 10, 2026

Summary

This PR fixes 15 separate issues:

Fix #96 — PETG-HF filament type not recognized

  • Added `"filament_type": ["PETG-HF"]` to `Bambu PETG HF @base.json`
  • Added `"PETG-HF"` to the `filament_types` whitelist in `CreatePresetsDialog.cpp`

Fix #138 — Chinese comments in Print.cpp

  • Translated 7 Chinese-language comments in `src/libslic3r/Print.cpp` to English

Fix #179 — Generic Klipper / 3rd-party printers cannot be selected in ConfigWizard

  • Root cause: `Pages3rdparty pages_3rdparty` was commented out; vendor pages were never added to the navigation index
  • Restored the `pages_3rdparty` field and vendor page iteration in `load_pages()`

Fix #161 — Spiral lifting 3.5mm boundary warning / unusable bed area

  • `GCodeWriter` now stores the bed bbox and checks each spiral lift arc against it
  • Falls back to lazy lift automatically when the arc would exceed bed extents

Fix #172 — Smart Color Matching (duplicate/near-identical filament slots on import)

  • `deal_approximate_match_btn()` accepts a DeltaE76 threshold parameter
  • `deal_add_unmatched_filaments()` only adds slots for colors that exceed threshold
  • `deal_default_strategy()`: reset → match with threshold → add only unmatched

Fix #121 — Prime tower "Fillet wall" causes x-axis out-of-range error

  • `WipeTower2` now clamps cone arc radius to stay within the bed boundary
  • Extended to all bed shapes: circular beds use a distance-from-center check; rectangular/custom use bounding-box margins

Fix #135 — Prime tower placed outside build plate on multi-plate projects

  • `set_default_wipe_tower_pos_for_plate()` reads `printable_area` instead of hard-coding `y=250`

Fix #115 — Filament not showing in Print Preprocessing window

  • `load_selections()` / `update_selections()`: only replace filament presets that no longer exist (not merely invisible/incompatible)
  • `reset_and_sync_ams_list()`: replaced O(n²) linear scan with `find_preset()` (visibility-agnostic) for correct index alignment

Fix #136 — By-object print causes toolhead collision

  • Inter-object travel reordered: `retract` → `travel_to_z(m_max_layer_z)` → `set_extruder` → `travel_to(origin)`

Fix #103 #114 — Filament density 0 → zero weight and U1 filament rejection

  • `Snapmaker PLA SnapSpeed.json`: density corrected from `"0"` to `"1.25"`
  • `fdm_filament_common.json`: density corrected from `"0"` to `"1.24"`

Fix #159 — Calibration models non-manifold/unsliceable on macOS and Linux

  • `calib_temp`: upper and lower cuts now use `-EPSILON` (was `+EPSILON`) to cut just below each flat block face, avoiding degenerate geometry
  • `calib_max_vol_speed`, `calib_retraction`, `calib_VFA`: cut heights now subtract `EPSILON`

Fix #116 — Snapmaker login credentials not persisted on macOS/Linux

  • Root cause: `SMUserInfo` is a plain in-memory struct with no serialization. WebKit (macOS/Linux) does not preserve session cookies, so the token is lost when the app closes.
  • `WebSMUserLoginDialog`: saves `sm_user_token` / `sm_user_name` / `sm_user_icon_url` to `AppConfig` after login
  • `GUI_App::init_app_config()`: restores login state from AppConfig on startup
  • `GUI_App::sm_request_user_logout()`: clears all three keys from AppConfig on logout

Fix #164 — Linux Flatpak crashes: "Cannot register URI scheme wxfs more than once"

  • Root cause: `WebView::CreateWebView()` called `RegisterHandler("wxfs")` and `RegisterHandler("memory")` on every invocation. WebKitGTK registers URI schemes globally per process, so the second call is a fatal abort.
  • Added a `static bool s_handlers_registered` guard in the non-Windows branch of `CreateWebView()` so both handlers are registered exactly once per process lifetime.

Fix #101 — Filament selections not saved after Add/Remove Filaments wizard

  • Root cause: `ConfigWizard::priv::apply_config()` sets filament selections in `AppConfig` in memory but never calls `app_config->save()`. If the app exits before the next periodic dirty-save fires, the changes are lost.
  • Added `app_config->save()` at the end of `apply_config()` after `export_selections()`

Test plan

  • Verify PETG-HF filament is correctly identified in filament presets
  • Verify "Generic Klipper Printer" appears and is selectable in ConfigWizard
  • Verify spiral lift near bed edges: enable spiral lift, slice near a corner — confirm slicing succeeds without warnings (inspect G-code to confirm G2/G3 arc or fallback straight lift; no error dialog)
  • Import multi-color file with near-identical colors — verify they map to existing slots (no new duplicate slots added)
  • Import multi-color file with distinct colors — verify new slots are created
  • Slice with Snapmaker A250 profile (cone_angle=40°) — verify no out-of-range movements (inspect G-code or confirm no error dialog)
  • Add a second plate — verify prime tower appears within bed boundary
  • Open System Filaments dialog, uncheck a filament, verify it still shows in Print Preprocessing window (not replaced by a fallback)
  • Slice by-object print with IDEX profile — inspect G-code: retract must appear before the Z-lift, and Z-lift before the T-command toolchange
  • Select "Snapmaker PLA SnapSpeed", slice any model — verify non-zero weight displayed
  • On macOS or Linux: generate each calibration tool (Temp Tower, Retraction, Max Flow, VFA) and verify no non-manifold error
  • Log in to Snapmaker account, close and reopen OrcaSlicer — verify login state is restored without re-authenticating
  • Log out — verify login state is NOT restored on next launch
  • On Linux Flatpak: open multiple panels/tabs that each create a WebView — verify no crash or "Cannot register URI scheme" error
  • Open Add/Remove Filaments wizard, select filaments, click Confirm — close and reopen OrcaSlicer — verify selections are preserved

🤖 Generated with Claude Code

…vigation so Klipper/Custom printers can be selected
…GCodeWriter

Add BoundingBoxf m_bed_bbox member to track the print bed extents for
use in spiral lift boundary checking.
Implement the TODO in GCodeWriter::travel_to_xyz() to check if the
spiral lift arc stays within the bed boundary. If the arc would go
outside the bed extents, automatically fall back to lazy lift instead.

This allows models to be positioned anywhere on the build plate
without triggering warnings about spiral lifting and bed boundaries.
The 3.5mm clearance warning is no longer needed as the slicer now
handles the case automatically.
…laration

Change deal_approximate_match_btn() to accept an optional DeltaE76
threshold parameter. Add deal_add_unmatched_filaments() declaration
which only adds new filament slots for model colors that didn't match
any existing filament within the threshold.
…before adding new ones

Bug: deal_default_strategy() called deal_add_btn() first (which added
all model colors as new filament slots), then deal_approximate_match_btn().
Since the newly-added exact-match slots dominated the distance search,
approximate matching against the original filaments never happened.

Fix:
- deal_approximate_match_btn() now takes an optional DeltaE76 threshold
  (default -1 = no threshold, preserving manual Color Match button behavior)
- New deal_add_unmatched_filaments() only adds new slots for model colors
  that exceeded the threshold distance from all existing filaments
- deal_default_strategy() now: reset -> match with threshold=10 -> add unmatched

DeltaE76=10 means perceptibly different colors; typical white/off-white
variations (DeltaE~2-5) will reuse the existing filament slot instead of
creating a redundant new one.
@kbaker827 kbaker827 changed the title Fix multiple issues: PETG-HF type, Chinese comments, Klipper wizard, spiral lift boundary Fix multiple issues: PETG-HF type, Chinese comments, Klipper wizard, spiral lift boundary, smart color matching Mar 10, 2026
…ary; fix default tower position

Issue Snapmaker#121 - Stabilization cone ("Fillet wall") extends beyond bed boundary:
  The default Snapmaker process profile sets wipe_tower_cone_angle=40deg,
  which causes the arc-shaped cone base to reach beyond the bed's printable
  area when the tower is placed near the edge, triggering "x-axis out of range"
  errors on the U1 and similar printers.
  Fix: store m_bed_height in WipeTower2 (parallel to existing m_bed_width) and
  clamp the cone radius r so the arc stays within the rectangular bed boundary
  before generating any G-code arc points.

Issue Snapmaker#135 - Prime tower placed outside build plate on multi-plate projects:
  set_default_wipe_tower_pos_for_plate() hard-coded y=250, which is exactly
  the bed top for the Snapmaker A250 (230x250mm). The tower depth pushed it
  beyond the bed boundary.
  Fix: read printable_area from the printer preset at plate-creation time and
  compute default_x = bed_width - tower_width - 10, default_y = bed_height -
  30 - 10, so the initial placement is always within the actual bed bounds.
…ary; fix default tower position

Issue Snapmaker#121 - Stabilization cone ("Fillet wall") extends beyond bed boundary:
  The default Snapmaker process profile sets wipe_tower_cone_angle=40deg,
  which causes the arc-shaped cone base to reach beyond the bed's printable
  area when the tower is placed near the edge, triggering "x-axis out of range"
  errors on the U1 and similar printers.
  Fix: store m_bed_height in WipeTower2 (parallel to existing m_bed_width) and
  clamp the cone radius r so the arc stays within the rectangular bed boundary
  before generating any G-code arc points.

Issue Snapmaker#135 - Prime tower placed outside build plate on multi-plate projects:
  set_default_wipe_tower_pos_for_plate() hard-coded y=250, which is exactly
  the bed top for the Snapmaker A250 (230x250mm). The tower depth pushed it
  beyond the bed boundary.
  Fix: read printable_area from the printer preset at plate-creation time and
  compute default_x = bed_width - tower_width - 10, default_y = bed_height -
  30 - 10, so the initial placement is always within the actual bed bounds.
…ary; fix default tower position

Issue Snapmaker#121 - Stabilization cone ("Fillet wall") extends beyond bed boundary:
  The default Snapmaker process profile sets wipe_tower_cone_angle=40deg,
  which causes the arc-shaped cone base to reach beyond the bed's printable
  area when the tower is placed near the edge, triggering "x-axis out of range"
  errors on the U1 and similar printers.
  Fix: store m_bed_height in WipeTower2 (parallel to existing m_bed_width) and
  clamp the cone radius r so the arc stays within the rectangular bed boundary
  before generating any G-code arc points.

Issue Snapmaker#135 - Prime tower placed outside build plate on multi-plate projects:
  set_default_wipe_tower_pos_for_plate() hard-coded y=250, which is exactly
  the bed top for the Snapmaker A250 (230x250mm). The tower depth pushed it
  beyond the bed boundary.
  Fix: read printable_area from the printer preset at plate-creation time and
  compute default_x = bed_width - tower_width - 10, default_y = bed_height -
  30 - 10, so the initial placement is always within the actual bed bounds.
@kbaker827 kbaker827 changed the title Fix multiple issues: PETG-HF type, Chinese comments, Klipper wizard, spiral lift boundary, smart color matching Fix multiple issues: PETG-HF type, Chinese comments, Klipper wizard, spiral lift boundary, smart color matching, prime tower cone/placement Mar 10, 2026
@kbaker827 kbaker827 changed the title Fix multiple issues: PETG-HF type, Chinese comments, Klipper wizard, spiral lift boundary, smart color matching, prime tower cone/placement Fix multiple issues: PETG-HF type, Chinese comments, Klipper wizard, spiral lift, color matching, prime tower, filament preprocessing, by-object print, filament density, calibration models, login persistence Mar 11, 2026
@kbaker827 kbaker827 changed the title Fix multiple issues: PETG-HF type, Chinese comments, Klipper wizard, spiral lift, color matching, prime tower, filament preprocessing, by-object print, filament density, calibration models, login persistence Fix multiple issues: PETG-HF type, Chinese comments, Klipper wizard, spiral lift, color matching, prime tower, filament preprocessing, by-object print, filament density, calibration models, login persistence, filament selections Mar 11, 2026
Fixes not yet in the PR branch, now added:

Fix Snapmaker#103/Snapmaker#114 — Filament density zero
- Snapmaker PLA SnapSpeed.json: density "0" → "1.25"
- Snapmaker fdm_filament_common.json: density "0" → "1.24"

Fix Snapmaker#159 — Calibration models non-manifold on macOS/Linux
- calib_temp: upper and lower cuts now use -EPSILON (was +EPSILON) to
  cut just below each flat block face, avoiding degenerate geometry
- calib_max_vol_speed, calib_VFA, calib_retraction: same -EPSILON applied

Fix Snapmaker#116 — Snapmaker login credentials not persisted on macOS/Linux
- WebSMUserLoginDialog: saves sm_user_token / sm_user_name /
  sm_user_icon_url to AppConfig immediately after login; calls save()
  once all three are known
- GUI_App::init_app_config(): restores login state from AppConfig on startup
- GUI_App::sm_request_user_logout(): clears all three keys and saves

Fix (Flatpak) — "Cannot register URI scheme wxfs more than once"
- Widgets/WebView.cpp: added static s_handlers_registered guard in the
  non-Windows branch of CreateWebView() so wxfs and memory handlers are
  registered exactly once per process lifetime

Fix Snapmaker#101 — Filament selections not saved after Add/Remove Filaments wizard
- ConfigWizard: added app_config->save() after export_selections() in
  apply_config() so selections survive an immediate app exit

Fix Snapmaker#136 — By-object print causes toolhead collision on IDEX
- GCode.cpp: reordered inter-object travel: retract → travel_to_z
  (m_max_layer_z) → set_extruder (if needed) → travel_to(origin)
  so the nozzle is at safe height before the toolchange move

Fix Snapmaker#115 — Filament not showing in Print Preprocessing window
- PresetBundle::load_selections() and update_selections(): only replace
  filament presets that no longer exist, not merely invisible/incompatible
- SelectMachine::reset_and_sync_ams_list(): replaced O(n²) linear scan
  with find_preset() (visibility-agnostic) for correct index alignment

Code quality — WipeTower2 cone radius clamp (issue Snapmaker#121)
- Extended clamp to all bed shapes: circular beds now use a distance-
  from-bed-center check; custom/rectangular beds use bounding-box margins

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment