From af95a407472339e44196fef257bb390e387c2ceb Mon Sep 17 00:00:00 2001 From: supermerill Date: Sat, 23 Dec 2023 21:45:00 +0100 Subject: [PATCH 1/2] too many polygons exported in the gcode file supermerill/SuperSlicer#3798 --- src/libslic3r/GCode.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 17680200b8b..dd3fdefcedd 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1451,9 +1451,20 @@ void GCode::_do_export(Print& print_mod, GCodeOutputStream &file, ThumbnailsGene if (print.config().gcode_flavor.value == gcfKlipper) { Polygon poly = print_object->model_object()->convex_hull_2d( print_instance.model_instance->get_matrix()); - poly.douglas_peucker(0.1); + Polygon poly_old = poly; + coord_t simplify_size = scale_t(0.1); + // simplify as long as there is too many points + while (poly.size() > 20 && simplify_size < 100) { + poly_old = poly; + poly.douglas_peucker(simplify_size); + simplify_size *= 2; + } + //if gone too far, get the previous one. + if (poly.size() < 10) { + poly = poly_old; + } - const boost::format format_point("[%f,%f]"); + const boost::format format_point("[%.2f,%.2f]"); std::string s_poly; for (const Point& point : poly.points) s_poly += (boost::format(format_point) % unscaled(point.x()) % unscaled(point.y())).str() + ","; From 6e6e99b47b606c78e813db91de38cd63cbd463a7 Mon Sep 17 00:00:00 2001 From: supermerill Date: Sat, 23 Dec 2023 22:28:09 +0100 Subject: [PATCH 2/2] version 2.5.59.4 --- version.inc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.inc b/version.inc index ce99c6636bb..755ec70581c 100644 --- a/version.inc +++ b/version.inc @@ -9,9 +9,9 @@ set(SLIC3R_APP_KEY "Slic3r") set(SLIC3R_APP_CMD "Slic3r") # versions set(SLIC3R_VERSION "2.5") -set(SLIC3R_VERSION_FULL "2.5.59.3") +set(SLIC3R_VERSION_FULL "2.5.59.4") set(SLIC3R_BUILD_ID "${SLIC3R_APP_KEY}_${SLIC3R_VERSION_FULL}+UNKNOWN") -set(SLIC3R_RC_VERSION "2,5,59,3") +set(SLIC3R_RC_VERSION "2,5,59,4") set(SLIC3R_RC_VERSION_DOTS "${SLIC3R_VERSION_FULL}") # Same as the slicer name but for gcodeviewer