Skip to content

max-scopp/slicer-engine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

336 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Slicer Engine

🌐 Try the online slicer β†’ no install, no account, works right now.

Slice your 3D models instantly β€” in your browser, on your desktop, or on your own server. Your workflow, your choice.

Drop in an STL, OBJ, or 3MF and get print-ready G-code in seconds. One engine, three ways to run it:

Where it runs Setup
🌐 Web Fully in your browser β€” nothing installed None β€” just open the link
πŸ–₯️ Desktop Native app, runs entirely on your machine Download & run
☁️ Self-hosted Host it yourself, share with your team cargo run -- serve

Every mode uses the same slicing engine, so results are identical regardless of how you run it. In the browser, your files never leave your machine.

πŸ“– Full documentation: https://slicer.maxscopp.de/docs/ β€” architecture, module guides, and contributor docs.


Prerequisites

Before building or running, ensure you have:

Required

  • Rust 1.70+ via rustup β€” the Homebrew rust package is not supported; it ships without the wasm32-unknown-unknown standard library and can't add targets. If you have it installed, run brew uninstall rust first, then install rustup.
  • Node.js 20+ and pnpm 9+ β€” Node, then npm install -g pnpm

For WASM builds (self-hosted UI, browser slicer, desktop)

All three modes need the WASM scene bindings. Add the target and install a matching wasm-bindgen-cli:

rustup target add wasm32-unknown-unknown

# Match the wasm-bindgen version pinned in Cargo.lock β€” mismatched CLI
# versions silently produce broken bindings.
cargo install wasm-bindgen-cli --version "$(grep -A1 '^name = "wasm-bindgen"$' Cargo.lock | tail -1 | cut -d'"' -f2)" --locked

Only needed if you build the standalone in-browser bundle yourself: cargo install wasm-pack. The pnpm hydrate scripts do not use it.

For desktop app builds

Install Tauri CLI (choose one):

cargo install tauri-cli --version "^2"
# OR: pnpm add -g @tauri-apps/cli

Optional

  • C++ toolchain (clang++ or MSVC) β€” needed only for full WASM builds with polygon clipping support
    • Linux: sudo apt install build-essential clang
    • macOS: xcode-select --install (Xcode Command Line Tools)
    • Windows: Visual Studio or Build Tools

Quick Start

# Slice an STL to G-code
cargo run -- slice --input model.stl --output output.gcode

# Inspect or edit persisted settings
cargo run -- settings show
cargo run -- settings set layer_height 0.15

To run the WebSocket + UI server (cargo run -- serve), see First-time setup below β€” the UI must be built before the server can serve it.


First-time setup (self-hosted UI)

After cloning, run these once in order. Skipping any step means the next one fails with confusing errors.

# 1. Install deps (Rust + Node prerequisites above must already be in place)
pnpm install

# 2. Build WASM scene bindings + generate JSON schemas + TS types
#    Populates ui/src/generated/ β€” without this, `pnpm ui:build` fails with
#    "Cannot find module '../../generated/scene-wasm/scene_engine'".
pnpm run hydrate

# 3. Build the Angular UI
#    Produces ui/dist/slicer-ui/browser β€” without this, `cargo run -- serve`
#    fails with "UI directory not found: ./ui/dist/slicer-ui/browser".
pnpm run ui:build

# 4. Start the server (serves the UI at http://localhost:5201/)
cargo run -- serve

For iterative UI work, use the dev-server flow in Self-hosted web UI below (skips step 3, hot-reloads Angular).


Architecture at a glance

graph TB
    subgraph Surfaces
        F["CLI"]
        S["WebSocket server"]
        subgraph UI["Angular UI"]
            CM["cloud mode<br/>(scene in WASM,<br/>slice on server)"]
            WM["web mode<br/>(scene + slice<br/>in WASM)"]
            NM["native mode<br/>(Tauri desktop,<br/>all in Rust)"]
        end
    end

    subgraph Core["Rust core"]
        SC["scene/<br/>SSOT for placement"]
        M["mesh/"]
        SL["core/<br/>slicing pipeline"]
        A["arachne/<br/>walls"]
        I["infill/"]
        G["gcode/"]
    end

    F --> SC
    CM -->|"WS + HTTP"| S
    WM -->|wasm-bindgen| SC
    NM -->|"wasm-bindgen scene"| SC
    NM -->|"tauri::invoke slicing"| SC
    S --> SC
    SC --> M --> SL --> A
    SL --> I
    SL --> G

    style SC fill:#fff9c4
    style SL fill:#c8e6c9
    style G fill:#e1f5ff
Loading

The same engine runs in three different environments β€” on a server, compiled into the browser, and bundled into the desktop app β€” so slicing results are always identical regardless of where you run it.

The UI selects its runtime mode at startup:

Mode Where slicing happens When
cloud On your server Default web build
web In your browser web-slicer build
native On your desktop Desktop app

See Scene Engine and Slicing Pipeline for the contract.


Configuration

Slicer Engine is configured via slicer.toml. Resolution order:

  1. CLI flags (per invocation, never persisted)
  2. Project config β€” ./slicer.toml in the working directory
  3. User config β€” platform path (e.g. ~/.config/slicer-engine/slicer.toml)
  4. Built-in defaults
[machine]
nozzle_diameter = 0.4
build_volume_x = 220.0

[slicing]
layer_height = 0.2
wall_count = 3
infill_density = 0.20

[server]
port = 5201

Manage it from the CLI:

slicer-engine config show
slicer-engine config set slicing.layer_height 0.15
slicer-engine slice --input model.stl --config ./slicer.toml

Full reference β†’ Settings Β· Config (TOML) Β· CLI.


Self-hosted web UI

Production flow (server serves the built UI on a single port):

pnpm run hydrate             # once (or when Rust bindings/schemas change)
pnpm run ui:build            # once (or after UI changes)
cargo run --release -- serve # http://localhost:5201/

Dev flow (Angular hot-reload, backend runs separately β€” both must be running):

pnpm run hydrate             # once (or when Rust bindings/schemas change)
pnpm run ui:dev              # Angular dev server β†’ http://localhost:4200
cargo run -- serve           # WebSocket/HTTP server  β†’ http://localhost:5201

The UI sends slicing jobs to the local server. Scene management runs in the browser for instant feedback.


Browser slicer (no server needed)

Live demo: https://slicer.maxscopp.de/ β€” slice in your browser, no backend required.

The full slicing pipeline runs in-browser. Building this locally requires a wasm-capable C++ toolchain (clang++) for the polygon clipping library.

# Build the full WASM bundle (scene + slicer)
pnpm run hydrate:web-slicer

# Dev server β€” no backend required
pnpm run ui:dev:web-slicer   # http://localhost:4200

# Production build
pnpm run ui:build:web-slicer

Desktop app

Bundles the UI and the full slicing engine into a native desktop application. No server required.

# Prerequisites: install Tauri CLI
cargo install tauri-cli --version "^2"
# or: pnpm add -g @tauri-apps/cli

# Dev mode (hot-reloads Angular, rebuilds Rust on change)
pnpm run desktop:dev

# Production build (outputs a platform installer)
pnpm run desktop:build

The desktop app automatically uses the bundled native engine for slicing, giving you full offline capability and the best performance. Scene management is shared with the browser UI, so the experience is identical.


Building

Native (your host platform)

cargo build --release                   # Single command β€” that's it

Cross-platform

cargo build --release --target x86_64-pc-windows-msvc       # Windows
cargo build --release --target x86_64-apple-darwin          # macOS Intel
cargo build --release --target aarch64-apple-darwin         # macOS ARM

WebAssembly (browser slicer)

Requires: rustup target add wasm32-unknown-unknown and cargo install wasm-pack

wasm-pack build --target web --release

Or use the pnpm script (which handles schema generation too):

pnpm run hydrate               # Scene + type bindings
pnpm run hydrate:web-slicer    # Full WASM slicer (includes polygon clipping)

Using Makefile (Linux/macOS)

make build-release  build-windows  build-macos  build-wasm

Troubleshooting Setup

cargo run -- serve fails with UI directory not found: ./ui/dist/slicer-ui/browser? Build the UI first: pnpm run hydrate && pnpm run ui:build. See First-time setup.

pnpm ui:build fails with Cannot find module '../../generated/scene-wasm/scene_engine' (or .../slicer-engine-ws-*-message-v1)? You skipped pnpm run hydrate. Run it, then retry the build.

wasm32-unknown-unknown target not found / error[E0463]: can't find crate for 'core'? Either the target isn't installed (rustup target add wasm32-unknown-unknown) or you're on Homebrew Rust, which can't add targets. Run brew uninstall rust and install rustup.

wasm-bindgen command not found? Install the CLI at the exact version pinned in Cargo.lock (mismatched versions produce silently broken bindings):

cargo install wasm-bindgen-cli --version "$(grep -A1 '^name = "wasm-bindgen"$' Cargo.lock | tail -1 | cut -d'"' -f2)" --locked

wasm-pack command not found? Only needed for the standalone wasm-pack build invocation β€” the pnpm hydrate scripts don't use it. If you actually need it: cargo install wasm-pack.

pnpm hydrate fails with C++ compilation errors? Install the C++ toolchain for your platform (see Prerequisites above), then retry.


Development

cargo build                                                 # fast iteration (debug)
cargo test
cargo fmt && cargo clippy --all-targets --all-features -- -D warnings
pnpm --filter slicer-engine-docs docs:dev                   # live docs site
sea-orm-cli migrate generate "my_migration" -d src/db       # scaffold DB migration

See CONTRIBUTING.md for workflow, AGENTS.md for AI-agent guidance, and ARCHITECTURE.md for the long-form architecture overview (also rendered on the docs site).


References

RepRap G-code Wiki Β· Arachne Paper Β· Clipper2 Β· Marlin G-code Β· Klipper G-code Β· Tauri


Implementation notes

Built on proven approaches from established slicers, but written from scratch in Rust. AI tools assist with development and problem-solving; all AI-generated code is reviewed and approved by human maintainers before merge.


License

All rights reserved until an official license is decided. No use, reproduction, modification, or distribution permitted without written authorization. TBD.


Support

Issues Β· Discussions Β· Contributing Β· Documentation site

About

🧊 A 3D slicer that runs everywhere you do: terminal, web, and cloud-scale fleets.

Topics

Resources

Contributing

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages