diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index 01891fd70c..324a51975d 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -635,7 +635,10 @@ our $Options = { height => 120, serialize => sub { join '\n', split /\R+/, $_[0] }, deserialize => sub { join "\n", split /\\n/, $_[0] }, - default => 'G28 ; home all axes', + default => <<'END', +G28 ; home all axes +G1 Z5 F5000 ; lift nozzle +END }, 'end_gcode' => { label => 'End G-code', diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index c32c97aa2b..23b05e92cb 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -696,25 +696,25 @@ sub write_gcode { ); my $min_print_speed = 60 * $Slic3r::Config->min_print_speed; my $dec = $gcodegen->dec; + print $fh "G21 ; set units to millimeters\n"; print $fh $gcodegen->set_fan(0, 1) if $Slic3r::Config->cooling && $Slic3r::Config->disable_fan_first_layers; # write start commands to file printf $fh $gcodegen->set_bed_temperature($Slic3r::Config->first_layer_bed_temperature, 1), - if $Slic3r::Config->first_layer_bed_temperature && $Slic3r::Config->start_gcode !~ /M190/i; + if $Slic3r::Config->first_layer_bed_temperature && $Slic3r::Config->start_gcode !~ /M(?:190|140)/i; my $print_first_layer_temperature = sub { for my $t (grep $self->extruders->[$_], 0 .. $#{$Slic3r::Config->first_layer_temperature}) { printf $fh $gcodegen->set_temperature($self->extruders->[$t]->first_layer_temperature, 0, $t) if $self->extruders->[$t]->first_layer_temperature; } }; - $print_first_layer_temperature->(); + $print_first_layer_temperature->() if $Slic3r::Config->start_gcode !~ /M(?:109|104)/i; printf $fh "%s\n", $Slic3r::Config->replace_options($Slic3r::Config->start_gcode); for my $t (grep $self->extruders->[$_], 0 .. $#{$Slic3r::Config->first_layer_temperature}) { printf $fh $gcodegen->set_temperature($self->extruders->[$t]->first_layer_temperature, 1, $t) - if $self->extruders->[$t]->first_layer_temperature && $Slic3r::Config->start_gcode !~ /M109/i; + if $self->extruders->[$t]->first_layer_temperature && $Slic3r::Config->start_gcode !~ /M(?:109|104)/i; } print $fh "G90 ; use absolute coordinates\n"; - print $fh "G21 ; set units to millimeters\n"; if ($Slic3r::Config->gcode_flavor =~ /^(?:reprap|teacup)$/) { printf $fh $gcodegen->reset_e; if ($Slic3r::Config->gcode_flavor =~ /^(?:reprap|makerbot|sailfish)$/) {