Skip to content

max-scopp/slicer-engine

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://max-scopp.github.io/slicer-engine/docs/ — architecture, module guides, and contributor docs.


Prerequisites

Before building or running, ensure you have:

Required

  • Rust 1.70+Install
  • Node.js 20+ and pnpm 9+Node, then npm install -g pnpm

For WASM builds (browser slicer, cloud UI)

Add the WebAssembly target and install wasm-pack:

rustup target add wasm32-unknown-unknown
cargo install wasm-pack

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 --release -- slice --input model.stl --output output.gcode

# Run the WebSocket + UI server (default port 5201)
cargo run --release -- serve

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

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

# 1. Build WASM scene bindings
pnpm run hydrate            # wasm-pack + schema/type gen

# 2. Start dev servers (both must run)
pnpm run ui:dev             # Angular dev server → http://localhost:4200
cargo run --release -- 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://max-scopp.github.io/slicer-engine/ — 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

wasm32-unknown-unknown target not found?

rustup target add wasm32-unknown-unknown

wasm-pack command not found?

cargo install wasm-pack

wasm-bindgen command not found?

cargo install wasm-bindgen-cli

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


Features

STL / OBJ / 3MF input · Variable-width walls (Arachne) · Infill patterns (rectilinear, grid, honeycomb, gyroid, TPMS-D) · G-code output for Marlin and Klipper printers · Custom start/end G-code · Per-object settings overrides · Layered config file with sensible defaults · Run in the browser, on the desktop, or self-hosted · Cross-platform (Windows, macOS, Linux).


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

Releases

No releases published

Packages

 
 
 

Contributors