# supermerill/superslicer architecture

> Architecture diagram of the GitHub repository supermerill/superslicer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/supermerill/superslicer
- Repository: https://github.com/supermerill/superslicer

## Overview

1. **Repository purpose**
   - SuperSlicer is a cross-platform 3D-print slicer. Its main job is to ingest 3D models and printer settings, run geometric processing and print planning, then emit **G-code** for FFF printers or **PNG layer images / SLA archives** for resin workflows.

2. **Primary runtime boundaries**
   - The codebase splits into a **core slicing library** (`src/libslic3r`) and a **desktop application layer** (`src/slic3r`), with the README explicitly noting that the command-line interface is a thin wrapper over the core library.
   - `src/PrusaSlicer.cpp` and related app files provide the executable entry points; the GUI is the largest front-end surface.

3. **Core processing pipeline**
   - The central data flow is: **model import → geometry cleanup/repair → slicing → per-layer feature generation → toolpath planning → output serialization**.
   - `libslic3r` owns the model, print, layer, support, infill, and G-code generation stages, so most architecture diagrams should place it at the center.

4. **Geometry and computational core**
   - `src/libslic3r/Geometry`, `TriangleMesh`, `MeshBoolean`, `Slicing`, `PerimeterGenerator`, `Fill`, `Support`, and related modules implement the geometry-heavy stages.
   - This layer depends on bundled geometry/math libraries such as **CGAL, Eigen, libigl, Clipper, libnest2d, OpenVDB, and TBB** for boolean ops, triangulation, offsets, voxel/mesh operations, parallel execution, and nesting/arrangement.

5. **Import/export and file format layer**
   - `src/libslic3r/Format` handles model and project formats such as **STL, OBJ, AMF, 3MF, STEP**, plus SLA-specific archive formats like **SL1/CWS/HFP/AnycubicSLA/BBConfig**.
   - This layer is the boundary between external files and internal model objects, and it also wraps archive read/write and compression logic.

6. **FFF toolpath and G-code generation**
   - The FFF pipeline is concentrated in `src/libslic3r/GCode`, `Print*`, `Layer*`, `Extrusion*`, `Flow`, `BridgeDetector`, `Brim`, `WipeTower`, `CustomGCode`, and `GCodeWriter`.
   - Important output-side transformations include retraction, seam placement, cooling, travel optimization, pressure/arc-related processing, multi-extruder ordering, and post-processing script hooks.

7. **SLA / resin pipeline**
   - SLA support is a separate branch within `libslic3r`, centered on `src/libslic3r/SLA` and `SLAPrint*`.
   - It includes hollowing, support tree generation, rasterization, pad generation, and conversion into printer-specific SLA archives and layer images.

8. **Arrangement and print-bed planning**
   - Object placement is handled by `src/libslic3r/Arrange`, `ModelArrange`, `Arrange.cpp`, and `libnest2d` integration.
   - This subsystem computes print-bed layouts, packing strategies, and “no-fit polygon” style constraints before slicing, so it sits upstream of print planning.

9. **GUI and interactive editing**
   - `src/slic3r/GUI` contains the desktop front-end: plater, 3D scene, object list, presets, calibration dialogs, viewers, gizmos, and OpenGL shader management.
   - The GUI reads and mutates the same core model/preset structures as the backend, but it also owns interaction state, preview rendering, and user-driven edits like move/rotate/scale, supports, seam painting, hollowing, embossing, and cut tools.

10. **Background jobs and threading model**
   - Long-running tasks are pushed into `src/slic3r/GUI/Jobs` and core threading utilities in `src/libslic3r/Thread`, `Execution`, and `MTUtils`.
   - This forms a clear boundary between UI responsiveness and heavy geometry/slicing work, with worker jobs for arrange, slice, import, orient, emboss, fill-bed, and optimization tasks.

11. **Printer and network integrations**
   - `src/slic3r/Utils` contains integrations for printer hosts and device protocols such as **OctoPrint, Moonraker, Duet, Klipper, Repetier, AstroBox, MKS, FlashAir**, plus serial/TCP utilities and firmware-related helpers.
   - These are outbound communication adapters, separate from slicing itself, used for remote print management, uploads, and device discovery.

12. **Resources and configuration assets**
   - `resources/` contains bundled calibration models, printer profiles, UI layouts, icons, fonts, shaders, localization files, and sample shapes.
   - These assets are not just presentation data; they materially shape startup defaults, localization, built-in calibration workflows, and rendering behavior.

13. **Build and packaging architecture**
   - The project is heavily CMake-driven (`CMakeLists.txt`, presets, platform scripts, GitHub Actions) and ships with many vendored third-party dependencies in `src/` and `deps/`.
   - Platform-specific packaging lives under `src/platform` and the repo root scripts, which is important for understanding that the application is designed as a standalone native desktop product on Windows, macOS, and Linux.

14. **Validation and experimentation surface**
   - `tests/` is broad and split by domain: libslic3r, FFF print generation, SLA printing, arrangement, thumbnails, and utility behavior.
   - `sandboxes/` contains isolated experimental binaries for geometry and rendering subsystems, which indicates several algorithms are developed and evaluated outside the main application flow before being integrated.

Main entry points: [`src/libslic3r`](https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r) (libslic3r), [`src/slic3r/GUI`](https://github.com/supermerill/superslicer/tree/master_27/src/slic3r/GUI) (GUI), [`src/slic3r/GUI/Jobs`](https://github.com/supermerill/superslicer/tree/master_27/src/slic3r/GUI/Jobs) (Jobs), [`sandboxes`](https://github.com/supermerill/superslicer/tree/master_27/sandboxes) (Sandboxes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core slicing"]
  node_corelib["libslic3r<br/>slicing library"]
  node_model["Model<br/>scene data<br/>[Model.cpp]"]
  node_arrange["Arrange<br/>bed packing"]
  node_geometry["Geometry"]
  node_mesh["Meshes<br/>mesh ops<br/>[TriangleMesh.cpp]"]
  node_formats["Formats"]
  node_slice["Slicing<br/>layer generation<br/>[Slicing.cpp]"]
  node_fff["FFF path<br/>toolpath pipeline"]
  node_sla["SLA path<br/>resin pipeline"]
  node_print["Print graph<br/>print planning<br/>[Print.cpp]"]
  node_presets["Presets<br/>config state<br/>[PresetBundle.cpp]"]
  node_threading(("Threading<br/>parallel runtime<br/>[Thread.cpp]"))
end

subgraph group_app["Desktop app"]
  node_entry["App entry<br/>executable entry<br/>[PrusaSlicer.cpp]"]
  node_gui["GUI<br/>desktop frontend"]
  node_jobs["Jobs<br/>background tasks"]
end

subgraph group_platform["Integrations"]
  node_utils["Utils<br/>host adapters"]
  node_platform["Platform<br/>[Platform.cpp]"]
end

subgraph group_assets["Resources"]
  node_resources[("Resources<br/>bundled assets")]
end

subgraph group_quality["Validation"]
  node_tests["Tests<br/>validation suite"]
  node_sandboxes["Sandboxes<br/>experiments"]
end

node_entry -->|"launches"| node_gui
node_gui -->|"drives"| node_corelib
node_gui -->|"dispatches"| node_jobs
node_gui -->|"edits"| node_presets
node_gui -->|"uses"| node_utils
node_jobs -->|"runs on"| node_threading
node_jobs -->|"invokes"| node_corelib
node_corelib -->|"owns"| node_model
node_corelib -->|"includes"| node_arrange
node_corelib -->|"depends on"| node_geometry
node_corelib -->|"depends on"| node_mesh
node_corelib -->|"imports/exports"| node_formats
node_corelib -->|"executes"| node_slice
node_corelib -->|"emits"| node_fff
node_corelib -->|"emits"| node_sla
node_corelib -->|"coordinates"| node_print
node_corelib -->|"configures"| node_presets
node_corelib -->|"parallelizes"| node_threading
node_corelib -->|"adapts to"| node_platform
node_utils -->|"loads"| node_resources
node_gui -->|"renders with"| node_resources
node_tests -->|"verifies"| node_corelib
node_sandboxes -->|"probes"| node_geometry
node_sandboxes -.->|"prototype for"| node_corelib

click node_entry "https://github.com/supermerill/superslicer/blob/master_27/src/PrusaSlicer.cpp"
click node_gui "https://github.com/supermerill/superslicer/tree/master_27/src/slic3r/GUI"
click node_jobs "https://github.com/supermerill/superslicer/tree/master_27/src/slic3r/GUI/Jobs"
click node_utils "https://github.com/supermerill/superslicer/tree/master_27/src/slic3r/Utils"
click node_corelib "https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r"
click node_model "https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/Model.cpp"
click node_arrange "https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r/Arrange"
click node_geometry "https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r/Geometry"
click node_mesh "https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/TriangleMesh.cpp"
click node_formats "https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r/Format"
click node_slice "https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/Slicing.cpp"
click node_fff "https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r/GCode"
click node_sla "https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r/SLA"
click node_print "https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/Print.cpp"
click node_presets "https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/PresetBundle.cpp"
click node_threading "https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/Thread.cpp"
click node_platform "https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/Platform.cpp"
click node_resources "https://github.com/supermerill/superslicer/tree/master_27/resources"
click node_tests "https://github.com/supermerill/superslicer/tree/master_27/tests"
click node_sandboxes "https://github.com/supermerill/superslicer/tree/master_27/sandboxes"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_corelib,node_model,node_arrange,node_geometry,node_mesh,node_formats,node_slice,node_fff,node_sla,node_print,node_presets,node_threading toneBlue
class node_entry,node_gui,node_jobs toneAmber
class node_utils,node_platform toneMint
class node_resources toneRose
class node_tests,node_sandboxes toneIndigo
```

## Components

### Core slicing

Backend model, geometry, slicing, and output generation.

- [libslic3r](https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r): slicing library · Core model, geometry, slicing, and print-generation library. · `src/libslic3r`
- [Model](https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/Model.cpp): scene data · 3D model, object, and print-structure representation. · `src/libslic3r/Model.cpp`
- [Arrange](https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r/Arrange): bed packing · Object placement, no-fit polygons, and print-bed planning. · `src/libslic3r/Arrange`
- [Geometry](https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r/Geometry): computational geometry · 2D/3D geometry primitives, curves, and derived helpers. · `src/libslic3r/Geometry`
- [Meshes](https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/TriangleMesh.cpp): mesh ops · Triangle meshes, booleans, slicing helpers, and mesh repair. · `src/libslic3r/TriangleMesh.cpp`
- [Formats](https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r/Format): io formats · Model, project, and SLA archive import/export formats. · `src/libslic3r/Format`
- [Slicing](https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/Slicing.cpp): layer generation · Layer creation, print regions, perimeters, and support prep. · `src/libslic3r/Slicing.cpp`
- [FFF path](https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r/GCode): toolpath pipeline · Per-layer extrusion planning and G-code generation for filament printers. · `src/libslic3r/GCode`
- [SLA path](https://github.com/supermerill/superslicer/tree/master_27/src/libslic3r/SLA): resin pipeline · Resin slicing, support trees, rasterization, and archive output. · `src/libslic3r/SLA`
- [Print graph](https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/Print.cpp): print planning · Print, object, layer, and region orchestration across toolpaths. · `src/libslic3r/Print.cpp`
- [Presets](https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/PresetBundle.cpp): config state · Printer, filament, and print preset state and merging. · `src/libslic3r/PresetBundle.cpp`
- [Threading](https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/Thread.cpp): parallel runtime · Execution helpers and shared threading utilities. · `src/libslic3r/Thread.cpp`

### Desktop app

GUI, jobs, and executable entry points.

- [App entry](https://github.com/supermerill/superslicer/blob/master_27/src/PrusaSlicer.cpp): executable entry · Desktop executable startup and app bootstrap. · `src/PrusaSlicer.cpp`
- [GUI](https://github.com/supermerill/superslicer/tree/master_27/src/slic3r/GUI): desktop frontend · Main interactive application shell and user workflow surface. · `src/slic3r/GUI`
- [Jobs](https://github.com/supermerill/superslicer/tree/master_27/src/slic3r/GUI/Jobs): background tasks · Asynchronous workers for arrange, slice, import, orient, and optimization tasks. · `src/slic3r/GUI/Jobs`

### Integrations

Printer hosts, platform glue, and runtime utilities.

- [Utils](https://github.com/supermerill/superslicer/tree/master_27/src/slic3r/Utils): host adapters · Printer-host, device, networking, and OS utility integrations. · `src/slic3r/Utils`
- [Platform](https://github.com/supermerill/superslicer/blob/master_27/src/libslic3r/Platform.cpp): app platform · Platform abstractions and OS-specific behavior. · `src/libslic3r/Platform.cpp`

### Resources

Bundled models, profiles, shaders, and localization assets.

- [Resources](https://github.com/supermerill/superslicer/tree/master_27/resources): bundled assets · Calibration models, profiles, shaders, icons, and translations. · `resources`

### Validation

Tests and experimental sandboxes.

- [Tests](https://github.com/supermerill/superslicer/tree/master_27/tests): validation suite · Domain-focused unit and integration tests. · `tests`
- [Sandboxes](https://github.com/supermerill/superslicer/tree/master_27/sandboxes): experiments · Isolated experimental binaries for geometry and rendering subsystems. · `sandboxes`

## Connections

- App entry → GUI: launches · Executable starts the desktop application.
- GUI → libslic3r: drives · GUI reads and mutates core slicing state.
- GUI → Jobs: dispatches · Long-running UI actions are moved into background jobs.
- GUI → Presets: edits · Interface manages preset and configuration state.
- GUI → Utils: uses · Front-end uses host/device integrations.
- Jobs → Threading: runs on · Background jobs rely on shared threading helpers.
- Jobs → libslic3r: invokes · Jobs execute arrange, import, slice, and optimize work.
- libslic3r → Model: owns · Core library defines the internal scene and print model.
- libslic3r → Arrange: includes · Placement and packing are part of the backend pipeline.
- libslic3r → Geometry: depends on · Geometry is a foundational backend subsystem.
- libslic3r → Meshes: depends on · Mesh cleanup, booleans, and slicing feed the pipeline.
- libslic3r → Formats: imports/exports · File formats bridge external files and internal objects.
- libslic3r → Slicing: executes · Slicing transforms models into layered print data.
- libslic3r → FFF path: emits · FFF pipeline serializes toolpaths to G-code.
- libslic3r → SLA path: emits · SLA pipeline emits resin layers and archives.
- libslic3r → Print graph: coordinates · Print objects and regions organize the slicing workflow.
- libslic3r → Presets: configures · Preset data shapes print behavior and defaults.
- libslic3r → Threading: parallelizes · Heavy geometry and slicing work use parallel execution utilities.
- libslic3r → Platform: adapts to · Core code is wrapped in platform abstractions.
- Utils → Resources: loads · Host features and UI flows rely on bundled assets.
- GUI → Resources: renders with · UI uses bundled shaders, icons, layouts, and localization.
- Tests → libslic3r: verifies · Domain tests cover core geometry, slicing, and output behavior.
- Sandboxes → Geometry: probes · Experimental binaries explore geometry and rendering algorithms.
- Sandboxes → libslic3r: prototype for · Some sandboxed work feeds into the main backend over time.
