Repository navigation
Open the generated 3MF in the default slicer from the desktop app - #148
Merged
vycdev merged 2 commits intoNov 15, 2026
Merged
Conversation
After building a model, desktop users had to save the 3MF through the Save As dialog, find it in the file manager and open it in their slicer by hand. The 3D download menu in the desktop app now has an "Open in Slicer" item that does this in one step. Frontend: - useAppHandlers shares one 3MF export pipeline (geometry, compression and progress overlay) between Download 3MF and Open in Slicer. Only the last step differs: saving the file, or handing it to the native app. A failure in that last step shows a destination-specific error; build failures still show the existing 3MF export error. - src/lib/desktopSlicer.ts sends the archive to the native open_model_in_slicer command as raw IPC bytes, so large models are not inflated into JSON number arrays, with the file name in a header. - PreviewActions shows the item only when App passes a handler, which it does only in the desktop runtime. The menu now grows to fit longer translated labels. Native (src-tauri/src/slicer_handoff.rs): - Accepts only a plain *.3mf file name and data that starts with a ZIP signature, so nothing other than a 3MF can be written or opened. - Writes a new file in <app cache>/slicer-handoff, adding -1, -2, ... instead of overwriting a copy a slicer may still have open, and syncs it before opening. Copies older than a day are removed on the next handoff. - Opens the file with the system default app through the same open/xdg-open/explorer launcher used for the diagnostics folder, now shared as open_with_default_app. Strings and the export guide's "Saving And Cancelling" section are updated in all 12 languages, with an Unreleased changelog entry. Tests: - Rust unit tests for file-name validation, collision naming, rejecting non-3MF data and stale-file cleanup. - tests/e2e/open-in-slicer.spec.ts (@smoke): the browser menu has no Open in Slicer item. On the fake desktop runtime, the built 3MF reaches the native command as a valid archive with a kromacut-YYYY-MM-DD.3mf name and no Save As dialog or download, and a native failure shows the localized error and re-enables the menu. - The fake desktop runtime now passes invoke options (headers) to command handlers. Closes vycdev#69
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This was referenced Nov 15, 2026
vycdev
pushed a commit
that referenced
this pull request
Nov 16, 2026
Open in Slicer (#148) always handed the 3MF to the operating system's default .3mf app, so anyone whose default was a 3D viewer, or who uses more than one slicer, had to change OS file associations first. This adds the slicer choice that #69 asked for and #148 left out. Native side (src-tauri/src/slicer_apps.rs): - list_slicer_apps detects Bambu Studio, Orca Slicer, PrusaSlicer and UltiMaker Cura in their usual locations: /Applications and ~/Applications on macOS; Program Files and %LOCALAPPDATA%\Programs on Windows (the newest "UltiMaker Cura <version>" folder wins, and the case-insensitive match also finds the older "Ultimaker Cura" folders); PATH commands and user/system Flatpak exports on Linux. Only installed slicers are listed, one entry per slicer. - pick_slicer_app opens the native file dialog (app bundles on macOS, .exe on Windows, any executable on Linux) and remembers the picked app in picked-slicers.json in the app config directory (at most 16). - open_model_in_slicer takes an optional, percent-encoded X-Kromacut-Slicer-App header. A model is only launched with a detected slicer or a picked app, never with an arbitrary program named by the web view; find_slicer_app applies the same rule. - macOS launches with `open -a <app> <model>` through the existing checked launcher, so Launch Services failures are reported. Flatpak slicers run through `flatpak run --file-forwarding`, because the exported launcher would not let the sandbox read Kromacut's cache. Other apps are spawned with the model as their argument and reaped in the background. Frontend: - Open in Slicer shows a chooser before building the 3MF: System default (the previous behavior), the detected slicers, and Browse. "Always use this slicer" saves the choice under kromacut:desktop-slicer; the menu item then names the slicer ("Open in Orca Slicer") and a new Choose Slicer item changes or forgets it. Turning the switch off and opening clears the choice. - A saved slicer that was moved or uninstalled is forgotten and the chooser explains that it could not be found. - Launch failures keep the localized error from b2873f4. - useSlicerChoice owns the saved preference and the chooser state; SlicerChooserDialog uses the existing AlertDialog, Switch and radio-list patterns. slicerPreference.ts validates stored values and tolerates blocked storage. Strings, docs and changelog: - New chooser and menu strings in all 12 locales, using each locale's existing slicer term. The Open in Slicer hint no longer promises the default 3MF app. - The export guide's Open in Slicer paragraph describes the chooser in all 12 languages. - Unreleased changelog entry under Added. Tests: - Native: detection per platform, newest Cura version, rejecting folders without an executable, launchable-app validation, describing picked apps, the detected-or-picked launch rule, picked-app storage and cap, launch commands (open -a, Flatpak file forwarding, direct), and percent-decoding of the slicer header. - Unit: saving, loading, forgetting and rejecting malformed stored preferences, and blocked storage. - e2e: the first click asks; choosing, remembering, changing, browsing (including a rejected pick), forgetting, remembering the system default, and a missing saved slicer. Fixes #152
This was referenced Nov 19, 2026
Merged
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.
After building a model in the desktop app, getting it into a slicer meant going through Save As, finding the file in the file manager and opening it by hand. This adds the "simplest first pass" from #69: an Open in Slicer item in the 3D download menu that builds the 3MF and opens it with the system's default
.3mfapp in one click.What changed
Frontend
useAppHandlersnow has one 3MF export pipeline (geometry, compression, progress overlay) shared by Download 3MF and Open in Slicer. Only the last step differs: save the file, or hand it to the native app. The overlay shows "Opening 3MF in slicer" for that step. If the handoff fails, a new localized message says so and points to Download 3MF. Build failures still show the existing "3MF export failed" message.src/lib/desktopSlicer.tssends the archive to a newopen_model_in_slicercommand as raw IPC bytes (invoke(cmd, Uint8Array, { headers })), so a large model isn't turned into a JSON number array. The file name (kromacut-YYYY-MM-DD.3mf, the same as Download 3MF) goes in a header.PreviewActionsshows the item only whenApppasses a handler, andApppasses one only whenisTauri()is true. The browser menu is unchanged. The popover is noww-auto min-w-48, so longer labels such as the French "Ouvrir dans le logiciel de découpe" fit on one line. English menus keep their current width.Native (
src-tauri/src/slicer_handoff.rs)*.3mfname (ASCII letters, digits,-,_,., no leading dot or path parts) and data that starts with a ZIP signature. Nothing other than a 3MF can be written or opened.<app cache>/slicer-handoff/. It always creates a new file (name.3mf, thenname-1.3mf, and so on) instead of overwriting a copy a slicer may still have open (Windows locks open files), and syncs it before launching. On each handoff, copies older than a day are removed, best effort.open/xdg-open/explorer), renamed fromopen_directorytoopen_with_default_appso both can share it. No new plugin, dependency or capability is needed.Strings, docs, changelog
.3mfapp (otherwise the OS may open a 3D viewer or ask which app to use), that the cached copy can be removed after a day so the project should be saved in the slicer, and that the browser should use Download 3MF.Most of the
useAppHandlers.tsandApp.tsxdiff is re-indentation. Prettier only keeps a hook callback hugged when it takes no parameters, and the destructure no longer fits on one line. With whitespace hidden, the change is about 70 lines.Scope
This is the OS file-association version the issue suggests as a first pass. It doesn't pick a slicer, remember a default, or detect slicer install paths; that could come later on top of the same command. Since the app is launched with
spawn, "no app is registered for .3mf" is handled by the OS (a picker or an error dialog) rather than reported by Kromacut. The guide says this.Closes #69
Tests
slicer_handoff(file-name validation including traversal, drive and Unicode cases;-1collision naming without overwriting; rejecting non-ZIP data with nothing written; removing only stale.3mffiles).cargo testpasses (15/15), andcargo clippy --all-targetsandcargo fmt --checkare clean (Linux, in arust:1-bookwormcontainer with the WebKitGTK dev packages).tests/e2e/open-in-slicer.spec.ts(@smoke):open_model_in_sliceras a valid 3MF ([Content_Types].xmland a<mesh>in3D/3dmodel.model) with only theX-Kromacut-File-Name: kromacut-YYYY-MM-DD.3mfheader. There is no Save As call, download or alert. A native failure then shows the localized error and the menu is enabled again.develop, where the item doesn't exist.tests/e2e/helpers/fakeDesktop.tsnow passes invoke options (headers) to handlers as an optional third argument. Existing handlers are unaffected.npm run lint,npx tsc -b,npm run check:i18n,npm test(1112 pass, 1 skipped),npm run check:e2e,npm run test:e2e(85 passed, including every desktop spec that uses the fake),npm run test:e2e:i18n(17 passed),npm run test:e2e:docs(6 passed),npm run test:docs, andnpm run test:i18n.