- Fix support clipping z-shift calculation by removing coordinate-space mismatch and sync belt_floor_z_shift with global_z_offset; fix invalidation so posSupportMaterial no longer resets slicing params - Add belt floor polygon clipping to non-organic tree support (slim/strong/hybrid) with collision surface integration in TreeSupportData, belt extension layers, and first-layer brim suppression - Add belt floor clipping to organic tree support pipeline with virtual belt raft layers, per-layer polygons in TreeModelVolumes, and post-generation layer trimming; fix pre-existing processing_last_mesh bug in calculateCollision() Fix belt floor support clipping: z-shift, invalidation, and global offset - Fix support clipping z-shift calculation by removing coordinate-space mismatch (raw_bounding_box min.z vs trafo_centered m_belt_min_z) and sync belt_floor_z_shift with global_z_offset in global shear mode - Fix invalidation so posSupportMaterial no longer resets slicing params, preventing the exact posSlice z-shift from being overwritten by the bounding-box approximation on support-only setting changes - Remove double-counting of global z_offset on support layers — support already inherits the offset from object layers during generation This Work Was Co-Authored-By Claude Opus 4.6 (1M context) <noreply@anthropic.com> UI: gray out inactive belt sub-options, rename to mesh transforms, move to Advanced Fix mesh clipping through build plate after belt shear/scale transform Generalize G-code viewer designed-view toggle for full belt transform Clip support layers to transformed belt floor plane Supports below the tilted build plate (Z = shear_factor * from_axis - min_z) are now clipped via half-plane intersection after generation. Belt floor parameters stored in SlicingParameters and populated in both update_slicing_parameters() and the static slicing_parameters() overload. Make belt G-code viewer toggle more prominent, add B keyboard shortcut - Add separator + teal "Belt Printer" header in legend panel - Append [B] hint to checkbox label - Add B key shortcut in GLCanvas3D to toggle designed/machine view - Read belt_printer_angle from loaded G-code headers to enable belt view Add per-axis global transform option for belt printer shear New belt_shear_{x,y,z}_global bool configs. When enabled, shear incorporates instance shift so objects at different bed positions get position-aware transform (Z += factor * instance_shift_on_from_axis). Fix global shear: use layer Z offset instead of mesh transform, add config invalidation - Global shear offset applied as post-slicing layer print_z adjustment instead of mesh transform (which was absorbed by min_z normalization or shifted mesh out of slice range) - Register all belt transform options in Print::invalidate_state_by_config_options to trigger posSlice re-slicing (the fallback only invalidated Print steps, not PrintObject steps — belt changes had no effect without manual re-slice) - Belt gcode remap options added to steps_gcode (gcode-export only) - Skip empty-first-layer check for belt objects with global Z offset WIP: split instances for global shear, relative Z offsets, debug logging - PrintApply: when belt global mode active, prevent instance grouping by adding unique Z perturbation to trafo — each copy becomes its own PrintObject with independent layers - PrintObjectSlice: compute global Z offset relative to minimum Y shift across all PrintObjects (lowest-Y object stays at Z=0) - Debug logging (warning level) for belt global shift values and offsets Known issues: - Cached posSlice results cause stale offsets when mixing copies with individually-added objects — need to compute min baseline outside slice() - Supports still generate to Z=0 instead of object's global Z offset Fix global shear for copied objects: disable shared-object layer optimization When belt global Z shear is active, each object needs unique layer Z values based on its bed position. The shared-object optimization was causing copies to reuse the source object's layers (and its Z offset) instead of computing their own position-based offset. started work on getting supports to work properly one step forward, one step back this version didn't quite work. Getting somewhere though about to add UI controllable tests added configuration options for supports tweak CLAUDE.md to be more aggressive for my machine. This commit should probably be pulled out before contributing upstream still chasing down some bugs moving objects between slices no longer results in improper Z-height because of caching added more data to the debug logs Z offset is getting more global again still not quite there, I think there's a fundamental logic flaw? hunting for bugs finally have a functional fix Add belt floor clipping to tree supports (organic and non-organic) - Add belt floor polygon clipping to non-organic tree support (slim/strong/hybrid) in draw_circles() and terminate nodes at the belt surface instead of the horizontal build plate - Add belt floor clipping to organic tree support pipeline with virtual belt raft layers for sub-floor branch generation, per-layer belt floor polygons in TreeModelVolumes, and post-generation layer trimming - Fix pre-existing processing_last_mesh bug in TreeModelVolumes that prevented m_anti_overhang (support blockers) from ever being applied; skip empty first layer check for belt printers Commits: current approach: make a face surface to build supports to closer! supports now terminate on shear plane, now need to get shear plane to correct Z height nearly there chasing down logic issues still committing for checkpoint, this still does not work still got logic problems... cull support clipping stashing changes for now. Going to focus on getting the global shear OFF support generation dialed first. beginning per object shear calcs Local shear transform is on correct Z offset now local shear finally works now and needs more testing global shear works now, needs thorough testing debugging non-45 degree angles debugging part 2 supports at all angles work now remove debug logging Add belt floor collision to non-organic tree support pipeline - Integrate belt floor as a collision surface in TreeSupportData so branches route around the belt naturally, replacing the explicit termination checks in drop_nodes() - Add belt extension layers below the object after draw_circles() to allow support geometry to extend to the diagonal belt surface instead of terminating at a horizontal first layer - Fix coordinate overflow in belt floor polygons (scale_(1e4) exceeds int32), skip first-layer brim expansion for belt printers, and extend empty first layer check bypass to all belt modes add debug logging, Z translate for tree supports still not seeing any cutoff surface yet adding debug options attempt #2 at trees if hit Z buildplate stop but don't set to_buildplate true getting closer tree support almost there, just need to get rid of the circles at the beginning getting closer belt / shear plane clip works, need to figure out the buidlplate plane issues more logic, added debugging logs supports now extend somewhat below Z=0 in global shear mode fix bad alloc, add 10mm below build plate fully works now shear transform + prusa tree support generation works now. pull out debug logging
9.1 KiB
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Overview
OrcaSlicer is an open-source 3D slicer application forked from Bambu Studio, built using C++ with wxWidgets for the GUI and CMake as the build system. The project uses a modular architecture with separate libraries for core slicing functionality, GUI components, and platform-specific code.
Build Commands
Building on Windows
Always use this command to build the project when testing build issues on Windows.
cmake --build . --config %build_type% --target ALL_BUILD -- -m
Building on macOS
Always use this command to build the project when testing build issues on macOS.
cmake --build build/arm64 --config RelWithDebInfo --target all --
Building on Linux
Always use this command to build the project when testing build issues on Linux.
systemd-run --user --scope -p MemoryMax=48G cmake --build build --config RelWithDebInfo --target all -- -j18 -l 24
Build System
- Uses CMake with minimum version 3.13 (maximum 3.31.x on Windows)
- Primary build directory:
build/ - Dependencies are built in
deps/build/ - The build process is split into dependency building and main application building
- Windows builds use Visual Studio generators
- macOS builds use Xcode by default, Ninja with -x flag
- Linux builds use Ninja generator
Testing
Tests are located in the tests/ directory and use the Catch2 testing framework. Test structure:
tests/libslic3r/- Core library tests (21 test files)- Geometry processing, algorithms, file formats (STL, 3MF, AMF)
- Polygon operations, clipper utilities, Voronoi diagrams
tests/fff_print/- Fused Filament Fabrication tests (12 test files)- Slicing algorithms, G-code generation, print mechanics
- Fill patterns, extrusion, support material
tests/sla_print/- Stereolithography tests (4 test files)- SLA-specific printing algorithms, support generation
tests/libnest2d/- 2D nesting algorithm teststests/slic3rutils/- Utility function teststests/sandboxes/- Experimental/sandbox test code
Run all tests after building:
cd build && ctest
Run tests with verbose output:
cd build && ctest --output-on-failure
Run individual test suites:
# From build directory
ctest --test-dir ./tests/libslic3r/libslic3r_tests
ctest --test-dir ./tests/fff_print/fff_print_tests
ctest --test-dir ./tests/sla_print/sla_print_tests
# and so on
Architecture
Core Libraries
-
libslic3r/: Core slicing engine and algorithms (platform-independent)
- Main slicing logic, geometry processing, G-code generation
- Key classes: Print, PrintObject, Layer, GCode, Config
- Modular design with specialized subdirectories:
GCode/- G-code generation, cooling, pressure equalization, thumbnailsFill/- Infill pattern implementations (gyroid, honeycomb, lightning, etc.)Support/- Tree supports and traditional support generationGeometry/- Advanced geometry operations, Voronoi diagrams, medial axisFormat/- File I/O for 3MF, AMF, STL, OBJ, STEP formatsSLA/- SLA-specific print processing and support generationArachne/- Advanced wall generation using skeletal trapezoidation
-
src/slic3r/: Main application framework and GUI
- GUI application built with wxWidgets
- Integration between libslic3r core and user interface
- Located in
src/slic3r/GUI/(not shown in this directory but exists)
Key Algorithmic Components
- Arachne Wall Generation: Variable-width perimeter generation using skeletal trapezoidation
- Tree Supports: Organic support generation algorithm
- Lightning Infill: Sparse infill optimization for internal structures
- Adaptive Slicing: Variable layer height based on geometry
- Multi-material: Multi-extruder and soluble support processing
- G-code Post-processing: Cooling, fan control, pressure advance, conflict checking
File Format Support
- 3MF/BBS_3MF: Native format with extensions for multi-material and metadata
- STL: Standard tessellation language for 3D models
- AMF: Additive Manufacturing Format with color/material support
- OBJ: Wavefront OBJ with material definitions
- STEP: CAD format support for precise geometry
- G-code: Output format with extensive post-processing capabilities
External Dependencies
- Clipper2: Advanced 2D polygon clipping and offsetting
- libigl: Computational geometry library for mesh operations
- TBB: Intel Threading Building Blocks for parallelization
- wxWidgets: Cross-platform GUI framework
- OpenGL: 3D graphics rendering and visualization
- CGAL: Computational Geometry Algorithms Library (selective use)
- OpenVDB: Volumetric data structures for advanced operations
- Eigen: Linear algebra library for mathematical operations
File Organization
Resources and Configuration
resources/profiles/- Printer and material profiles organized by manufacturerresources/printers/- Printer-specific configurations and G-code templatesresources/images/- UI icons, logos, calibration imagesresources/calib/- Calibration test patterns and dataresources/handy_models/- Built-in test models (benchy, calibration cubes)
Internationalization and Localization
localization/i18n/- Source translation files (.pot, .po)resources/i18n/- Runtime language resources- Translation managed via
scripts/run_gettext.sh/scripts/run_gettext.bat
Platform-Specific Code
src/libslic3r/Platform.cpp- Platform abstractions and utilitiessrc/libslic3r/MacUtils.mm- macOS-specific utilities (Objective-C++)- Windows-specific build scripts and configurations
- Linux distribution support scripts in
scripts/linux.d/
Build and Development Tools
cmake/modules/- Custom CMake find modules and utilitiesscripts/- Python utilities for profile generation and validationtools/- Windows build tools (gettext utilities)deps/- External dependency build configurations
Development Workflow
Code Style and Standards
- C++17 standard with selective C++20 features
- Naming conventions: PascalCase for classes, snake_case for functions/variables
- Header guards: Use
#pragma once - Memory management: Prefer smart pointers, RAII patterns
- Thread safety: Use TBB for parallelization, be mindful of shared state
Common Development Tasks
Adding New Print Settings
- Define setting in
PrintConfig.cppwith proper bounds and defaults - Add UI controls in appropriate GUI components
- Update serialization in config save/load
- Add tooltips and help text for user guidance
- Test with different printer profiles
Modifying Slicing Algorithms
- Core algorithms live in
libslic3r/subdirectories - Performance-critical code should be profiled and optimized
- Consider multi-threading implications (TBB integration)
- Validate changes don't break existing profiles
- Add regression tests where appropriate
GUI Development
- GUI code resides in
src/slic3r/GUI/(not visible in current tree) - Use existing wxWidgets patterns and custom controls
- Support both light and dark themes
- Consider DPI scaling on high-resolution displays
- Maintain cross-platform compatibility
Adding Printer Support
- Create JSON profile in
resources/profiles/[manufacturer].json - Add printer-specific start/end G-code templates
- Configure build volume, capabilities, and material compatibility
- Test thoroughly with actual hardware when possible
- Follow existing profile structure and naming conventions
Dependencies and Build System
- CMake-based with separate dependency building phase
- Dependencies built once in
deps/build/, then linked to main application - Cross-platform considerations important for all changes
- Resource files embedded at build time, platform-specific handling
Performance Considerations
- Slicing algorithms are CPU-intensive, profile before optimizing
- Memory usage can be substantial with complex models
- Multi-threading extensively used via TBB
- File I/O optimized for large 3MF files with embedded textures
- Real-time preview requires efficient mesh processing
Important Development Notes
Codebase Navigation
- Use search tools extensively - codebase has 500k+ lines
- Key entry points:
src/OrcaSlicer.cppfor application startup - Core slicing:
libslic3r/Print.cpporchestrates the slicing pipeline - Configuration:
PrintConfig.cppdefines all print/printer/material settings
Compatibility and Stability
- Backward compatibility maintained for project files and profiles
- Cross-platform support essential (Windows/macOS/Linux)
- File format changes require careful version handling
- Profile migrations needed when settings change significantly
Quality and Testing
- Regression testing important due to algorithm complexity
- Performance benchmarks help catch performance regressions
- Memory leak detection important for long-running GUI application
- Cross-platform testing required before releases