From 57cbff2cc63c0692566c66278afdb9dd814f502e Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Tue, 14 Jan 2025 14:24:53 +0800 Subject: [PATCH] FIX: the cali gcode overlaps the start gcode before print jira: STUDIO-9718 Change-Id: I2704651e40b2d76db6d845ddf90c17e21167f7bd --- src/libslic3r/GCode.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 79f9704b1..1657a7c84 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2187,10 +2187,23 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato {bbox.max.x() - plate_offset.x(),bbox.max.y() - plate_offset.y()} }; - m_placeholder_parser.set("first_layer_print_convex_hull", pts.release()); - m_placeholder_parser.set("first_layer_print_min", new ConfigOptionFloats({ bbox_without_plate_offset.min.x(),bbox_without_plate_offset.min.y() })); - m_placeholder_parser.set("first_layer_print_max", new ConfigOptionFloats({ bbox_without_plate_offset.max.x(),bbox_without_plate_offset.max.y() })); - m_placeholder_parser.set("first_layer_print_size", new ConfigOptionFloats({ bbox.size().x(), bbox.size().y() })); + if (print.calib_params().mode == CalibMode::Calib_PA_Line) { + Pointfs bedfs = print.config().printable_area.values; + BoundingBoxf bed_bbox = BoundingBoxf(bedfs); + pts->values.clear(); + for (const Vec2d &pt : bedfs) + pts->values.emplace_back(pt); + m_placeholder_parser.set("first_layer_print_convex_hull", pts.release()); + m_placeholder_parser.set("first_layer_print_min", new ConfigOptionFloats({bed_bbox.min.x(), bed_bbox.min.y()})); + m_placeholder_parser.set("first_layer_print_max", new ConfigOptionFloats({bed_bbox.max.x(), bed_bbox.max.y()})); + m_placeholder_parser.set("first_layer_print_size", new ConfigOptionFloats({bed_bbox.size().x(), bed_bbox.size().y()})); + } + else { + m_placeholder_parser.set("first_layer_print_convex_hull", pts.release()); + m_placeholder_parser.set("first_layer_print_min", new ConfigOptionFloats({bbox_without_plate_offset.min.x(), bbox_without_plate_offset.min.y()})); + m_placeholder_parser.set("first_layer_print_max", new ConfigOptionFloats({bbox_without_plate_offset.max.x(), bbox_without_plate_offset.max.y()})); + m_placeholder_parser.set("first_layer_print_size", new ConfigOptionFloats({bbox.size().x(), bbox.size().y()})); + } { // BBS:deal with head wrap detect // use first layer convex_hull union with each object's bbox to check whether in head detect zone