mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-18 22:31:13 -06:00
ENH: add custom gcode back
Add custom gcode back, which can be inserted in gcode viewer layer slider. Signed-off-by: salt.wei <salt.wei@bambulab.com> Change-Id: I270cc438bedf11b30f07f8f9bad6ae5436d5a2dd
This commit is contained in:
parent
b0de324ea8
commit
b8d9a2fdf3
17 changed files with 185 additions and 65 deletions
|
@ -3189,7 +3189,7 @@ bool _3MF_Exporter::_add_custom_gcode_per_print_z_file_to_archive( mz_zip_archiv
|
|||
//BBS
|
||||
std::string gcode = //code.type == CustomGCode::ColorChange ? config->opt_string("color_change_gcode") :
|
||||
code.type == CustomGCode::PausePrint ? config->opt_string("machine_pause_gcode") :
|
||||
//code.type == CustomGCode::Template ? config->opt_string("template_custom_gcode") :
|
||||
code.type == CustomGCode::Template ? config->opt_string("template_custom_gcode") :
|
||||
code.type == CustomGCode::ToolChange ? "tool_change" : code.extra;
|
||||
code_tree.put("<xmlattr>.gcode" , gcode );
|
||||
}
|
||||
|
|
|
@ -1336,7 +1336,7 @@ bool load_amf(const char *path, DynamicPrintConfig *config, ConfigSubstitutionCo
|
|||
//BBS
|
||||
std::string gcode = //code.type == CustomGCode::ColorChange ? config->opt_string("color_change_gcode") :
|
||||
code.type == CustomGCode::PausePrint ? config->opt_string("machine_pause_gcode") :
|
||||
//code.type == CustomGCode::Template ? config->opt_string("template_custom_gcode") :
|
||||
code.type == CustomGCode::Template ? config->opt_string("template_custom_gcode") :
|
||||
code.type == CustomGCode::ToolChange ? "tool_change" : code.extra;
|
||||
code_tree.put("<xmlattr>.gcode" , gcode );
|
||||
}
|
||||
|
|
|
@ -5739,7 +5739,7 @@ bool _BBS_3MF_Exporter::_add_custom_gcode_per_print_z_file_to_archive( mz_zip_ar
|
|||
//BBS
|
||||
std::string gcode = //code.type == CustomGCode::ColorChange ? config->opt_string("color_change_gcode") :
|
||||
code.type == CustomGCode::PausePrint ? config->opt_string("machine_pause_gcode") :
|
||||
//code.type == CustomGCode::Template ? config->opt_string("template_custom_gcode") :
|
||||
code.type == CustomGCode::Template ? config->opt_string("template_custom_gcode") :
|
||||
code.type == CustomGCode::ToolChange ? "tool_change" : code.extra;
|
||||
code_tree.put("<xmlattr>.gcode" , gcode );
|
||||
}
|
||||
|
|
|
@ -866,7 +866,7 @@ namespace DoExport {
|
|||
//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);
|
||||
if (ret.size() < MAX_TAGS_COUNT) check(_(L("Template Custom G-code")), config.template_custom_gcode.value);
|
||||
if (ret.size() < MAX_TAGS_COUNT) {
|
||||
for (const std::string& value : config.filament_start_gcode.values) {
|
||||
check(_(L("Filament start G-code")), value);
|
||||
|
@ -2218,11 +2218,11 @@ namespace ProcessLayer
|
|||
// Extruder switches are processed by LayerTools, they should be filtered out.
|
||||
assert(custom_gcode->type != CustomGCode::ToolChange);
|
||||
|
||||
CustomGCode::Type gcode_type = custom_gcode->type;
|
||||
CustomGCode::Type gcode_type = custom_gcode->type;
|
||||
bool color_change = gcode_type == CustomGCode::ColorChange;
|
||||
bool tool_change = gcode_type == CustomGCode::ToolChange;
|
||||
bool tool_change = gcode_type == CustomGCode::ToolChange;
|
||||
// Tool Change is applied as Color Change for a single extruder printer only.
|
||||
assert(! tool_change || single_filament_print);
|
||||
assert(!tool_change || single_filament_print);
|
||||
|
||||
std::string pause_print_msg;
|
||||
int m600_extruder_before_layer = -1;
|
||||
|
@ -2230,13 +2230,13 @@ namespace ProcessLayer
|
|||
m600_extruder_before_layer = custom_gcode->extruder - 1;
|
||||
else if (gcode_type == CustomGCode::PausePrint)
|
||||
pause_print_msg = custom_gcode->extra;
|
||||
//BBS: inserting color gcode and template_custom_gcode is removed
|
||||
//BBS: inserting color gcode is removed
|
||||
#if 0
|
||||
// we should add or not colorprint_change in respect to nozzle_diameter count instead of really used extruders count
|
||||
if (color_change || tool_change)
|
||||
{
|
||||
assert(m600_extruder_before_layer >= 0);
|
||||
// Color Change or Tool Change as Color Change.
|
||||
// Color Change or Tool Change as Color Change.
|
||||
// add tag for processor
|
||||
gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Color_Change) + ",T" + std::to_string(m600_extruder_before_layer) + "," + custom_gcode->color + "\n";
|
||||
|
||||
|
@ -2258,20 +2258,19 @@ namespace ProcessLayer
|
|||
// see GH issue #6362
|
||||
gcodegen.writer().unretract();
|
||||
}
|
||||
}
|
||||
else {
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
if (gcode_type == CustomGCode::PausePrint) // Pause print
|
||||
{
|
||||
if (gcode_type == CustomGCode::PausePrint) // Pause print
|
||||
{
|
||||
// add tag for processor
|
||||
gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Pause_Print) + "\n";
|
||||
//! FIXME_in_fw show message during print pause
|
||||
//if (!pause_print_msg.empty())
|
||||
// gcode += "M117 " + pause_print_msg + "\n";
|
||||
//if (!pause_print_msg.empty())
|
||||
// gcode += "M117 " + pause_print_msg + "\n";
|
||||
gcode += gcodegen.placeholder_parser_process("machine_pause_gcode", config.machine_pause_gcode, current_extruder_id) + "\n";
|
||||
}
|
||||
#if 0
|
||||
else {
|
||||
else {
|
||||
// add tag for processor
|
||||
gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Custom_Code) + "\n";
|
||||
if (gcode_type == CustomGCode::Template) // Template Custom Gcode
|
||||
|
@ -2281,9 +2280,9 @@ namespace ProcessLayer
|
|||
|
||||
}
|
||||
gcode += "\n";
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
return gcode;
|
||||
|
|
|
@ -745,7 +745,7 @@ static std::vector<std::string> s_Preset_printer_options {
|
|||
"default_print_profile", "inherits",
|
||||
"silent_mode",
|
||||
// BBS
|
||||
"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "machine_pause_gcode",
|
||||
"scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time", "machine_pause_gcode", "template_custom_gcode",
|
||||
"nozzle_type", "auxiliary_fan", "nozzle_volume",
|
||||
//SoftFever
|
||||
"host_type", "print_host", "printhost_apikey",
|
||||
|
|
|
@ -1565,6 +1565,15 @@ void PrintConfigDef::init_fff_params()
|
|||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionString(""));
|
||||
|
||||
def = this->add("template_custom_gcode", coString);
|
||||
def->label = L("Custom G-code");
|
||||
def->tooltip = L("This G-code will be used as a custom code");
|
||||
def->multiline = true;
|
||||
def->full_width = true;
|
||||
def->height = 12;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionString(""));
|
||||
|
||||
{
|
||||
struct AxisDefault {
|
||||
std::string name;
|
||||
|
|
|
@ -782,6 +782,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
((ConfigOptionFloat, travel_speed_z))
|
||||
((ConfigOptionBool, silent_mode))
|
||||
((ConfigOptionString, machine_pause_gcode))
|
||||
((ConfigOptionString, template_custom_gcode))
|
||||
//BBS
|
||||
((ConfigOptionEnum<NozzleType>, nozzle_type))
|
||||
((ConfigOptionBool, auxiliary_fan))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue