From 8e28fc309bc555bd1143f6f95c6d612b263c707d Mon Sep 17 00:00:00 2001 From: bowman Date: Sat, 5 Sep 2026 23:36:54 -0700 Subject: [PATCH 1/2] fix: all three PA calibration tests fail to print correctly The PA Line, PA Pattern and PA Tower calibrations all produced a wrong EXCLUDE_OBJECT_DEFINE for the calibration area, and aborted outright on Debug builds. In GCode::set_object_info(), `first_v` holds the polygon's first vertex so the ring can be closed at the end, exactly as polygon_to_string() does at GCode.cpp:8155. Inside the loop it was then "assigned" with: first_v(v.x() + ext_x, v.y()); On an already-constructed Vec2d that is not assignment -- it resolves to Eigen's two-dimensional coefficient accessor Scalar& DenseCoeffsBase::operator()(Index, Index) with both doubles truncated to indices. For a 2x1 vector only (0,0) and (1,0) are valid, so real bed coordinates blow the bounds assertion: Assertion `row >= 0 && row < rows() && col >= 0 && col < cols()' failed. Under NDEBUG the assertion is compiled out and the expression forms an out-of-bounds reference that is immediately discarded, so `first_v` was never actually written. The statement is dead code in every release build. Remove it and make `first_v` const, matching polygon_to_string(). The closing vertex must be vertex 0; had the statement been a real assignment it would have left `first_v` at vertex 3, emitting a duplicated final point and an unclosed polygon. Behaviour is therefore unchanged for release builds, and Debug builds no longer abort. Verified on Fedora against all three PA calibration modes. Claude-Session: https://claude.ai/code/session_01GX1HqJrRdEWvoiwXkfrLQH --- src/libslic3r/GCode.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index c81a1aa1..526a2a5e 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -8213,7 +8213,7 @@ std::string GCode::set_object_info(Print* print) double sum_x = 0; double sum_y = 0; - Vec2d first_v(print->translate_to_print_space(polygon.points.at(0)).x()+ ext_x, print->translate_to_print_space(polygon.points.at(0)).y()); + const Vec2d first_v(print->translate_to_print_space(polygon.points.at(0)).x()+ ext_x, print->translate_to_print_space(polygon.points.at(0)).y()); for (int i = 0; i < polygon.points.size(); i++) { const auto v = print->translate_to_print_space(polygon.points.at(i)); @@ -8221,7 +8221,6 @@ std::string GCode::set_object_info(Print* print) pa_area_poly_gcode << "[" << v.x() + ext_x << "," << v.y() << "],"; sum_x += v.x() + ext_x; sum_y += v.y(); - first_v(v.x() + ext_x, v.y()); } else if(i==1 || i == 2){ pa_area_poly_gcode << "[" << v.x()+ box_width << "," << v.y() << "],"; From e77e904fc8628e6ea5a9fddae842dea59b101d22 Mon Sep 17 00:00:00 2001 From: "coderabbitai[bot]" <136622811+coderabbitai[bot]@users.noreply.github.com> Date: Sun, 6 Sep 2026 07:03:15 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9D=20Add=20docstrings=20to=20`fix?= =?UTF-8?q?/pa-calib-eigen-oob-crash`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Docstrings generation was requested by @bugparty. The following files were modified: * `src/libslic3r/GCode.cpp` --- src/libslic3r/GCode.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 526a2a5e..f65df2a3 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1025,8 +1025,8 @@ static std::vector get_path_of_change_filament(const Print& print) if (need_travel_after_change_filament_gcode) { // After a filament change, the travel path leading to the wipe tower: // start_point inside the previous printed object, - // end_point at the tower¡¯s start_pos or at the starting point of the tower¡¯s detour path. - // In this case, disable ¡°avoid crossing perimeters¡± to prevent inserting additional path points inside the previous printed object. + // end_point at the tower’s start_pos or at the starting point of the tower’s detour path. + // In this case, disable “avoid crossing perimetersâ€� to prevent inserting additional path points inside the previous printed object. gcodegen.m_avoid_crossing_perimeters.disable_once(); // move to start_pos for wiping after toolchange if (!is_used_travel_avoid_perimeter) { @@ -3914,7 +3914,7 @@ int GCode::get_highest_bed_temperature(const bool is_first_layer, const Print& p { auto bed_type = m_config.curr_bed_type; int bed_temp = 0; - // ×ÜÊÇÈ¡ËùÓÐÊײãºÄ²ÄÖÐζÈ×î¸ßµÄ£¬±£Ö¤ÈÈÎȶ¨ + // 总是å�–所有首层耗æ��中温度最高的,ä¿�è¯�热稳定 for (auto fidx : print.get_slice_used_filaments(true)) { bed_temp = std::max(bed_temp, get_bed_temperature(fidx, is_first_layer, bed_type)); } @@ -8158,7 +8158,12 @@ inline std::string polygon_to_string(const Polygon& polygon, Print* print) { return gcode.str(); } // this function iterator PrintObject and assign a seqential id to each object. -// this id is used to generate unique object id for each object. +/** + * @brief Assigns unique object and instance identifiers and generates Klipper exclusion definitions. + * + * @param print Print data containing the objects, instances, calibration settings, and wipe-tower configuration. + * @return std::string G-code defining exclusion areas for eligible objects, calibration areas, and the wipe tower. + */ std::string GCode::set_object_info(Print* print) { std::ostringstream gcode;