mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-18 22:42:37 +00:00
# Description Adds a sketch-first parametric CAD tab to the slicer: sketch → constrain → solid features → commit to plate. The feature recipe is persisted inside the 3MF, so reopening a project restores an editable model rather than a frozen mesh. Opening this at @SoftFever's request, so the code is easier to read than a fork. **The number worth reading first:** the diff is large, but almost all of it is new files. Existing upstream code is touched in **23 files, +622 / -88 total**. That is the entire negotiable surface. The largest single one is `GLCanvas3D.cpp` at +149/-14 (a pick path for the CAD viewport); everything else is under 60 lines. One thing about the raw diff: the file count includes everything new, and the negotiable surface is the 23 modified files above. Thanks for merging `main` in — the branch is current again, and I have kept building on top of it. The regenerated i18n catalogues (`OrcaSlicer.pot`, `OrcaSlicer_it.po`, `list.txt`) have been kept OUT of this branch deliberately — they were 27,314 added lines of build product standing between you and the code. They regenerate from source with `scripts/run_gettext.sh` whenever you want them refreshed. A Romanian catalogue that had been riding along was pulled out at the same time — a translation has no business being reviewed inside a CAD feature PR. | | | |---|---| | Kernel | OCCT — already linked for STEP import. The dependency delta is one line: `BUILD_MODULE_ModelingAlgorithms=OFF → ON`. Measured cost in [`docs/cad_dependency_weight.md`](https://github.com/tommasobbianchi/Orca-Cad/blob/cad-mainline/docs/CAD/cad_dependency_weight.md) | | Constraint solver | vendored SolveSpace `libslvs` subset, 21 files / ~10k lines under `src/libslic3r/slvs/` | | Build gate | `SLIC3R_CAD` (default ON). With it OFF the tab is not compiled and the deps prefix matches upstream exactly | | Persistence | CAD recipe embedded in both the 3MF and BBS-3MF writers | | User docs | [`docs/design_tab.md`](https://github.com/tommasobbianchi/Orca-Cad/blob/cad-mainline/docs/CAD/design_tab.md) | | Interaction model | object-driven — point at geometry, it offers the verbs that apply: [`docs/cad_ux_guidelines.md`](https://github.com/tommasobbianchi/Orca-Cad/blob/cad-mainline/docs/CAD/cad_ux_guidelines.md) | ### Why it belongs in the slicer Every round trip through an external CAD tool costs an export, a re-import, and the design intent both steps discard. A part changed after slicing should come back to its feature history, not to a mesh. Keeping the model in the slicer preserves that loop — nozzle diameter, build volume and material are known at design time. Longer argument in [`docs/design_tab_upstream_portability.md`](https://github.com/tommasobbianchi/Orca-Cad/blob/cad-mainline/docs/CAD/design_tab_upstream_portability.md). ### Two things I'd rather you hear from me than find **Licensing.** The vendored solver is **GPL-3.0**, not LGPL (`src/libslic3r/slvs/LICENSE`). The combined work is distributable under AGPL-3.0 and the compatibility argument is written out in the portability doc, but this is a project-level decision and I would like it confirmed explicitly rather than assumed. If GPL-3.0 in-tree is not acceptable, the solver is the separable part — the timeline, features and persistence do not depend on it. **One CMake change is larger than it looks.** `CMakeLists.txt` is +41/-56: it replaces a hand-maintained list of OCCT DLLs to copy on Windows with a glob plus an assertion that every linked toolkit actually has a DLL. The explicit list had already drifted from what `libslic3r` links and shipped a portable that died at launch with `error 126`. Happy to split that out into its own PR if you'd prefer it reviewed separately. ### Not verified - No automated GUI test. A green kernel run says nothing about the viewport — synthetic clicks never drift, so the suite and the UI are two separate realities. - Card wiring for 9 of the 16 late-wired tools has never been click-tested. - The click-test defect rate has not converged: one pass found nothing, four further days of work found five more defects. I would not present the quiet pass as evidence of stability. # Screenshots/Recordings/Graphs One part, start to finish: sketch it, feature it, print it — without leaving the slicer.  **1. Sketch, constrained and dimensioned.** A 100 × 90 rounded rectangle drawn straight onto the bed, R20 corners, live dimensions, and the solver's remaining degrees of freedom reported in the panel. The bed is the sketch plane, so the part is sized against the machine it will be printed on from the first line.  **2. The feature tree is the part.** `Sketch1 → Extrude2 → Chamfer3 → Sketch4 → Extrude5 → Hole6 → Thread7`. Every step stays editable and re-evaluates downstream — the modelled thread in the boss is a real helical feature, not a texture.  **3. Committed to the plate.** The same body arrives in Prepare as `Design Body`, 100 × 90 × 78 mm, 581,634 mm³, ready for a Sovol Zero and PETG. No export, no re-import, no lost design intent.  **4. Sliced.** The thread comes out as real helical toolpaths, and the estimate is 3h26m / 134.54 g. This is the whole argument for the feature in one frame: the geometry that was parametric two screens ago is now G-code, and it is still parametric if you go back. ## Tests 215 `TEST_CASE` blocks across 6 new test files, plus 2 `SCENARIO`s added to `tests/libslic3r/test_3mf.cpp` covering the CAD recipe's round trip through both 3MF writers. `scripts/kernel-test.sh` is the headless contract: it builds only `libslic3r_tests`, needs no display, and exit 0 means the CAD suite passed. Happy to slice this differently — kernel + solver first, GUI second — if that reviews better for you.