From f8e378731279942bede3237b5db6b2cc0271875d Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 2 Dec 2024 15:18:00 +0100 Subject: [PATCH 1/5] Fix rectilinear min dist for line (fix cd14b34) use the width, not the density's spacing. --- src/libslic3r/Fill/FillRectilinear.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/libslic3r/Fill/FillRectilinear.cpp b/src/libslic3r/Fill/FillRectilinear.cpp index 0d86d69b98e..8a90b5d56d3 100644 --- a/src/libslic3r/Fill/FillRectilinear.cpp +++ b/src/libslic3r/Fill/FillRectilinear.cpp @@ -3104,13 +3104,19 @@ bool FillRectilinear::fill_surface_by_lines(const Surface *surface, const FillPa return true; } -void FillRectilinear::make_fill_lines(const ExPolygonWithOffset &poly_with_offset, Point refpt, double angle, coord_t x_margin, coord_t line_spacing, coord_t pattern_shift, Polylines &fill_lines, const FillParams& params) const -{ +void FillRectilinear::make_fill_lines(const ExPolygonWithOffset &poly_with_offset, + Point refpt, + double angle, + coord_t x_margin, + coord_t line_spacing, + coord_t pattern_shift, + Polylines &fill_lines, + const FillParams ¶ms) const { BoundingBox bounding_box = poly_with_offset.bounding_box_src(); // Don't produce infill lines, which fully overlap with the infill perimeter. coord_t x_min = bounding_box.min.x() + x_margin; coord_t x_max = bounding_box.max.x() - x_margin; - coord_t min_dist = std::max(SCALED_EPSILON, line_spacing / 2); + coord_t min_dist = std::max(SCALED_EPSILON, x_margin / 2); // extend bounding box so that our pattern will be aligned with other layers // align_to_grid will not work correctly with positive pattern_shift. coord_t pattern_shift_scaled = pattern_shift % line_spacing; @@ -3122,12 +3128,12 @@ void FillRectilinear::make_fill_lines(const ExPolygonWithOffset &poly_with_offse const double sin_a = sin(angle); std::vector segs = _vert_lines_for_polygon(poly_with_offset, bounding_box, params, line_spacing); slice_region_by_vertical_lines(this, segs, poly_with_offset); - for (const SegmentedIntersectionLine &vline : segs) + for (const SegmentedIntersectionLine &vline : segs) { if (vline.pos >= x_min) { if (vline.pos > x_max) break; for (auto it = vline.intersections.begin(); it != vline.intersections.end();) { - auto it_low = it ++; + auto it_low = it++; assert(it_low->type == SegmentIntersection::OUTER_LOW); if (it_low->type != SegmentIntersection::OUTER_LOW) continue; @@ -3142,10 +3148,11 @@ void FillRectilinear::make_fill_lines(const ExPolygonWithOffset &poly_with_offse Point(vline.pos, it_high->pos()).rotated(cos_a, sin_a)); } } - ++ it; + ++it; } } } + } } bool FillRectilinear::fill_surface_by_multilines(const Surface *surface, FillParams params, const std::initializer_list &sweep_params, Polylines &polylines_out) const From 9cfc65e6428c4583e1e9045af8f58b77e9a4e63d Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 2 Dec 2024 15:45:09 +0100 Subject: [PATCH 2/5] default alert_when_supports_needed to disabled --- src/libslic3r/AppConfig.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 75a000a50ca..67dec087514 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -113,9 +113,9 @@ void AppConfig::set_defaults() // Disable background processing by default as it is not stable. if (get("background_processing").empty()) set("background_processing", "0"); - // Enable support issues alerts by default + // Disable support issues alerts by default if (get("alert_when_supports_needed").empty()) - set("alert_when_supports_needed", "1"); + set("alert_when_supports_needed", "0"); // If set, the "Controller" tab for the control of the printer over serial line and the serial port settings are hidden. // By default, Prusa has the controller hidden. if (get("no_controller").empty()) From 8a7e95141513f5d53ba723a8e7c11a2c43abe928 Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 2 Dec 2024 19:21:43 +0100 Subject: [PATCH 3/5] process_external_surfaces: collapse narrow bridge area. --- src/libslic3r/LayerRegion.cpp | 89 ++++++++++++++++++++++------------- 1 file changed, 55 insertions(+), 34 deletions(-) diff --git a/src/libslic3r/LayerRegion.cpp b/src/libslic3r/LayerRegion.cpp index be9768cc95d..168e4f3c614 100644 --- a/src/libslic3r/LayerRegion.cpp +++ b/src/libslic3r/LayerRegion.cpp @@ -745,8 +745,8 @@ void LayerRegion::process_external_surfaces_old(const Layer *lower_layer, const // Collect top surfaces and internal surfaces. // Collect fill_boundaries: If we're slicing with no infill, we can't extend external surfaces over non-existent infill. // This loop destroys the surfaces (aliasing this->fill_surfaces.surfaces) by moving into top/internal/fill_boundaries! - { + coord_t min_half_width = this->flow(frSolidInfill).scaled_width() / 2; // to search your fill island std::vector fill_ex_bboxes = get_extents_vector(this->fill_expolygons()); // Voids are sparse infills if infill rate is zero. @@ -760,7 +760,9 @@ void LayerRegion::process_external_surfaces_old(const Layer *lower_layer, const // Collect the top surfaces, inflate them and trim them by the bottom surfaces. // This gives the priority to bottom surfaces. // grow - ExPolygons grown_expoly = offset_ex(surface.expolygon, double(margin), EXTERNAL_SURFACES_OFFSET_PARAMETERS); + ExPolygons grown_expoly = offset2_ex({surface.expolygon}, double(-min_half_width), + double(margin + min_half_width), + EXTERNAL_SURFACES_OFFSET_PARAMETERS); // intersect with our island to avoid growing inside another island grown_expoly = intersection_ex(grown_expoly, {this->fill_expolygons()[get_island_idx(surface.expolygon.contour, @@ -769,7 +771,9 @@ void LayerRegion::process_external_surfaces_old(const Layer *lower_layer, const surfaces_append(top, std::move(grown_expoly), surface); } else if (surface.has_pos_bottom() && (!surface.has_mod_bridge() || lower_layer == nullptr)) { // Grow. - ExPolygons grown_expoly = offset_ex(surface.expolygon, double(margin), EXTERNAL_SURFACES_OFFSET_PARAMETERS); + ExPolygons grown_expoly = offset2_ex({surface.expolygon}, double(-min_half_width), + double(margin + min_half_width), + EXTERNAL_SURFACES_OFFSET_PARAMETERS); // intersect with our island to avoid growing inside another island grown_expoly = intersection_ex(grown_expoly, {this->fill_expolygons()[get_island_idx(surface.expolygon.contour, @@ -844,6 +848,7 @@ void LayerRegion::process_external_surfaces_old(const Layer *lower_layer, const #endif /* SLIC3R_DEBUG_SLICE_PROCESSING */ { + coord_t min_half_width = this->flow(frSolidInfill).scaled_width() / 2; // Bridge expolygons, grown, to be tested for intersection with other bridge regions. std::vector fill_boundaries_bboxes = get_extents_vector(fill_boundaries); bridges_grown.reserve(bridges.size()); @@ -864,38 +869,53 @@ void LayerRegion::process_external_surfaces_old(const Layer *lower_layer, const BOOST_LOG_TRIVIAL(trace) << "Bridge did not fall into the source region!"; } else { // also, remove all bridge area that are thinner than a single line. - ExPolygons expoly_collapsed = offset2_ex(ExPolygons{ bridges[i].expolygon }, - (-this->flow(frInfill).scaled_width() / 2), - (this->flow(frInfill).scaled_width() / 2) + SCALED_EPSILON, - EXTERNAL_SURFACES_OFFSET_PARAMETERS); - //check if there is something cut - ExPolygons cut = diff_ex(ExPolygons{ bridges[i].expolygon }, expoly_collapsed, ApplySafetyOffset::Yes); - double area_cut = 0; for (ExPolygon& c : cut) area_cut += c.area(); - if (area_cut > (this->flow(frInfill).scaled_width() * this->flow(frInfill).scaled_width())) { - //if area not negligible, we will consider it. - // compute the bridge area, if any. - ExPolygons ex_polys = offset_ex(expoly_collapsed, float(margin_bridged), EXTERNAL_SURFACES_OFFSET_PARAMETERS); - polys = to_polygons(ex_polys); - //add the cut section as solid infill - Surface srf_bottom = bridges[i]; - srf_bottom.surface_type = stPosBottom | stDensSolid; - // clip it to the infill area and remove the bridge part. - surfaces_append( - bottom, - diff_ex( - intersection_ex( - ExPolygons{ fill_boundaries[idx_island] }, - offset_ex(cut, double(margin), EXTERNAL_SURFACES_OFFSET_PARAMETERS) - ), - ex_polys), - srf_bottom); + ExPolygons expoly_collapsed = offset2_ex(ExPolygons{bridges[i].expolygon}, (-min_half_width), + (min_half_width) + SCALED_EPSILON, + EXTERNAL_SURFACES_OFFSET_PARAMETERS); + // is there something left? + if (!expoly_collapsed.empty()) { + // check if there is something cut + ExPolygons cut = diff_ex(ExPolygons{bridges[i].expolygon}, expoly_collapsed, + ApplySafetyOffset::Yes); + //double area_cut = 0; + //for (ExPolygon &c : cut) { + // area_cut += c.area(); + //} + // can remove thin panhandle , very useful in some cases. + if (expoly_collapsed.size() != 1 && + !cut.empty() + //area_cut > min_half_width * min_half_width + ) { + // if area not negligible, we will consider it. + // compute the bridge area, if any. + ExPolygons ex_polys = offset_ex(expoly_collapsed, float(margin_bridged), + EXTERNAL_SURFACES_OFFSET_PARAMETERS); + polys = to_polygons(ex_polys); + // add the cut section as solid infill + Surface srf_bottom = bridges[i]; + srf_bottom.surface_type = stPosBottom | stDensSolid; + // clip it to the infill area and remove the bridge part. + surfaces_append(bottom, + diff_ex(intersection_ex(ExPolygons{fill_boundaries[idx_island]}, + offset_ex(cut, double(margin), + EXTERNAL_SURFACES_OFFSET_PARAMETERS)), + ex_polys), + srf_bottom); + } else { + // negligible, don't offset2 + polys = offset(to_polygons(bridges[i].expolygon), float(margin_bridged), + EXTERNAL_SURFACES_OFFSET_PARAMETERS); + } + // Found an island, to which this bridge region belongs. Trim the expanded bridging region + // with its source region, so it does not overflow into a neighbor region. + polys = intersection(polys, fill_boundaries[idx_island]); } else { - //negligible, don't offset2 - polys = offset(to_polygons(bridges[i].expolygon), float(margin_bridged), EXTERNAL_SURFACES_OFFSET_PARAMETERS); + // add the cut section as solid infill + Surface &srf_bottom = bridges[i]; + srf_bottom.surface_type = stPosBottom | stDensSolid; + // will be removed just below, we can move it + bottom.push_back(std::move(srf_bottom)); } - // Found an island, to which this bridge region belongs. Trim the expanded bridging region - // with its source region, so it does not overflow into a neighbor region. - polys = intersection(polys, fill_boundaries[idx_island]); } //keep bridges & bridge_bboxes & bridges_grown the SAME SIZE if (!polys.empty()) { @@ -1054,9 +1074,10 @@ void LayerRegion::process_external_surfaces_old(const Layer *lower_layer, const s2.clear(); } } - if (s1.has_pos_top()) + if (s1.has_pos_top()) { // Trim the top surfaces by the bottom surfaces. This gives the priority to the bottom surfaces. polys = diff(polys, bottom_polygons); + } surfaces_append( new_surfaces, // Don't use a safety offset as fill_boundaries were already united using the safety offset. From f155b79fedc88d20b3bace2b5b632adab6b7df7f Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 2 Dec 2024 16:27:10 +0100 Subject: [PATCH 4/5] ui: Fix overhangs enable/disable button, change pa label --- resources/ui_layout/default/filament.ui | 2 +- resources/ui_layout/default/print.ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/ui_layout/default/filament.ui b/resources/ui_layout/default/filament.ui index 3789eca4db4..0a6bb881724 100644 --- a/resources/ui_layout/default/filament.ui +++ b/resources/ui_layout/default/filament.ui @@ -26,7 +26,7 @@ group:Filament properties setting:id$0:filament_soluble setting:id$0:filament_shrink setting:id$0:filament_max_overlap - setting:id$0:label$pa:filament_pressure_advance + setting:id$0:filament_pressure_advance group:Print speed override setting:id$0:filament_max_speed setting:id$0:filament_max_volumetric_speed diff --git a/resources/ui_layout/default/print.ui b/resources/ui_layout/default/print.ui index b92e892c4d2..c3249a07fa8 100644 --- a/resources/ui_layout/default/print.ui +++ b/resources/ui_layout/default/print.ui @@ -64,8 +64,8 @@ group:Avoid crossing perimeters end_line setting:avoid_crossing_curled_overhangs group:label_width$12:Overhangs + setting:script:bool:tags$Simple$Advanced$Prusa$SuSi:depends$overhangs_width_speed$overhangs_width:label$Activate (threshold):label_width$0:tooltip$Simple widget to enable/disable the overhangs detection (using stored thresholds)\nUse the expert mode to get more detailled widgets:s_overhangs line:Activate (threshold) - setting:script:bool:tags$Simple$Advanced$Prusa$SuSi:depends$overhangs_width_speed$overhangs_width:label$_:label_width$0:tooltip$Simple widget to enable/disable the overhangs detection (using 55% and 75% for the two thresholds)\nUse the expert mode to get more detailled widgets:s_overhangs setting:label$for Bridge speed and fan:width$5:sidetext_width$0:overhangs_width_speed setting:label_width$12:label$for Bridge flow:width$5:overhangs_width end_line From 5bdb354c36b6d1ed4bd06429f0c3e58da25071a4 Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 2 Dec 2024 21:55:48 +0100 Subject: [PATCH 5/5] fix missing date --- CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ce2ac8d6e19..34fe44a2ef7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,9 +11,10 @@ cmake_minimum_required(VERSION 3.13) project(Slic3r) -if (EXISTS "version.date.inc") +if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/version.date.inc") include("version.date.inc") else() + message(STATUS "Warning: cannot find file 'version.date.inc', using template 'version.inc' instead.") include("version.inc") endif() include(GNUInstallDirs)