NEW: insert Gcode between objects

Change-Id: Iec3535941390bfbd279a5677c352d92f36506d4c
Signed-off-by: wenjie.guo <wenjie.guo@bambulab.com>
(cherry picked from commit e0c5476e2e4c02055fb6ce7b4b4d927498c6ee90)
This commit is contained in:
wenjie.guo 2023-07-27 15:37:38 +08:00 committed by Lane.Wei
parent 163ff38c3b
commit 5076a3008a
6 changed files with 26 additions and 8 deletions

View File

@ -1012,8 +1012,7 @@ namespace DoExport {
if (ret.size() < MAX_TAGS_COUNT) check(_(L("Before layer change G-code")), config.before_layer_change_gcode.value);
if (ret.size() < MAX_TAGS_COUNT) check(_(L("Layer change G-code")), config.layer_change_gcode.value);
if (ret.size() < MAX_TAGS_COUNT) check(_(L("Change filament G-code")), config.change_filament_gcode.value);
//BBS
//if (ret.size() < MAX_TAGS_COUNT) check(_(L("Printing by object G-code")), config.printing_by_object_gcode.value);
if (ret.size() < MAX_TAGS_COUNT) check(_(L("Printing by object G-code")), config.printing_by_object_gcode.value);
//if (ret.size() < MAX_TAGS_COUNT) check(_(L("Color Change G-code")), config.color_change_gcode.value);
if (ret.size() < MAX_TAGS_COUNT) check(_(L("Pause G-code")), config.machine_pause_gcode.value);
if (ret.size() < MAX_TAGS_COUNT) check(_(L("Template Custom G-code")), config.template_custom_gcode.value);
@ -1993,10 +1992,8 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
// another one, set first layer temperatures. This happens before the Z move
// is triggered, so machine has more time to reach such temperatures.
m_placeholder_parser.set("current_object_idx", int(finished_objects));
// BBS: remove printing_by_object_gcode
// std::string printing_by_object_gcode = this->placeholder_parser_process("printing_by_object_gcode", print.config().printing_by_object_gcode.value,
// initial_extruder_id);
std::string printing_by_object_gcode;
std::string printing_by_object_gcode = this->placeholder_parser_process("printing_by_object_gcode", print.config().printing_by_object_gcode.value,
initial_extruder_id);
// Set first layer bed and extruder temperatures, don't wait for it to reach the temperature.
this->_print_first_layer_bed_temperature(file, print, printing_by_object_gcode, initial_extruder_id, false);
this->_print_first_layer_extruder_temperatures(file, print, printing_by_object_gcode, initial_extruder_id, false);

View File

@ -846,7 +846,7 @@ static std::vector<std::string> s_Preset_machine_limits_options {
static std::vector<std::string> s_Preset_printer_options {
"printer_technology",
"printable_area", "bed_exclude_area","bed_custom_texture", "bed_custom_model", "gcode_flavor",
"single_extruder_multi_material", "machine_start_gcode", "machine_end_gcode", "before_layer_change_gcode", "layer_change_gcode", "change_filament_gcode",
"single_extruder_multi_material", "machine_start_gcode", "machine_end_gcode","printing_by_object_gcode","before_layer_change_gcode", "layer_change_gcode", "change_filament_gcode",
"printer_model", "printer_variant", "printable_height", "extruder_clearance_radius", "extruder_clearance_max_radius","extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
"default_print_profile", "inherits",
"silent_mode",

View File

@ -87,6 +87,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
"deretraction_speed",
"close_fan_the_first_x_layers",
"machine_end_gcode",
"printing_by_object_gcode",
"filament_end_gcode",
"post_process",
"extruder_clearance_height_to_rod",

View File

@ -1021,6 +1021,15 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionString("M104 S0 ; turn off temperature\nG28 X0 ; home X axis\nM84 ; disable motors\n"));
def = this->add("printing_by_object_gcode", coString);
def->label = L("Between Object Gcode");
def->tooltip = L("Insert Gcode between objects. This parameter will only come into effect when you print your models object by object");
def->multiline = true;
def->full_width = true;
def->height = 12;
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionString(""));
def = this->add("filament_end_gcode", coStrings);
def->label = L("End G-code");
def->tooltip = L("End G-code when finish the printing of this filament");

View File

@ -819,7 +819,8 @@ PRINT_CONFIG_CLASS_DEFINE(
PRINT_CONFIG_CLASS_DEFINE(
GCodeConfig,
((ConfigOptionString, before_layer_change_gcode))
((ConfigOptionString, before_layer_change_gcode))
((ConfigOptionString, printing_by_object_gcode))
((ConfigOptionFloats, deretraction_speed))
//BBS
((ConfigOptionBool, enable_arc_fitting))

View File

@ -3129,6 +3129,16 @@ void TabPrinter::build_fff()
option.opt.is_code = true;
option.opt.height = gcode_field_height;//150;
optgroup->append_single_option_line(option);
optgroup = page->new_optgroup(L("Printing by object G-code"), L"param_gcode", 0);
optgroup->m_on_change = [this, optgroup](const t_config_option_key &opt_key, const boost::any &value) {
validate_custom_gcode_cb(this, optgroup, opt_key, value);
};
option = optgroup->get_option("printing_by_object_gcode");
option.opt.full_width = true;
option.opt.is_code = true;
option.opt.height = gcode_field_height; // 150;
optgroup->append_single_option_line(option);
#if 0
optgroup = page->new_optgroup(L("Before layer change G-code"), 0);
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {