-
Notifications
You must be signed in to change notification settings - Fork 0
Architecture
An overview of BambuStudio's project structure, key subsystems, and how this fork extends the upstream codebase.
BambuStudio/
├── src/
│ ├── libslic3r/ # Core slicing engine (C++)
│ │ ├── Print.cpp/hpp # Print object — orchestrates slicing
│ │ ├── GCode/ # G-code generation
│ │ ├── Fill/ # Infill pattern generators
│ │ ├── Support/ # Support structure generation
│ │ └── Geometry/ # Computational geometry primitives
│ └── slic3r/
│ └── GUI/ # wxWidgets UI layer
│ ├── MainFrame.cpp/hpp # Main application window
│ ├── GUI_App.cpp/hpp # wxApp subclass, lifecycle
│ ├── Plater.cpp/hpp # 3D plate editor
│ ├── GLCanvas3D.* # OpenGL 3D viewport
│ └── GUI_Utils.* # Shared UI utilities
├── deps/ # Vendored C++ dependencies
│ └── CMakeLists.txt # Dependency build definitions
├── flatpak/ # Flatpak packaging manifest
├── scripts/ # RPM, AUR, Arch packaging scripts
├── .github/
│ ├── workflows/ # All CI/CD workflows
│ ├── ISSUE_TEMPLATE/ # Bug/feature/crash templates
│ ├── CODEOWNERS # Auto-review assignments
│ ├── dependabot.yml # Dependency update config
│ └── PULL_REQUEST_TEMPLATE.md
├── BuildLinux.sh # Unified Linux build script
├── version.inc # Version definition (CMake)
└── CMakeLists.txt # Root build definition
Slic3r (AGPL-3.0)
└── PrusaSlicer (Prusa Research, AGPL-3.0)
└── BambuStudio (Bambu Lab, AGPL-3.0)
└── BenJule/BambuStudio (this fork, AGPL-3.0)
This fork stays close to bambulab/BambuStudio upstream. Fork-specific changes are minimal, surgical fixes focused on Linux support and CI/CD.
The slicing engine is pure C++ with no UI dependency. It is used both by the GUI and can be driven from the CLI via bambu-studio --slice.
Key classes:
| Class | Responsibility |
|---|---|
Print |
Top-level slicing coordinator |
PrintObject |
Per-object slicing state |
GCode |
G-code generator |
TriangleMesh |
3D mesh representation |
ExPolygon |
2D polygon with holes |
Fill* |
Infill pattern implementations |
SupportMaterial |
Support generation |
Built on wxWidgets with OpenGL for the 3D viewport.
| Component | Description |
|---|---|
GUI_App |
Application lifecycle, splash screen, preferences |
MainFrame |
Main window frame, layout management |
Plater |
The central editor: 3D view + object list + sidebar |
GLCanvas3D |
OpenGL rendering canvas |
Tab |
Print/filament/printer settings tabs |
NotificationManager |
Toast notifications |
MainFrame::MainFrame() was updated to work correctly on Wayland compositors:
-
SetSizerAndFit()→SetSizer()(avoids implicitFit()before window realization) -
SetSizeHints()deferred toon_window_geometry()(wxEVT_SHOW+CallAfter) so the GTK window is realized before anygtk_window_resizecall -
SetSize()/SetMinSize()remain synchronous (explicit positive values are safe before realization) - A
shared_ptr<bool>guard ensures the deferred callback fires only once even thoughon_window_geometrydoes not unbind on Linux
Relevant file: src/slic3r/GUI/MainFrame.cpp
BambuStudio uses CMake with a two-stage build:
./BuildLinux.sh -d # build deps into deps/build/destdir/Dependencies are built from source and installed into a local prefix (deps/build/destdir). This avoids dependency on system libraries (other than basic system libs).
Key dependencies: Boost, CGAL, OpenSSL, wxWidgets, OpenGL, GLEW, TBB, nlohmann/json, and others.
The deps build is cached in CI keyed on deps/CMakeLists.txt and all deps/**/*.cmake files.
./BuildLinux.sh -s # configure and build BambuStudioCMake finds the deps prefix via CMAKE_PREFIX_PATH set by BuildLinux.sh. The build produces:
-
build/src/bambu-studio— the main binary -
build/src/BuildLinuxImage.sh— packages the AppImage
In the Debian CI job, ccache intercepts GCC calls via /usr/lib/ccache symlinks on PATH. This does not require any CMake flag — it works transparently. See CI-CD-Workflows#ccache-in-debian-build for details.
BuildLinux.sh -p calls dpkg-deb to build a .deb from the installed tree. Package metadata is in scripts/debian/.
scripts/build_rpm.sh generates an RPM spec and calls rpmbuild.
build/src/BuildLinuxImage.sh uses appimagetool to wrap the binary and its dependencies into a self-contained .AppImage.
flatpak/com.bambulab.BambuStudio.yaml defines the Flatpak manifest. Built and submitted by cd-deploy-flatpak.yml post-release.
User clicks "Slice" in Plater
→ PrintJob created with current settings
→ libslic3r::Print::process()
→ TriangleMesh analysis
→ Layer generation
→ Perimeter/infill computation
→ Support generation
→ G-code output
→ G-code file written to disk
→ Preview updated in UI
User clicks "Print"
→ BambuNetworkPlugin checks printer availability
→ File transferred via MQTT/FTP to printer
→ Print status polled and displayed in Monitoring panel
User configuration is stored in:
| Platform | Path |
|---|---|
| Linux | ~/.config/BambuStudio/ |
| macOS | ~/Library/Application Support/BambuStudio/ |
| Windows | %APPDATA%\BambuStudio\ |
Key files: app_config.ini (general settings), user_presets/ (saved profiles).