From dccd7d19a9421c26181fb7fceccc5b9f647f8cd2 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Sun, 26 Feb 2012 14:54:38 +0100 Subject: [PATCH] First layer temperature. #134 --- README.markdown | 2 ++ lib/Slic3r.pm | 1 + lib/Slic3r/Config.pm | 6 ++++++ lib/Slic3r/GUI/SkeinPanel.pm | 2 +- lib/Slic3r/Print.pm | 10 ++++++++-- slic3r.pl | 2 ++ 6 files changed, 20 insertions(+), 3 deletions(-) diff --git a/README.markdown b/README.markdown index 9c79563f..1ec4245d 100644 --- a/README.markdown +++ b/README.markdown @@ -115,6 +115,8 @@ The author is Alessandro Ranellucci (me). very little need to change this value, which is only useful to compensate for filament packing (default: 1) --temperature Extrusion temperature in degree Celsius, set 0 to disable (default: 200) + --first-layer-temperature Extrusion temperature for the first layer, in degree Celsius, + set 0 to disable (default: same as --temperature) Speed options: --travel-speed Speed of non-print moves in mm/s (default: 130) diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index bb2c1ac8..8e23c1b7 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -61,6 +61,7 @@ our $gcode_comments = 0; our $filament_diameter = 3; # mm our $extrusion_multiplier = 1; our $temperature = 200; +our $first_layer_temperature; # speed options our $travel_speed = 130; # mm/s diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index dff00f01..c73310d8 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -91,6 +91,11 @@ our $Options = { type => 'f', aliases => [qw(filament_packing_density)], }, + 'first_layer_temperature' => { + label => 'First layer temperature (°C)', + cli => 'fisrt-layer-temperature=i', + type => 'i', + }, 'temperature' => { label => 'Temperature (°C)', cli => 'temperature=i', @@ -594,6 +599,7 @@ sub validate { $Slic3r::small_perimeter_speed ||= $Slic3r::perimeter_speed; $Slic3r::bridge_speed ||= $Slic3r::infill_speed; $Slic3r::solid_infill_speed ||= $Slic3r::infill_speed; + $Slic3r::first_layer_temperature //= $Slic3r::temperature; #/ } 1; diff --git a/lib/Slic3r/GUI/SkeinPanel.pm b/lib/Slic3r/GUI/SkeinPanel.pm index 6714933a..33033787 100644 --- a/lib/Slic3r/GUI/SkeinPanel.pm +++ b/lib/Slic3r/GUI/SkeinPanel.pm @@ -25,7 +25,7 @@ sub new { }, filament => { title => 'Filament', - options => [qw(filament_diameter extrusion_multiplier temperature)], + options => [qw(filament_diameter extrusion_multiplier temperature first_layer_temperature)], }, print_speed => { title => 'Print speed', diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 753c971a..72e9cfcc 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -587,8 +587,8 @@ sub export_gcode { # write start commands to file printf $fh "M104 %s%d ; set temperature\n", - ($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::temperature - if $Slic3r::temperature; + ($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::first_layer_temperature + if $Slic3r::first_layer_temperature; print $fh "$Slic3r::start_gcode\n"; printf $fh "M109 %s%d ; wait for temperature to be reached\n", ($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::temperature @@ -622,6 +622,12 @@ sub export_gcode { # write gcode commands layer by layer foreach my $layer (@{ $self->layers }) { + if ($layer->id == 1) { + printf $fh "M104 %s%d ; set temperature\n", + ($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::temperature + if $Slic3r::temperature && $Slic3r::temperature != $Slic3r::first_layer_temperature; + } + # go to layer print $fh $extruder->change_layer($layer); diff --git a/slic3r.pl b/slic3r.pl index eeef4cbc..bc10c95e 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -133,6 +133,8 @@ Usage: slic3r.pl [ OPTIONS ] file.stl very little need to change this value, which is only useful to compensate for filament packing (default: $Slic3r::extrusion_multiplier) --temperature Extrusion temperature in degree Celsius, set 0 to disable (default: $Slic3r::temperature) + --first-layer-temperature Extrusion temperature for the first layer, in degree Celsius, + set 0 to disable (default: same as --temperature) Speed options: --travel-speed Speed of non-print moves in mm/s (default: $Slic3r::travel_speed)