From 441113cf3b99f829c814ff910762ce84a3ab105b Mon Sep 17 00:00:00 2001 From: harrierpigeon Date: Wed, 7 Oct 2026 16:09:26 -0500 Subject: [PATCH] Belt: remove dead code belt_remapped_bbox() had no callers; belt_min_z() and m_belt_global_xy_correction were written but never read; LayerTools::has_belt_brim was set but never read; belt_surface_z was a named zero. Co-Authored-By: Claude Fable 5.1 --- src/libslic3r/GCode/ToolOrdering.cpp | 2 -- src/libslic3r/GCode/ToolOrdering.hpp | 4 ---- src/libslic3r/Print.hpp | 10 ---------- src/libslic3r/PrintObjectSlice.cpp | 7 ++----- 4 files changed, 2 insertions(+), 21 deletions(-) diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index 979371e304..f61587d562 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -1023,7 +1023,6 @@ void ToolOrdering::collect_extruders(const PrintObject &object, const std::vecto continue; LayerTools &layer_tools = this->tools_for_layer(band.print_z); layer_tools.extruders.push_back(brim_filament); - layer_tools.has_belt_brim = true; } } @@ -1042,7 +1041,6 @@ void ToolOrdering::collect_extruders(const PrintObject &object, const std::vecto continue; LayerTools &layer_tools = this->tools_for_layer(object.layers()[i]->print_z); layer_tools.extruders.push_back(brim_filament); - layer_tools.has_belt_brim = true; } } diff --git a/src/libslic3r/GCode/ToolOrdering.hpp b/src/libslic3r/GCode/ToolOrdering.hpp index 3d42457e1a..5c11f482cd 100644 --- a/src/libslic3r/GCode/ToolOrdering.hpp +++ b/src/libslic3r/GCode/ToolOrdering.hpp @@ -179,10 +179,6 @@ public: // Should a skirt be printed at this layer? // Layers are marked for infinite skirt aka draft shield. Not all the layers have to be printed. bool has_skirt = false; - // Belt printers: is this one of the brim-only apron layers below the object's - // first layer? Kept separate from has_object so skirt marking and wiping - // overrides are unaffected. - bool has_belt_brim = false; // Will there be anything extruded on this layer for the wipe tower? // Due to the support layers possibly interleaving the object layers, // wipe tower will be disabled for some support only layers. diff --git a/src/libslic3r/Print.hpp b/src/libslic3r/Print.hpp index f60f6b4e19..c726f7b79f 100644 --- a/src/libslic3r/Print.hpp +++ b/src/libslic3r/Print.hpp @@ -231,12 +231,6 @@ class ConstSupportLayerPtrsAdaptor : public ConstVectorOfPtrsAdaptor(data) {} }; -// The model's raw bounding box, in the frame the belt floor parameters refer to. -inline BoundingBoxf3 belt_remapped_bbox(const ModelObject &model_object, const PrintConfig & /*config*/) -{ - return model_object.raw_bounding_box(); -} - // Single instance of a PrintObject. // As multiple PrintObjects may be generated for a single ModelObject (their instances differ in rotation around Z), // ModelObject's instancess will be distributed among these multiple PrintObjects. @@ -721,8 +715,6 @@ private: bool m_belt_brim_pending { false }; // Belt printer: min_z of mesh after belt shear (before Z-shift), for z_offset calc. double m_belt_min_z { 0.0 }; - // Belt printer: XY correction from global pre-slice mode, applied to G-code origin. - Vec2d m_belt_global_xy_correction { Vec2d::Zero() }; // Belt printer: exact belt_floor_z_shift computed during posSlice from a // vertex-level scan of the post-transform mesh. Cached separately from // m_slicing_params so that rebuilding m_slicing_params on a non-belt-affecting @@ -733,8 +725,6 @@ private: bool m_belt_floor_z_shift_cache_valid { false }; public: double belt_global_z_offset() const { return m_belt_global_z_offset; } - double belt_min_z() const { return m_belt_min_z; } - Vec2d belt_global_xy_correction() const { return m_belt_global_xy_correction; } private: diff --git a/src/libslic3r/PrintObjectSlice.cpp b/src/libslic3r/PrintObjectSlice.cpp index 5f70887c9c..06e71a60b3 100644 --- a/src/libslic3r/PrintObjectSlice.cpp +++ b/src/libslic3r/PrintObjectSlice.cpp @@ -902,7 +902,6 @@ void PrintObject::slice() // them. m_belt_min_z = 0.; m_belt_global_z_offset = 0.; - m_belt_global_xy_correction = Vec2d::Zero(); this->clear_layers(); m_layers = new_layers(this, generate_object_layers(m_slicing_params, layer_height_profile, m_config.precise_z_height.value)); this->slice_volumes(); @@ -995,7 +994,6 @@ void PrintObject::slice() // couples slicer_z back into both machine_y and machine_z. Compensating // layer.print_z by belt_z_shift here makes the back-transform produce // correct machine-frame coordinates whether or not a global mode is active. - const double belt_surface_z = 0.; // the belt surface is Z=0 in centered slicer space // The compensation must mirror the Z-shift actually applied, which // is max(0, -m_belt_min_z): when the transformed mesh starts ABOVE // slicer Z=0 (m_belt_min_z > 0 — possible for counter-rotated or @@ -1003,7 +1001,7 @@ void PrintObject::slice() // no lift was applied, and an unclamped m_belt_min_z here would // leak straight into the layer Z values, floating the whole object // off the belt by exactly that amount. - double belt_z_shift = std::min(m_belt_min_z, 0.) - belt_surface_z; + double belt_z_shift = std::min(m_belt_min_z, 0.); // the belt surface is Z=0 in centered slicer space double global_z_offset = belt_z_shift; // Centering correction: trafo_centered pretranslates by @@ -1034,7 +1032,6 @@ void PrintObject::slice() Vec3d d(unscale(inst_shift.x()), unscale(inst_shift.y()), 0.); Vec3d c = T.linear() * d - d; global_z_offset += c.z(); - m_belt_global_xy_correction = Vec2d(c.x(), c.y()); BOOST_LOG_TRIVIAL(trace) << "Belt preslice_global: correction=(" << c.x() << ", " << c.y() << ", " << c.z() << ")" @@ -1042,7 +1039,7 @@ void PrintObject::slice() } BOOST_LOG_TRIVIAL(trace) << "Belt global: z_offset=" << global_z_offset - << " (relative to min across " << this->print()->objects().size() << " objects)"; + << " (" << this->print()->objects().size() << " objects on the plate)"; m_belt_global_z_offset = global_z_offset; if (std::abs(global_z_offset) > EPSILON) { for (Layer *layer : m_layers)