mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-01 03:52:04 +08:00
If M190, M109, M104, or M140 commands are not present in end gcode, append commands to shut off all hotends and the bed (same as start gcode).
This commit is contained in:
parent
2c93cf9019
commit
d8a743d177
@ -153,6 +153,10 @@ sub export {
|
|||||||
foreach my $start_gcode (@{ $self->config->start_filament_gcode }) { # process filament gcode in order
|
foreach my $start_gcode (@{ $self->config->start_filament_gcode }) { # process filament gcode in order
|
||||||
$include_start_extruder_temp = $include_start_extruder_temp && ($start_gcode !~ /M(?:109|104)/i);
|
$include_start_extruder_temp = $include_start_extruder_temp && ($start_gcode !~ /M(?:109|104)/i);
|
||||||
}
|
}
|
||||||
|
my $include_end_extruder_temp = $self->config->end_gcode !~ /M(?:109|104)/i;
|
||||||
|
foreach my $end_gcode (@{ $self->config->end_filament_gcode }) { # process filament gcode in order
|
||||||
|
$include_end_extruder_temp = $include_end_extruder_temp && ($end_gcode !~ /M(?:109|104)/i);
|
||||||
|
}
|
||||||
$self->_print_first_layer_temperature(0)
|
$self->_print_first_layer_temperature(0)
|
||||||
if $include_start_extruder_temp;
|
if $include_start_extruder_temp;
|
||||||
printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($self->config->start_gcode));
|
printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($self->config->start_gcode));
|
||||||
@ -301,6 +305,12 @@ sub export {
|
|||||||
printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($end_gcode));
|
printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($end_gcode));
|
||||||
}
|
}
|
||||||
printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($self->config->end_gcode));
|
printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($self->config->end_gcode));
|
||||||
|
|
||||||
|
$self->_print_off_temperature(0)
|
||||||
|
if $include_end_extruder_temp;
|
||||||
|
print $fh $self->_gcodegen->writer->set_bed_temperature(0, 0)
|
||||||
|
if $include_end_extruder_temp;
|
||||||
|
|
||||||
print $fh $gcodegen->writer->update_progress($gcodegen->layer_count, $gcodegen->layer_count, 1); # 100%
|
print $fh $gcodegen->writer->update_progress($gcodegen->layer_count, $gcodegen->layer_count, 1); # 100%
|
||||||
print $fh $gcodegen->writer->postamble;
|
print $fh $gcodegen->writer->postamble;
|
||||||
|
|
||||||
@ -356,6 +366,16 @@ sub _print_first_layer_temperature {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _print_off_temperature {
|
||||||
|
my ($self, $wait) = @_;
|
||||||
|
|
||||||
|
for my $t (@{$self->print->extruders}) {
|
||||||
|
printf {$self->fh} $self->_gcodegen->writer->set_temperature(0, $wait, $t)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Called per object's layer.
|
# Called per object's layer.
|
||||||
# First a $gcode string is collected,
|
# First a $gcode string is collected,
|
||||||
# then filtered and finally written to a file $fh.
|
# then filtered and finally written to a file $fh.
|
||||||
|
@ -221,7 +221,7 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
|
|
||||||
def = this->add("end_gcode", coString);
|
def = this->add("end_gcode", coString);
|
||||||
def->label = "End G-code";
|
def->label = "End G-code";
|
||||||
def->tooltip = "This end procedure is inserted at the end of the output file. Note that you can use placeholder variables for all Slic3r settings.";
|
def->tooltip = "This end procedure is inserted at the end of the output file. Note that you can use placeholder variables for all Slic3r settings. If Slic3r detects M104, M109, M140 or M190 in your custom codes, such commands will not be prepended automatically so you're free to customize the order of heating commands and other custom actions.";
|
||||||
def->cli = "end-gcode=s";
|
def->cli = "end-gcode=s";
|
||||||
def->multiline = true;
|
def->multiline = true;
|
||||||
def->full_width = true;
|
def->full_width = true;
|
||||||
@ -230,7 +230,7 @@ PrintConfigDef::PrintConfigDef()
|
|||||||
|
|
||||||
def = this->add("end_filament_gcode", coStrings);
|
def = this->add("end_filament_gcode", coStrings);
|
||||||
def->label = "End G-code";
|
def->label = "End G-code";
|
||||||
def->tooltip = "This end procedure is inserted at the end of the output file, before the printer end gcode. Note that you can use placeholder variables for all Slic3r settings. If you have multiple extruders, the gcode is processed in extruder order.";
|
def->tooltip = "This end procedure is inserted at the end of the output file, before the printer end gcode. Note that you can use placeholder variables for all Slic3r settings. If you have multiple extruders, the gcode is processed in extruder order. If Slic3r detects M104, M109, M140 or M190 in your custom codes, such commands will not be prepended automatically so you're free to customize the order of heating commands and other custom actions.";
|
||||||
def->cli = "end-filament-gcode=s@";
|
def->cli = "end-filament-gcode=s@";
|
||||||
def->multiline = true;
|
def->multiline = true;
|
||||||
def->full_width = true;
|
def->full_width = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user