mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-29 14:52:00 +08:00
Merge pull request #4577 from slic3r/filament-extruder
Add [filament_extruder_id] and revert work done for [filament_settings_id]
This commit is contained in:
commit
4fcbebf0ff
@ -1046,7 +1046,6 @@ sub build {
|
||||
my $optgroup = $page->new_optgroup('Optional information');
|
||||
$optgroup->append_single_option_line('filament_density', 0);
|
||||
$optgroup->append_single_option_line('filament_cost', 0);
|
||||
$optgroup->append_single_option_line('filament_settings_id', 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
$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));
|
||||
|
@ -447,15 +447,8 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->default_value = opt;
|
||||
}
|
||||
|
||||
def = this->add("filament_settings_id", coStrings);
|
||||
def->label = __TRANS("Custom GCode ID");
|
||||
def->tooltip = __TRANS("Identifer for this filament. Used to mark specific filament profiles for custom gcode.");
|
||||
def->cli = "filament-settings-id=s@";
|
||||
{
|
||||
ConfigOptionStrings* opt = new ConfigOptionStrings();
|
||||
opt->values.push_back("");
|
||||
def->default_value = opt;
|
||||
}
|
||||
def = this->add("filament_settings_id", coString);
|
||||
def->default_value = new ConfigOptionString("");
|
||||
|
||||
def = this->add("fill_angle", coFloat);
|
||||
def->label = __TRANS("Fill angle");
|
||||
|
@ -336,7 +336,6 @@ class GCodeConfig : public virtual StaticPrintConfig
|
||||
ConfigOptionFloats filament_cost;
|
||||
ConfigOptionFloats filament_max_volumetric_speed;
|
||||
ConfigOptionStrings filament_notes;
|
||||
ConfigOptionStrings filament_settings_id;
|
||||
ConfigOptionBool gcode_comments;
|
||||
ConfigOptionEnum<GCodeFlavor> gcode_flavor;
|
||||
ConfigOptionBool label_printed_objects;
|
||||
@ -381,7 +380,6 @@ class GCodeConfig : public virtual StaticPrintConfig
|
||||
OPT_PTR(filament_cost);
|
||||
OPT_PTR(filament_max_volumetric_speed);
|
||||
OPT_PTR(filament_notes);
|
||||
OPT_PTR(filament_settings_id);
|
||||
OPT_PTR(gcode_comments);
|
||||
OPT_PTR(gcode_flavor);
|
||||
OPT_PTR(label_printed_objects);
|
||||
|
@ -130,9 +130,12 @@ PrintGCode::output()
|
||||
|
||||
// Apply gcode math to start gcode
|
||||
fh << apply_math(gcodegen.placeholder_parser->process(config.start_gcode.value));
|
||||
|
||||
for(const auto& start_gcode : config.start_filament_gcode.values) {
|
||||
fh << apply_math(gcodegen.placeholder_parser->process(start_gcode));
|
||||
{
|
||||
auto filament_extruder {0U};
|
||||
for(const auto& start_gcode : config.start_filament_gcode.values) {
|
||||
gcodegen.placeholder_parser->set("filament_extruder_id", filament_extruder++);
|
||||
fh << apply_math(gcodegen.placeholder_parser->process(start_gcode));
|
||||
}
|
||||
}
|
||||
|
||||
if (include_start_extruder_temp) this->_print_first_layer_temperature(1);
|
||||
@ -278,8 +281,13 @@ PrintGCode::output()
|
||||
|
||||
// Write end commands to file.
|
||||
fh << gcodegen.retract(); // TODO: process this retract through PressureRegulator in order to discharge fully
|
||||
for(const auto& end_gcode : config.end_filament_gcode.values) {
|
||||
fh << apply_math(gcodegen.placeholder_parser->process(end_gcode));
|
||||
|
||||
{
|
||||
auto filament_extruder {0U};
|
||||
for(const auto& end_gcode : config.end_filament_gcode.values) {
|
||||
gcodegen.placeholder_parser->set("filament_extruder_id", filament_extruder++);
|
||||
fh << apply_math(gcodegen.placeholder_parser->process(end_gcode));
|
||||
}
|
||||
}
|
||||
|
||||
fh << apply_math(gcodegen.placeholder_parser->process(config.end_gcode));
|
||||
|
Loading…
x
Reference in New Issue
Block a user