mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-13 23:35:57 +08:00
#4569 Added new gcode placeholder, [filament_extruder_id] that is only valid in filament start/end gcode and refers to which position this filament is loaded in.
This commit is contained in:
parent
d9c1d459c5
commit
5509afa82a
@ -160,7 +160,10 @@ sub export {
|
||||
$self->_print_first_layer_temperature(0)
|
||||
if $include_start_extruder_temp;
|
||||
printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($self->config->start_gcode));
|
||||
my $filament_extruder = 0;
|
||||
foreach my $start_gcode (@{ $self->config->start_filament_gcode }) { # process filament gcode in order
|
||||
$gcodegen->placeholder_parser->set("filament_extruder_id", $filament_extruder);
|
||||
$filament_extruder++;
|
||||
printf $fh "%s\n", Slic3r::ConditionalGCode::apply_math($gcodegen->placeholder_parser->process($start_gcode));
|
||||
}
|
||||
$self->_print_first_layer_temperature(1)
|
||||
@ -303,7 +306,10 @@ sub export {
|
||||
# write end commands to file
|
||||
print $fh $gcodegen->retract; # TODO: process this retract through PressureRegulator in order to discharge fully
|
||||
print $fh $gcodegen->writer->set_fan(0);
|
||||
my $filament_extruder = 0;
|
||||
foreach my $end_gcode (@{ $self->config->end_filament_gcode }) { # Process filament-specific gcode in extruder order.
|
||||
$gcodegen->placeholder_parser->set("filament_extruder_id", $filament_extruder);
|
||||
$filament_extruder++;
|
||||
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));
|
||||
|
@ -131,7 +131,9 @@ PrintGCode::output()
|
||||
// Apply gcode math to start gcode
|
||||
fh << apply_math(gcodegen.placeholder_parser->process(config.start_gcode.value));
|
||||
|
||||
auto filament_extruder {0U};
|
||||
for(const auto& start_gcode : config.start_filament_gcode.values) {
|
||||
gcodegen.placeholder_parser->set("filament_extruder", filament_extruder++);
|
||||
fh << apply_math(gcodegen.placeholder_parser->process(start_gcode));
|
||||
}
|
||||
|
||||
@ -278,7 +280,10 @@ PrintGCode::output()
|
||||
|
||||
// Write end commands to file.
|
||||
fh << gcodegen.retract(); // TODO: process this retract through PressureRegulator in order to discharge fully
|
||||
|
||||
auto filament_extruder {0U};
|
||||
for(const auto& end_gcode : config.end_filament_gcode.values) {
|
||||
gcodegen.placeholder_parser->set("filament_extruder", filament_extruder++);
|
||||
fh << apply_math(gcodegen.placeholder_parser->process(end_gcode));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user