diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 30514e12b..bfc9fcc11 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -96,12 +96,23 @@ our $Options = { cli => 'first-layer-temperature=i', type => 'i', }, + 'first_layer_bed_temperature' => { + label => 'First layer bed temperature (°C)', + cli => 'first-layer-bed-temperature=i', + type => 'i', + }, 'temperature' => { label => 'Temperature (°C)', cli => 'temperature=i', type => 'i', important => 1, }, + 'bed_temperature' => { + label => 'Bed Temperature (°C)', + cli => 'bed-temperature=i', + type => 'i', + important => 1, + }, # speed options 'travel_speed' => { @@ -596,6 +607,12 @@ sub validate { # --bridge-flow-ratio die "Invalid value for --bridge-flow-ratio\n" if $Slic3r::bridge_flow_ratio <= 0; + + # --first_layer_temperature + $Slic3r::first_layer_temperature = $Slic3r::temperature unless $Slic3r::first_layer_temperature; + + # --first-layer-bed-temperature + $Slic3r::first_layer_bed_temperature = $Slic3r::bed_temperature unless $Slic3r::first_layer_bed_temperature; # G-code flavors $Slic3r::extrusion_axis = 'A' if $Slic3r::gcode_flavor eq 'mach3'; diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 042a6c190..d169ddc78 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -586,6 +586,9 @@ sub export_gcode { print $fh "\n"; # write start commands to file + printf $fh "M190 %s%d ; set bed temperature\n", + ($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::first_layer_bed_temperature + if $Slic3r::first_layer_bed_temperature && $Slic3r::start_gcode !~ /M190/i; printf $fh "M104 %s%d ; set temperature\n", ($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::first_layer_temperature if $Slic3r::first_layer_temperature; @@ -626,6 +629,9 @@ sub export_gcode { 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; + printf $fh "M140 %s%d ; set bed temperature\n", + ($Slic3r::gcode_flavor eq 'mach3' ? 'P' : 'S'), $Slic3r::bed_temperature + if $Slic3r::bed_temperature && $Slic3r::bed_temperature != $Slic3r::first_layer_bed_temperature; } # go to layer