Skip to content

Source: README.md โ€” this page is rendered directly from the file in the repository. Edit it there.

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 runsSetup
๐ŸŒ WebFully in your browser โ€” nothing installedNone โ€” just open the link
๐Ÿ–ฅ๏ธ DesktopNative app, runs entirely on your machineDownload & run
โ˜๏ธ Self-hostedHost it yourself, share with your teamcargo 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:

bash
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):

bash
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 โ€‹

bash
# 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.

bash
# 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 โ€‹

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:

ModeWhere slicing happensWhen
cloudOn your serverDefault web build
webIn your browserweb-slicer build
nativeOn your desktopDesktop 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
toml
[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:

bash
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):

bash
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):

bash
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.

bash
# 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.

bash
# 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) โ€‹

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

Cross-platform โ€‹

bash
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

bash
wasm-pack build --target web --release

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

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

Using Makefile (Linux/macOS) โ€‹

bash
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):

bash
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 โ€‹

bash
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