How supermerill/superslicer works
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: libslic3r libslic3r · GUI GUI · Jobs Jobs · sandboxes Sandboxes
Components 20
Core slicing
Backend model, geometry, slicing, and output generation.
- libslic3r · Core model, geometry, slicing, and print-generation library.
src/libslic3r - Model · 3D model, object, and print-structure representation.
src/libslic3r/Model.cpp - Arrange · Object placement, no-fit polygons, and print-bed planning.
src/libslic3r/Arrange - Geometry · 2D/3D geometry primitives, curves, and derived helpers.
src/libslic3r/Geometry - Meshes · Triangle meshes, booleans, slicing helpers, and mesh repair.
src/libslic3r/TriangleMesh.cpp - Formats · Model, project, and SLA archive import/export formats.
src/libslic3r/Format - Slicing · Layer creation, print regions, perimeters, and support prep.
src/libslic3r/Slicing.cpp - FFF path · Per-layer extrusion planning and G-code generation for filament printers.
src/libslic3r/GCode - SLA path · Resin slicing, support trees, rasterization, and archive output.
src/libslic3r/SLA - Print graph · Print, object, layer, and region orchestration across toolpaths.
src/libslic3r/Print.cpp - Presets · Printer, filament, and print preset state and merging.
src/libslic3r/PresetBundle.cpp - Threading · Execution helpers and shared threading utilities.
src/libslic3r/Thread.cpp
Desktop app
GUI, jobs, and executable entry points.
Integrations
Printer hosts, platform glue, and runtime utilities.
Resources
Bundled models, profiles, shaders, and localization assets.
- Resources · Calibration models, profiles, shaders, icons, and translations.
resources
Connections 24
- 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.