Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsupermerill <merill@free.fr>2022-05-18 23:51:20 +0300
committersupermerill <merill@free.fr>2022-05-18 23:52:23 +0300
commit53d940cdf4d173fe1dd3d1f8c86f021dfa7b61dc (patch)
tree3b0ac05bbbd212fd992546f4f6093d04d8532551 /src
parent1abc2e6f4e26dd0a9d142c5d2c08358a571b1b7c (diff)
Fix slices_to_fill_surfaces_clipped:
* fix bad 2.4 merge * more robust for simplified slices supermerill/SuperSlicer#2807
Diffstat (limited to 'src')
-rw-r--r--src/libslic3r/Layer.hpp2
-rw-r--r--src/libslic3r/LayerRegion.cpp35
-rw-r--r--src/libslic3r/PerimeterGenerator.cpp8
-rw-r--r--src/libslic3r/PrintConfig.cpp2
-rw-r--r--src/libslic3r/PrintObject.cpp5
5 files changed, 17 insertions, 35 deletions
diff --git a/src/libslic3r/Layer.hpp b/src/libslic3r/Layer.hpp
index befa3bf9c..2d5be4dc8 100644
--- a/src/libslic3r/Layer.hpp
+++ b/src/libslic3r/Layer.hpp
@@ -73,7 +73,7 @@ public:
Flow flow(FlowRole role, double layer_height) const;
Flow bridging_flow(FlowRole role) const;
- void slices_to_fill_surfaces_clipped();
+ void slices_to_fill_surfaces_clipped(coord_t opening_offset);
void prepare_fill_surfaces();
void make_perimeters(const SurfaceCollection& slices, SurfaceCollection* fill_surfaces);
void make_milling_post_process(const SurfaceCollection& slices);
diff --git a/src/libslic3r/LayerRegion.cpp b/src/libslic3r/LayerRegion.cpp
index 51a37e6db..2e7bc10c2 100644
--- a/src/libslic3r/LayerRegion.cpp
+++ b/src/libslic3r/LayerRegion.cpp
@@ -52,7 +52,7 @@ Flow LayerRegion::bridging_flow(FlowRole role) const
}
// Fill in layerm->fill_surfaces by trimming the layerm->slices by the cummulative layerm->fill_surfaces.
-void LayerRegion::slices_to_fill_surfaces_clipped()
+void LayerRegion::slices_to_fill_surfaces_clipped(coord_t opening_offset)
{
//if (this->region()->config().no_perimeter_full_bridge) return;
// Note: this method should be idempotent, but fill_surfaces gets modified
@@ -68,33 +68,12 @@ void LayerRegion::slices_to_fill_surfaces_clipped()
// Trim surfaces by the fill_boundaries.
this->fill_surfaces.surfaces.clear();
for (auto const& entry : polygons_by_surface) {
- if (!entry.second.empty()) {
- //if (entry.first & stModBridge == stModBridge && this->region()->config().no_perimeter_full_bridge)
- // this->fill_surfaces.append(entry.second, entry.first);
- //else
- this->fill_surfaces.append(intersection_ex(entry.second, this->fill_expolygons), entry.first);
- }
- //if (this->region()->config().no_perimeter_full_bridge) return;
- // Note: this method should be idempotent, but fill_surfaces gets modified
- // in place. However we're now only using its boundaries (which are invariant)
- // so we're safe. This guarantees idempotence of prepare_infill() also in case
- // that combine_infill() turns some fill_surface into VOID surfaces.
- // Polygons fill_boundaries = to_polygons(std::move(this->fill_surfaces));
- Polygons fill_boundaries = to_polygons(this->fill_expolygons);
- // Collect polygons per surface type.
- std::map<SurfaceType, Polygons> polygons_by_surface;
- for (const Surface& surface : this->slices().surfaces) {
- polygons_append(polygons_by_surface[surface.surface_type], surface.expolygon);
- }
- // Trim surfaces by the fill_boundaries.
- this->fill_surfaces.surfaces.clear();
- for (auto const& entry : polygons_by_surface) {
- if (!entry.second.empty())
- //if (entry.first & stModBridge == stModBridge && this->region()->config().no_perimeter_full_bridge)
- // this->fill_surfaces.append(entry.second, entry.first);
- //else
- this->fill_surfaces.append(intersection_ex(entry.second, fill_boundaries), entry.first);
- }
+ if (!entry.second.empty())
+ for (ExPolygon& expoly_to_test : intersection_ex(entry.second, this->fill_expolygons)) {
+ if (!opening_ex({ expoly_to_test }, opening_offset).empty()) {
+ this->fill_surfaces.append({ expoly_to_test }, entry.first);
+ }
+ }
}
}
diff --git a/src/libslic3r/PerimeterGenerator.cpp b/src/libslic3r/PerimeterGenerator.cpp
index fd7e7e7b8..9e23d3847 100644
--- a/src/libslic3r/PerimeterGenerator.cpp
+++ b/src/libslic3r/PerimeterGenerator.cpp
@@ -1234,17 +1234,17 @@ void PerimeterGenerator::process()
// simplify infill contours according to resolution
Polygons not_filled_p;
for (ExPolygon& ex : last_no_gaps)
- ex.simplify_p(scale_t(print_config->resolution_internal), &not_filled_p);
+ ex.simplify_p(scale_t(std::max(this->print_config->resolution.value, print_config->resolution_internal/4)), &not_filled_p);
ExPolygons not_filled_exp = union_ex(not_filled_p);
// collapse too narrow infill areas
coord_t min_perimeter_infill_spacing = (coord_t)(solid_infill_spacing * (1. - INSET_OVERLAP_TOLERANCE));
ExPolygons infill_exp;
//special branch if gap : don't inset away from gaps!
- if (gap_srf.empty())
+ if (gap_srf.empty()) {
infill_exp = offset2_ex(not_filled_exp,
double(-inset - min_perimeter_infill_spacing / 2 + infill_peri_overlap - infill_gap),
double(min_perimeter_infill_spacing / 2));
- else {
+ } else {
//store the infill_exp but not offseted, it will be used as a clip to remove the gapfill portion
const ExPolygons infill_exp_no_gap = offset2_ex(not_filled_exp,
double(-inset - min_perimeter_infill_spacing / 2 + infill_peri_overlap - infill_gap),
@@ -1252,7 +1252,7 @@ void PerimeterGenerator::process()
//redo the same as not_filled_exp but with last instead of last_no_gaps
not_filled_p.clear();
for (ExPolygon& ex : last)
- ex.simplify_p(scale_t(print_config->resolution_internal), &not_filled_p);
+ ex.simplify_p(scale_t(std::max(this->print_config->resolution.value, print_config->resolution_internal/4)), &not_filled_p);
not_filled_exp = union_ex(not_filled_p);
infill_exp = offset2_ex(not_filled_exp,
double(-inset - min_perimeter_infill_spacing / 2 + infill_peri_overlap - infill_gap),
diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp
index 71871db53..e82b8f442 100644
--- a/src/libslic3r/PrintConfig.cpp
+++ b/src/libslic3r/PrintConfig.cpp
@@ -4099,7 +4099,7 @@ void PrintConfigDef::init_fff_params()
def->min = 0.001;
def->precision = 8;
def->mode = comExpert | comSuSi;
- def->set_default_value(new ConfigOptionFloat(0.2));
+ def->set_default_value(new ConfigOptionFloat(0.1));
def = this->add("retract_before_travel", coFloats);
def->label = L("Minimum travel after retraction");
diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp
index d91031ff6..306393495 100644
--- a/src/libslic3r/PrintObject.cpp
+++ b/src/libslic3r/PrintObject.cpp
@@ -1597,7 +1597,10 @@ bool PrintObject::invalidate_state_by_config_options(
for (size_t idx_layer = range.begin(); idx_layer < range.end(); ++idx_layer) {
m_print->throw_if_canceled();
LayerRegion* layerm = m_layers[idx_layer]->get_region(region_id);
- layerm->slices_to_fill_surfaces_clipped();
+ layerm->slices_to_fill_surfaces_clipped(
+ std::max(SCALED_EPSILON * 2,
+ std::max(scale_t(m_print->config().resolution) / 4,
+ scale_t(m_print->config().resolution_internal) / 8)));
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
layerm->export_region_fill_surfaces_to_svg_debug("1_detect_surfaces_type-final");
#endif /* SLIC3R_DEBUG_SLICE_PROCESSING */