mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
Add a command to lift nozzle in default start G-code
This commit is contained in:
parent
d50e0af548
commit
e71bf48463
2 changed files with 8 additions and 5 deletions
|
@ -635,7 +635,10 @@ our $Options = {
|
||||||
height => 120,
|
height => 120,
|
||||||
serialize => sub { join '\n', split /\R+/, $_[0] },
|
serialize => sub { join '\n', split /\R+/, $_[0] },
|
||||||
deserialize => sub { join "\n", split /\\n/, $_[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' => {
|
'end_gcode' => {
|
||||||
label => 'End G-code',
|
label => 'End G-code',
|
||||||
|
|
|
@ -696,25 +696,25 @@ sub write_gcode {
|
||||||
);
|
);
|
||||||
my $min_print_speed = 60 * $Slic3r::Config->min_print_speed;
|
my $min_print_speed = 60 * $Slic3r::Config->min_print_speed;
|
||||||
my $dec = $gcodegen->dec;
|
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;
|
print $fh $gcodegen->set_fan(0, 1) if $Slic3r::Config->cooling && $Slic3r::Config->disable_fan_first_layers;
|
||||||
|
|
||||||
# write start commands to file
|
# write start commands to file
|
||||||
printf $fh $gcodegen->set_bed_temperature($Slic3r::Config->first_layer_bed_temperature, 1),
|
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 {
|
my $print_first_layer_temperature = sub {
|
||||||
for my $t (grep $self->extruders->[$_], 0 .. $#{$Slic3r::Config->first_layer_temperature}) {
|
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)
|
printf $fh $gcodegen->set_temperature($self->extruders->[$t]->first_layer_temperature, 0, $t)
|
||||||
if $self->extruders->[$t]->first_layer_temperature;
|
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);
|
printf $fh "%s\n", $Slic3r::Config->replace_options($Slic3r::Config->start_gcode);
|
||||||
for my $t (grep $self->extruders->[$_], 0 .. $#{$Slic3r::Config->first_layer_temperature}) {
|
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)
|
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 "G90 ; use absolute coordinates\n";
|
||||||
print $fh "G21 ; set units to millimeters\n";
|
|
||||||
if ($Slic3r::Config->gcode_flavor =~ /^(?:reprap|teacup)$/) {
|
if ($Slic3r::Config->gcode_flavor =~ /^(?:reprap|teacup)$/) {
|
||||||
printf $fh $gcodegen->reset_e;
|
printf $fh $gcodegen->reset_e;
|
||||||
if ($Slic3r::Config->gcode_flavor =~ /^(?:reprap|makerbot|sailfish)$/) {
|
if ($Slic3r::Config->gcode_flavor =~ /^(?:reprap|makerbot|sailfish)$/) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue