From d9cffeca4a400c8f534fce56f4d17a0ce7134ce5 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 16 Dec 2014 18:55:16 +0100 Subject: [PATCH] Bugfix: adjust skirt flow according to each layer's height. #2307 --- lib/Slic3r/Print.pm | 4 ++-- lib/Slic3r/Print/GCode.pm | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 09ebd40a2..db7309591 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -280,9 +280,9 @@ sub make_skirt { Slic3r::ExtrusionPath->new( polyline => Slic3r::Polygon->new(@$loop)->split_at_first_point, role => EXTR_ROLE_SKIRT, - mm3_per_mm => $mm3_per_mm, + mm3_per_mm => $mm3_per_mm, # this will be overridden at G-code export time width => $flow->width, - height => $first_layer_height, + height => $first_layer_height, # this will be overridden at G-code export time ), )); diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index b8391b5e8..ca572fc72 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -314,6 +314,8 @@ sub process_layer { $gcode .= $self->_gcodegen->set_extruder($extruder_ids[0]); # skip skirt if we have a large brim if ($layer->id < $self->print->config->skirt_height || $self->print->config->skirt_height == -1) { + my $skirt_flow = $self->print->skirt_flow; + # distribute skirt loops across all extruders my @skirt_loops = @{$self->print->skirt}; for my $i (0 .. $#skirt_loops) { @@ -323,7 +325,20 @@ sub process_layer { my $extruder_id = $extruder_ids[($i/@extruder_ids) % @extruder_ids]; $gcode .= $self->_gcodegen->set_extruder($extruder_id) if $layer->id == 0; - $gcode .= $self->_gcodegen->extrude_loop($skirt_loops[$i], 'skirt', $object->config->support_material_speed); + + # adjust flow according to this layer's layer height + my $loop = $skirt_loops[$i]->clone; + { + my $layer_skirt_flow = $skirt_flow->clone; + $layer_skirt_flow->set_height($layer->height); + my $mm3_per_mm = $layer_skirt_flow->mm3_per_mm; + foreach my $path (@$loop) { + $path->height($layer->height); + $path->mm3_per_mm($mm3_per_mm); + } + } + + $gcode .= $self->_gcodegen->extrude_loop($loop, 'skirt', $object->config->support_material_speed); } } $self->_skirt_done->{$layer->print_z} = 1;