Repository navigation
Open the generated 3MF in the default slicer from the desktop app - #148
Open
officialasishkumar wants to merge 1 commit into
Open
officialasishkumar wants to merge 1 commit into
officialasishkumar wants to merge 1 commit into
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 branch has not been deployed
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.