Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/local/dev' into superslicer_var…
Browse files Browse the repository at this point in the history
…iant
  • Loading branch information
supermerill committed Dec 2, 2024
2 parents ccabe9c + 5bdb354 commit 8472cd7
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 45 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion resources/ui_layout/default/filament.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion resources/ui_layout/default/print.ui
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/AppConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
19 changes: 13 additions & 6 deletions src/libslic3r/Fill/FillRectilinear.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 &params) 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;
Expand All @@ -3122,12 +3128,12 @@ void FillRectilinear::make_fill_lines(const ExPolygonWithOffset &poly_with_offse
const double sin_a = sin(angle);
std::vector<SegmentedIntersectionLine> 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;
Expand All @@ -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<SweepParams> &sweep_params, Polylines &polylines_out) const
Expand Down
89 changes: 55 additions & 34 deletions src/libslic3r/LayerRegion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<BoundingBox> fill_ex_bboxes = get_extents_vector(this->fill_expolygons());
// Voids are sparse infills if infill rate is zero.
Expand All @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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<BoundingBox> fill_boundaries_bboxes = get_extents_vector(fill_boundaries);
bridges_grown.reserve(bridges.size());
Expand All @@ -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()) {
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 8472cd7

Please sign in to comment.