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
diff options
context:
space:
mode:
authorsupermerill <merill@free.fr>2022-08-09 20:19:28 +0300
committersupermerill <merill@free.fr>2022-08-11 00:56:42 +0300
commit16db2fd49218b9268fb759772792572ced351878 (patch)
tree2f57d9ab1c094d60835213bcd9c71c47d8dfba54
parent1cb0fbfd7a0f0b98a5ab7f64683a638f951effe0 (diff)
Fix solid_over_perimeters
supermerill/SuperSlicer#2955 supermerill/SuperSlicer#3015
-rw-r--r--src/libslic3r/PrintObject.cpp28
-rw-r--r--src/libslic3r/Surface.cpp49
-rw-r--r--src/libslic3r/Surface.hpp1
3 files changed, 66 insertions, 12 deletions
diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp
index 84ba3ecd6..78d5f8b6b 100644
--- a/src/libslic3r/PrintObject.cpp
+++ b/src/libslic3r/PrintObject.cpp
@@ -1835,20 +1835,24 @@ bool PrintObject::invalidate_state_by_config_options(
float max_perimeter_infill_spacing = float(layerm.flow(frSolidInfill).scaled_spacing()) * 1.75f;
// Top surfaces.
auto& cache = cache_top_botom_regions[idx_layer];
- cache.top_surfaces = offset_ex(to_expolygons(layerm.slices().filter_by_type(stPosTop | stDensSolid)), min_perimeter_infill_spacing);
- append(cache.top_surfaces, offset_ex(to_expolygons(layerm.fill_surfaces.filter_by_type(stPosTop | stDensSolid)), min_perimeter_infill_spacing));
- if (nb_perimeter_layers_for_solid_fill != 0 && (idx_layer > min_layer_no_solid || layer.print_z < min_z_no_solid)) {
+ ExPolygons raw_slice_temp = to_expolygons(layerm.slices().filter_by_type(stPosTop | stDensSolid));
+ ExPolygons raw_fill_temp = to_expolygons(layerm.fill_surfaces.filter_by_type(stPosTop | stDensSolid));
+ cache.top_surfaces = offset_ex(raw_slice_temp, min_perimeter_infill_spacing);
+ append(cache.top_surfaces, offset_ex(raw_fill_temp, min_perimeter_infill_spacing));
+ if (nb_perimeter_layers_for_solid_fill != 0) {
//it needs to be activated and we don't check the firs layers, where everything have to be solid.
- cache.top_fill_surfaces = offset_ex(to_expolygons(layerm.fill_surfaces.filter_by_type(stPosTop | stDensSolid)), max_perimeter_infill_spacing);
- cache.top_perimeter_surfaces = to_expolygons(layerm.slices().filter_by_type(stPosTop | stDensSolid));
+ cache.top_fill_surfaces = offset_ex(raw_fill_temp, max_perimeter_infill_spacing);
+ cache.top_perimeter_surfaces = raw_slice_temp;
}
// Bottom surfaces.
const SurfaceType surfaces_bottom[2] = { stPosBottom | stDensSolid, stPosBottom | stDensSolid | stModBridge };
- cache.bottom_surfaces = offset_ex(to_expolygons(layerm.slices().filter_by_types(surfaces_bottom, 2)), min_perimeter_infill_spacing);
- append(cache.bottom_surfaces, offset_ex(to_expolygons(layerm.fill_surfaces.filter_by_types(surfaces_bottom, 2)), min_perimeter_infill_spacing));
- if (nb_perimeter_layers_for_solid_fill != 0 && (idx_layer > min_layer_no_solid || layer.print_z < min_z_no_solid)) {
- cache.bottom_fill_surfaces = offset_ex(to_expolygons(layerm.fill_surfaces.filter_by_types(surfaces_bottom, 2)), max_perimeter_infill_spacing);
- cache.bottom_perimeter_surfaces = to_expolygons(layerm.slices().filter_by_types(surfaces_bottom, 2));
+ raw_slice_temp = to_expolygons(layerm.slices().filter_by_types(surfaces_bottom, 2));
+ raw_fill_temp = to_expolygons(layerm.fill_surfaces.filter_by_types(surfaces_bottom, 2));
+ cache.bottom_surfaces = offset_ex(raw_slice_temp, min_perimeter_infill_spacing);
+ append(cache.bottom_surfaces, offset_ex(raw_fill_temp, min_perimeter_infill_spacing));
+ if (nb_perimeter_layers_for_solid_fill != 0) {
+ cache.bottom_perimeter_surfaces = raw_slice_temp;
+ cache.bottom_fill_surfaces = offset_ex(raw_fill_temp, max_perimeter_infill_spacing);
}
// Holes over all regions. Only collect them once, they are valid for all idx_region iterations.
if (cache.holes.empty()) {
@@ -1888,7 +1892,7 @@ bool PrintObject::invalidate_state_by_config_options(
coord_t infill_line_spacing = solid_infill_flow.scaled_spacing();
// Find a union of perimeters below / above this surface to guarantee a minimum shell thickness.
ExPolygons shell;
- ExPolygons fill_shell;
+ ExPolygons fill_shell; // for nb_perimeter_layers_for_solid_fill
ExPolygons max_perimeter_shell; // for nb_perimeter_layers_for_solid_fill
ExPolygons holes;
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING
@@ -2043,9 +2047,9 @@ bool PrintObject::invalidate_state_by_config_options(
shell = intersection_ex(shell, polygonsInternal, ApplySafetyOffset::Yes);
expolygons_append(shell, diff_ex(polygonsInternal, holes));
shell = union_ex(shell);
- ExPolygons toadd;
//check if a polygon is only over perimeter, in this case evict it (depends from nb_perimeter_layers_for_solid_fill value)
if (nb_perimeter_layers_for_solid_fill != 0 && (idx_layer > min_layer_no_solid || layer->print_z < min_z_no_solid)) {
+ ExPolygons toadd;
for (int i = 0; i < shell.size(); i++) {
if (nb_perimeter_layers_for_solid_fill < 2 || intersection_ex(ExPolygons{ shell[i] }, max_perimeter_shell, ApplySafetyOffset::No).empty()) {
ExPolygons expoly = intersection_ex(ExPolygons{ shell[i] }, fill_shell);
diff --git a/src/libslic3r/Surface.cpp b/src/libslic3r/Surface.cpp
index e36d340c2..0dcacafff 100644
--- a/src/libslic3r/Surface.cpp
+++ b/src/libslic3r/Surface.cpp
@@ -143,4 +143,53 @@ bool export_to_svg(const char *path, const Surfaces &surfaces, const float trans
return true;
}
+
+std::string surfaceType_to_string(SurfaceType st)
+{
+ std::string str;
+ if ((st & stPosTop) != 0)
+ str += "posTop";
+ if ((st & stPosBottom) != 0) {
+ if (!str.empty())
+ str += "||";
+ str += "posBottom";
+ }
+ if ((st & stPosInternal) != 0) {
+ if (!str.empty())
+ str += "||";
+ str += "posInternal";
+ }
+ if ((st & stPosPerimeter) != 0) {
+ if (!str.empty())
+ str += "||";
+ str += "posPerimeter";
+ }
+ if ((st & stDensSolid) != 0) {
+ if (!str.empty())
+ str += "||";
+ str += "densSolid";
+ }
+ if ((st & stDensSparse) != 0) {
+ if (!str.empty())
+ str += "||";
+ str += "densSparse";
+ }
+ if ((st & stDensVoid) != 0) {
+ if (!str.empty())
+ str += "||";
+ str += "densVoid";
+ }
+ if ((st & stModBridge) != 0) {
+ if (!str.empty())
+ str += "||";
+ str += "modBridge";
+ }
+ if ((st & stModOverBridge) != 0) {
+ if (!str.empty())
+ str += "||";
+ str += "modOverBridge";
+ }
+ return str.empty() ? "none" : str;
+}
+
}
diff --git a/src/libslic3r/Surface.hpp b/src/libslic3r/Surface.hpp
index e12e15056..764399033 100644
--- a/src/libslic3r/Surface.hpp
+++ b/src/libslic3r/Surface.hpp
@@ -52,6 +52,7 @@ inline SurfaceType operator&=(SurfaceType& a, SurfaceType b) {
//inline bool operator!=(SurfaceType a, SurfaceType b) {
// return static_cast<uint16_t>(a) ^ static_cast<uint16_t>(b) != 0;
//}
+std::string surfaceType_to_string(SurfaceType st);
class Surface