From a564ec23fe2a001cb9bfb63ecd196d44542c39a6 Mon Sep 17 00:00:00 2001 From: harrierpigeon Date: Wed, 7 Oct 2026 16:09:26 -0500 Subject: [PATCH] Belt: refresh comments that described earlier code BeltBrim.cpp still described the brim as running inside the parallel support step; it runs sequentially after it (generate_belt_brim). The GCodeWriter, calib.cpp and calib.hpp comments referred to an inheritance layout and a dynamic_cast that no longer exist. Co-Authored-By: Claude Fable 5.1 --- src/libslic3r/BeltBrim.cpp | 15 ++++++--------- src/libslic3r/GCodeWriter.hpp | 4 ++-- src/libslic3r/calib.cpp | 3 +-- src/libslic3r/calib.hpp | 6 +++--- 4 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/libslic3r/BeltBrim.cpp b/src/libslic3r/BeltBrim.cpp index 3f2507f24e..66a271384f 100644 --- a/src/libslic3r/BeltBrim.cpp +++ b/src/libslic3r/BeltBrim.cpp @@ -376,15 +376,12 @@ static void belt_brim_band_paths(const BeltBrimContext &bc, // overhang outside the belt footprint and land in the brim ring, which the flattened // brim_object_gap - a belt-plane separation - does not cover. // -// THREADING: this runs inside posSupportMaterial, which Print::process() executes for all -// objects in a tbb::parallel_for (Print.cpp). Object slices are finished by then and safe -// to read across objects, but SUPPORT layers are not: another object's thread may be -// inside clear_support_layers() - which deletes the SupportLayer pointers - right now, so -// touching a foreign object's support_layers() here is a use-after-free. Only this -// object's own supports are consulted; they are complete, because make_belt_brim() runs at -// the tail of this object's own generate_support_material(). The cost is that the brim -// does not dodge a *different* object's support at the same Z, which needs the objects to -// overlap in the belt direction in the first place. +// SEQUENCING: this reads the layers and support layers of every object on the plate, so +// it must not overlap with another object's support step, which rebuilds them. +// Print::process() therefore generates the belt brims one object after the other once the +// parallel support step is over (PrintObject::generate_belt_brim()), and an object that +// arrives on or leaves the plate invalidates every other object's support step +// (PrintApply.cpp) so the brims are clipped against what is there now. // `region_bbox` bounds the brim; anything outside it cannot clip a brim line, so whole // objects are skipped without materialising their polygons. On a typical plate the // objects do not overlap and every foreign object drops out here, which matters because diff --git a/src/libslic3r/GCodeWriter.hpp b/src/libslic3r/GCodeWriter.hpp index 88be72a6f1..12a56dacdc 100644 --- a/src/libslic3r/GCodeWriter.hpp +++ b/src/libslic3r/GCodeWriter.hpp @@ -236,8 +236,8 @@ protected: Vec3d apply_axis_remap(const Vec3d &pos) const; // Motion uses the global/base process variant until a filament becomes active. - // Protected so subclasses index the per-extruder speed options (travel_speed, - // travel_speed_z, initial_layer_travel_speed) exactly as the base writer does. + // Indexes the per-extruder speed options (travel_speed, travel_speed_z, + // initial_layer_travel_speed). size_t m_cached_extruder_idx; private: diff --git a/src/libslic3r/calib.cpp b/src/libslic3r/calib.cpp index cdf105fa69..3217edf1da 100644 --- a/src/libslic3r/calib.cpp +++ b/src/libslic3r/calib.cpp @@ -896,8 +896,7 @@ void CalibPressureAdvancePattern::_refresh_writer(bool is_bbl_machine, const Mod } m_writer = std::move(belt_writer); } else if (m_writer && dynamic_cast(&m_writer->kinematics()) != nullptr) { - // Previously configured for a belt printer; drop back to a plain writer, - // exactly as the old dynamic_cast check did. + // Previously configured for a belt printer; drop back to a plain writer. m_writer = std::make_shared(); } diff --git a/src/libslic3r/calib.hpp b/src/libslic3r/calib.hpp index 1f1c7844dc..4ef676cdb1 100644 --- a/src/libslic3r/calib.hpp +++ b/src/libslic3r/calib.hpp @@ -370,9 +370,9 @@ private: const Calib_Params &m_params; - // Polymorphic so belt printers get belt kinematics in world-coordinates - // mode (_refresh_writer); shared_ptr keeps the class copyable — the writer - // is rebuilt by refresh_setup() before every use anyway. + // Belt printers get belt kinematics installed on it (_refresh_writer); + // shared_ptr keeps the class copyable — the writer is rebuilt by + // refresh_setup() before every use anyway. std::shared_ptr m_writer{std::make_shared()}; Vec3d m_starting_point; bool m_is_start_point_fixed = false;