diff --git a/src/libslic3r/Fill/Fill.cpp b/src/libslic3r/Fill/Fill.cpp index ab20bbddb..498abe89e 100644 --- a/src/libslic3r/Fill/Fill.cpp +++ b/src/libslic3r/Fill/Fill.cpp @@ -114,7 +114,7 @@ std::vector group_fills(const Layer &layer) if (surface.surface_type == stInternalVoid) has_internal_voids = true; else { - FlowRole extrusion_role = (surface.surface_type == stTop) ? frTopSolidInfill : (surface.is_solid() ? frSolidInfill : frInfill); + FlowRole extrusion_role = surface.is_top() ? frTopSolidInfill : (surface.is_solid() ? frSolidInfill : frInfill); bool is_bridge = layer.id() > 0 && surface.is_bridge(); params.extruder = layerm.region()->extruder(extrusion_role); params.pattern = layerm.region()->config().fill_pattern.value; @@ -132,7 +132,7 @@ std::vector group_fills(const Layer &layer) is_bridge ? erBridgeInfill : (surface.is_solid() ? - ((surface.surface_type == stTop) ? erTopSolidInfill : erSolidInfill) : + (surface.is_top() ? erTopSolidInfill : erSolidInfill) : erInternalInfill); params.bridge_angle = float(surface.bridge_angle); params.angle = float(Geometry::deg2rad(layerm.region()->config().fill_angle.value)); diff --git a/src/libslic3r/LayerRegion.cpp b/src/libslic3r/LayerRegion.cpp index 67a1acb09..19907d6de 100644 --- a/src/libslic3r/LayerRegion.cpp +++ b/src/libslic3r/LayerRegion.cpp @@ -117,7 +117,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly // Voids are sparse infills if infill rate is zero. Polygons voids; for (const Surface &surface : this->fill_surfaces.surfaces) { - if (surface.surface_type == stTop) { + if (surface.is_top()) { // Collect the top surfaces, inflate them and trim them by the bottom surfaces. // This gives the priority to bottom surfaces. surfaces_append(top, offset_ex(surface.expolygon, margin, EXTERNAL_SURFACES_OFFSET_PARAMETERS), surface); @@ -313,7 +313,7 @@ void LayerRegion::process_external_surfaces(const Layer *lower_layer, const Poly s2.clear(); } } - if (s1.surface_type == stTop) + if (s1.is_top()) // Trim the top surfaces by the bottom surfaces. This gives the priority to the bottom surfaces. polys = diff(polys, bottom_polygons); surfaces_append( diff --git a/src/libslic3r/PrintObject.cpp b/src/libslic3r/PrintObject.cpp index ed1a51e5d..5573f4ac3 100644 --- a/src/libslic3r/PrintObject.cpp +++ b/src/libslic3r/PrintObject.cpp @@ -817,11 +817,12 @@ void PrintObject::detect_surfaces_type() m_layers[idx_layer]->m_regions[idx_region]->slices.surfaces = std::move(surfaces_new[idx_layer]); } - if (spiral_vase && num_layers > 1) { - // Turn the last bottom layer infill to a top infill, so it will be extruded with a proper pattern. - Surfaces &surfaces = m_layers[num_layers - 1]->m_regions[idx_region]->slices.surfaces; - for (Surface &surface : surfaces) - surface.surface_type = stTop; + if (spiral_vase) { + if (num_layers > 1) + // Turn the last bottom layer infill to a top infill, so it will be extruded with a proper pattern. + m_layers[num_layers - 1]->m_regions[idx_region]->slices.set_type(stTop); + for (size_t i = num_layers; i < m_layers.size(); ++ i) + m_layers[i]->m_regions[idx_region]->slices.set_type(stInternal); } BOOST_LOG_TRIVIAL(debug) << "Detecting solid surfaces for region " << idx_region << " - clipping in parallel - start"; diff --git a/src/libslic3r/SurfaceCollection.hpp b/src/libslic3r/SurfaceCollection.hpp index b60105eb3..9f0324d20 100644 --- a/src/libslic3r/SurfaceCollection.hpp +++ b/src/libslic3r/SurfaceCollection.hpp @@ -34,6 +34,10 @@ public: void remove_type(const SurfaceType type); void remove_types(const SurfaceType *types, int ntypes); void filter_by_type(SurfaceType type, Polygons* polygons); + void set_type(SurfaceType type) { + for (Surface &surface : this->surfaces) + surface.surface_type = type; + } void clear() { surfaces.clear(); } bool empty() const { return surfaces.empty(); }