1
0
Fork 0
mirror of https://github.com/maziggy/bambuddy.git synced 2026-05-09 08:25:54 +02:00

[PR #1144] [MERGED] ● feat(slicer): server-side slicing via OrcaSlicer / Bambu Studio sid… #1173

Closed
opened 2026-05-07 00:16:27 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/maziggy/bambuddy/pull/1144
Author: @maziggy
Created: 4/27/2026
Status: Merged
Merged: 4/27/2026
Merged by: @maziggy

Base: devHead: feature/slicer-api


📝 Commits (2)

  • 6deaa51 ● feat(slicer): server-side slicing via OrcaSlicer / Bambu Studio sidecar
  • 8829bc2 Merge branch 'dev' into feature/slicer-api

📊 Changes

40 files changed (+3560 additions, -543 deletions)

View changed files

📝 CHANGELOG.md (+2 -0)
📝 README.md (+1 -0)
📝 backend/app/api/routes/archives.py (+100 -0)
📝 backend/app/api/routes/library.py (+427 -0)
backend/app/api/routes/slice_jobs.py (+44 -0)
📝 backend/app/core/config.py (+9 -0)
📝 backend/app/main.py (+2 -0)
📝 backend/app/schemas/settings.py (+25 -0)
backend/app/schemas/slicer.py (+46 -0)
backend/app/services/slice_dispatch.py (+152 -0)
backend/app/services/slicer_api.py (+241 -0)
backend/tests/integration/test_library_slice_api.py (+445 -0)
backend/tests/unit/services/test_slicer_api.py (+219 -0)
📝 docker-compose.yml (+7 -0)
📝 frontend/src/App.tsx (+3 -0)
frontend/src/__tests__/components/SliceModal.test.tsx (+185 -0)
📝 frontend/src/__tests__/pages/SettingsPage.test.tsx (+21 -2)
📝 frontend/src/api/client.ts (+71 -0)
frontend/src/components/SliceModal.tsx (+207 -0)
frontend/src/contexts/SliceJobTrackerContext.tsx (+111 -0)

...and 20 more files

📄 Description

feat(slicer): server-side slicing via OrcaSlicer / Bambu Studio sidecar

  Adds an optional slicer-api/ Compose stack and wires Bambuddy's File
  Manager, Archives, and MakerWorld pages to a new server-side Slice flow.
  Slicing runs as an in-memory background job (POST returns 202 + job_id,
  polled via GET /api/v1/slice-jobs/{id}) so a multi-minute slice no
  longer pins the modal; result lands as a new .gcode.3mf in the same
  folder (or new archive for archive sources) with the embedded
  thumbnail extracted.

  Backend
  - New services: slice_dispatch (in-memory dispatcher, 30min retention
    sweep) and slicer_api (HTTP bridge with 4xx/5xx/connection error
    split that drives the 3MF embedded-settings fallback retry path).
  - New schemas: SliceRequest, SliceResponse, SliceArchiveResponse,
    SliceJobEnqueueResponse.
  - New routes: POST /library/files/{id}/slice,
    POST /archives/{id}/slice, GET /api/v1/slice-jobs/{id} (gated on
    LIBRARY_READ since job IDs are sequential and the body leaks source
    filenames and result IDs).
  - AppSettings + env defaults: use_slicer_api, orcaslicer_api_url,
    bambu_studio_api_url. DB-stored values override env defaults.

  Frontend
  - New SliceModal handles preset gating; enqueues then closes
    immediately.
  - New SliceJobTrackerProvider polls active jobs at app level, surfaces
    a single toast per job (queued -> running -> completed / failed)
    and invalidates library/archives queries on terminal status.
  - Settings -> Workflow -> Slicer card: preferred slicer dropdown,
    Use Slicer API toggle, contextual sidecar URL field.
  - File Manager / Archives / MakerWorld get a Slice button gated on
    the Use Slicer API setting.
  - gcode-viewer adapter learns ?library_file=<id> so sliced library
    files preview inline.

  i18n
  - New slice.* and settings.{useSlicerApi,slicerCard,orcaslicerApiUrl,
    bambuStudioApiUrl,slicerApiUrlDescription,useSlicerApiDescription}
    + fileManager.noPermissionSlice keys across all 8 locales (en, de,
    fr, it, ja, pt-BR, zh-CN, zh-TW). English fully translated, German
    fully translated, the other six seeded with English fallbacks
    pending native translation.

  Tests
  - 10 backend integration tests in test_library_slice_api.py covering
    validation (404/400), happy-path enqueue, sidecar-down, 3MF
    embedded-settings fallback, STL no-fallback, and preset-error ->
    failed job paths.
  - New unit tests in test_slicer_api.py for the HTTP bridge.
  - 5 new SliceModal frontend tests covering preset gating, library +
    archive enqueue paths, error surface, and preset-load failure.
  - Existing SettingsPage tests adjusted: slicer dropdown asserts now
    switch to the Workflow tab first; added a beforeEach URL reset so
    one test's tab click doesn't bleed into sibling tests.

  Sidecar
  - New slicer-api/ folder is self-contained and optional. Two services
    (orca-slicer-api on 3003, bambu-studio-api on 3001 behind --profile
    bambu) build via Docker git-build-context from
    maziggy/orca-slicer-api@bambuddy/profile-resolver. The fork patches
    the OrcaSlicer CLI's profile compatibility quirks (inherits-chain
    resolver, from:User -> system rewrite, '# ' clone-prefix strip,
    sentinel-value strip) empirically required to slice real GUI
    exports without segfaulting the CLI.

  Docs
  - CHANGELOG entry under [0.2.4b1] - Unreleased Added.
  - README File Manager bullet for the new server-side Slice button.
  - bambuddy-website features.html: new card under "Configurable Slicer".
  - bambuddy-wiki: new page features/slicer-api.md + nav entry +
    features index card.

  Notes
  - Opt-in: with Use Slicer API off, the existing "open in desktop
    slicer via URI" flow is the default and unchanged.
  - 3MF inputs that segfault the CLI on --load-settings transparently
    retry with embedded settings; the resulting job carries
    used_embedded_settings: true.
  - Sliced files always export as .gcode.3mf so File Manager picks up
    the embedded thumbnail; file_type is set to "gcode" (blue badge).

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/maziggy/bambuddy/pull/1144 **Author:** [@maziggy](https://github.com/maziggy) **Created:** 4/27/2026 **Status:** ✅ Merged **Merged:** 4/27/2026 **Merged by:** [@maziggy](https://github.com/maziggy) **Base:** `dev` ← **Head:** `feature/slicer-api` --- ### 📝 Commits (2) - [`6deaa51`](https://github.com/maziggy/bambuddy/commit/6deaa513af74eb5998c3a2d8932824445e949b71) ● feat(slicer): server-side slicing via OrcaSlicer / Bambu Studio sidecar - [`8829bc2`](https://github.com/maziggy/bambuddy/commit/8829bc2cc66ad71eab735c7ed28c417b5b8022fa) Merge branch 'dev' into feature/slicer-api ### 📊 Changes **40 files changed** (+3560 additions, -543 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+2 -0) 📝 `README.md` (+1 -0) 📝 `backend/app/api/routes/archives.py` (+100 -0) 📝 `backend/app/api/routes/library.py` (+427 -0) ➕ `backend/app/api/routes/slice_jobs.py` (+44 -0) 📝 `backend/app/core/config.py` (+9 -0) 📝 `backend/app/main.py` (+2 -0) 📝 `backend/app/schemas/settings.py` (+25 -0) ➕ `backend/app/schemas/slicer.py` (+46 -0) ➕ `backend/app/services/slice_dispatch.py` (+152 -0) ➕ `backend/app/services/slicer_api.py` (+241 -0) ➕ `backend/tests/integration/test_library_slice_api.py` (+445 -0) ➕ `backend/tests/unit/services/test_slicer_api.py` (+219 -0) 📝 `docker-compose.yml` (+7 -0) 📝 `frontend/src/App.tsx` (+3 -0) ➕ `frontend/src/__tests__/components/SliceModal.test.tsx` (+185 -0) 📝 `frontend/src/__tests__/pages/SettingsPage.test.tsx` (+21 -2) 📝 `frontend/src/api/client.ts` (+71 -0) ➕ `frontend/src/components/SliceModal.tsx` (+207 -0) ➕ `frontend/src/contexts/SliceJobTrackerContext.tsx` (+111 -0) _...and 20 more files_ </details> ### 📄 Description feat(slicer): server-side slicing via OrcaSlicer / Bambu Studio sidecar Adds an optional slicer-api/ Compose stack and wires Bambuddy's File Manager, Archives, and MakerWorld pages to a new server-side Slice flow. Slicing runs as an in-memory background job (POST returns 202 + job_id, polled via GET /api/v1/slice-jobs/{id}) so a multi-minute slice no longer pins the modal; result lands as a new .gcode.3mf in the same folder (or new archive for archive sources) with the embedded thumbnail extracted. Backend - New services: slice_dispatch (in-memory dispatcher, 30min retention sweep) and slicer_api (HTTP bridge with 4xx/5xx/connection error split that drives the 3MF embedded-settings fallback retry path). - New schemas: SliceRequest, SliceResponse, SliceArchiveResponse, SliceJobEnqueueResponse. - New routes: POST /library/files/{id}/slice, POST /archives/{id}/slice, GET /api/v1/slice-jobs/{id} (gated on LIBRARY_READ since job IDs are sequential and the body leaks source filenames and result IDs). - AppSettings + env defaults: use_slicer_api, orcaslicer_api_url, bambu_studio_api_url. DB-stored values override env defaults. Frontend - New SliceModal handles preset gating; enqueues then closes immediately. - New SliceJobTrackerProvider polls active jobs at app level, surfaces a single toast per job (queued -> running -> completed / failed) and invalidates library/archives queries on terminal status. - Settings -> Workflow -> Slicer card: preferred slicer dropdown, Use Slicer API toggle, contextual sidecar URL field. - File Manager / Archives / MakerWorld get a Slice button gated on the Use Slicer API setting. - gcode-viewer adapter learns ?library_file=<id> so sliced library files preview inline. i18n - New slice.* and settings.{useSlicerApi,slicerCard,orcaslicerApiUrl, bambuStudioApiUrl,slicerApiUrlDescription,useSlicerApiDescription} + fileManager.noPermissionSlice keys across all 8 locales (en, de, fr, it, ja, pt-BR, zh-CN, zh-TW). English fully translated, German fully translated, the other six seeded with English fallbacks pending native translation. Tests - 10 backend integration tests in test_library_slice_api.py covering validation (404/400), happy-path enqueue, sidecar-down, 3MF embedded-settings fallback, STL no-fallback, and preset-error -> failed job paths. - New unit tests in test_slicer_api.py for the HTTP bridge. - 5 new SliceModal frontend tests covering preset gating, library + archive enqueue paths, error surface, and preset-load failure. - Existing SettingsPage tests adjusted: slicer dropdown asserts now switch to the Workflow tab first; added a beforeEach URL reset so one test's tab click doesn't bleed into sibling tests. Sidecar - New slicer-api/ folder is self-contained and optional. Two services (orca-slicer-api on 3003, bambu-studio-api on 3001 behind --profile bambu) build via Docker git-build-context from maziggy/orca-slicer-api@bambuddy/profile-resolver. The fork patches the OrcaSlicer CLI's profile compatibility quirks (inherits-chain resolver, from:User -> system rewrite, '# ' clone-prefix strip, sentinel-value strip) empirically required to slice real GUI exports without segfaulting the CLI. Docs - CHANGELOG entry under [0.2.4b1] - Unreleased Added. - README File Manager bullet for the new server-side Slice button. - bambuddy-website features.html: new card under "Configurable Slicer". - bambuddy-wiki: new page features/slicer-api.md + nav entry + features index card. Notes - Opt-in: with Use Slicer API off, the existing "open in desktop slicer via URI" flow is the default and unchanged. - 3MF inputs that segfault the CLI on --load-settings transparently retry with embedded settings; the resulting job carries used_embedded_settings: true. - Sliced files always export as .gcode.3mf so File Manager picks up the embedded thumbnail; file_type is set to "gcode" (blue badge). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-07 00:16:27 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bambuddy-maziggy-1#1173
No description provided.