From 93507bfd499eae228213eb3861e1380fede5115a Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci <aar@cpan.org> Date: Mon, 22 Dec 2014 11:46:16 +0100 Subject: [PATCH] Bugfix: only_retract_when_crossing_perimeters was not correctly applied on bottom layer when no bottom solid layers were printed --- lib/Slic3r/GCode.pm | 4 ++-- xs/src/libslic3r/Layer.cpp | 8 ++++---- xs/src/libslic3r/Layer.hpp | 2 +- xs/xsp/Layer.xsp | 16 ++++++++-------- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/Slic3r/GCode.pm b/lib/Slic3r/GCode.pm index 5ebca1db9..2e189c499 100644 --- a/lib/Slic3r/GCode.pm +++ b/lib/Slic3r/GCode.pm @@ -344,7 +344,7 @@ sub travel_to { if ($travel->length < scale $self->config->get_at('retract_before_travel', $self->writer->extruder->id) || ($self->config->only_retract_when_crossing_perimeters && $self->config->fill_density > 0 - && defined($self->layer) && $self->layer->any_internal_region_slice_contains_line($travel)) + && defined($self->layer) && $self->layer->any_internal_region_fill_surface_contains_line($travel)) || (defined $role && $role == EXTR_ROLE_SUPPORTMATERIAL && $self->layer->support_islands->contains_line($travel)) ) { # Just perform a straight travel move without any retraction. @@ -607,7 +607,7 @@ sub _plan { # if the path is not contained in a single island we need to retract $gcode .= $gcodegen->retract if !$gcodegen->config->only_retract_when_crossing_perimeters - || !$gcodegen->layer->any_internal_region_slice_contains_polyline($travel); + || !$gcodegen->layer->any_internal_region_fill_surface_contains_polyline($travel); # append the actual path and return # use G1 because we rely on paths being straight (G0 may make round paths) diff --git a/xs/src/libslic3r/Layer.cpp b/xs/src/libslic3r/Layer.cpp index 26e9ab7f8..8f8334d1f 100644 --- a/xs/src/libslic3r/Layer.cpp +++ b/xs/src/libslic3r/Layer.cpp @@ -122,15 +122,15 @@ Layer::make_slices() template <class T> bool -Layer::any_internal_region_slice_contains(const T &item) const +Layer::any_internal_region_fill_surface_contains(const T &item) const { FOREACH_LAYERREGION(this, layerm) { - if ((*layerm)->slices.any_internal_contains(item)) return true; + if ((*layerm)->fill_surfaces.any_internal_contains(item)) return true; } return false; } -template bool Layer::any_internal_region_slice_contains<Line>(const Line &item) const; -template bool Layer::any_internal_region_slice_contains<Polyline>(const Polyline &item) const; +template bool Layer::any_internal_region_fill_surface_contains<Line>(const Line &item) const; +template bool Layer::any_internal_region_fill_surface_contains<Polyline>(const Polyline &item) const; #ifdef SLIC3RXS diff --git a/xs/src/libslic3r/Layer.hpp b/xs/src/libslic3r/Layer.hpp index bd87ab0cb..63e4819c8 100644 --- a/xs/src/libslic3r/Layer.hpp +++ b/xs/src/libslic3r/Layer.hpp @@ -93,7 +93,7 @@ class Layer { LayerRegion* add_region(PrintRegion* print_region); void make_slices(); - template <class T> bool any_internal_region_slice_contains(const T &item) const; + template <class T> bool any_internal_region_fill_surface_contains(const T &item) const; protected: int _id; // sequential number of layer, 0-based diff --git a/xs/xsp/Layer.xsp b/xs/xsp/Layer.xsp index a84d4464f..b2996dc03 100644 --- a/xs/xsp/Layer.xsp +++ b/xs/xsp/Layer.xsp @@ -69,10 +69,10 @@ %code%{ RETVAL = (int)(intptr_t)THIS; %}; void make_slices(); - bool any_internal_region_slice_contains_line(Line* line) - %code%{ RETVAL = THIS->any_internal_region_slice_contains(*line); %}; - bool any_internal_region_slice_contains_polyline(Polyline* polyline) - %code%{ RETVAL = THIS->any_internal_region_slice_contains(*polyline); %}; + bool any_internal_region_fill_surface_contains_line(Line* line) + %code%{ RETVAL = THIS->any_internal_region_fill_surface_contains(*line); %}; + bool any_internal_region_fill_surface_contains_polyline(Polyline* polyline) + %code%{ RETVAL = THIS->any_internal_region_fill_surface_contains(*polyline); %}; }; %name{Slic3r::Layer::Support} class SupportLayer { @@ -119,8 +119,8 @@ Ref<ExPolygonCollection> slices() %code%{ RETVAL = &THIS->slices; %}; - bool any_internal_region_slice_contains_line(Line* line) - %code%{ RETVAL = THIS->any_internal_region_slice_contains(*line); %}; - bool any_internal_region_slice_contains_polyline(Polyline* polyline) - %code%{ RETVAL = THIS->any_internal_region_slice_contains(*polyline); %}; + bool any_internal_region_fill_surface_contains_line(Line* line) + %code%{ RETVAL = THIS->any_internal_region_fill_surface_contains(*line); %}; + bool any_internal_region_fill_surface_contains_polyline(Polyline* polyline) + %code%{ RETVAL = THIS->any_internal_region_fill_surface_contains(*polyline); %}; };