mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 09:47:58 -06:00
Add "Manual filament change" option and logic (#2379)
* Add "Manual filament change" option and logic * make suggested changes * make suggested changes * change tag from "CHANGE_TOOL" to "MANUAL_TOOL_CHANGE" * some tweaks * More fixes --------- Co-authored-by: SoftFever <softfeverever@gmail.com> Co-authored-by: SoftFever <103989404+SoftFever@users.noreply.github.com>
This commit is contained in:
parent
90601c098a
commit
f84e94faf7
8 changed files with 32 additions and 5 deletions
|
@ -5431,7 +5431,8 @@ std::string GCode::set_extruder(unsigned int extruder_id, double print_z)
|
||||||
// Process the custom change_filament_gcode.
|
// Process the custom change_filament_gcode.
|
||||||
const std::string& change_filament_gcode = m_config.change_filament_gcode.value;
|
const std::string& change_filament_gcode = m_config.change_filament_gcode.value;
|
||||||
std::string toolchange_gcode_parsed;
|
std::string toolchange_gcode_parsed;
|
||||||
if (!change_filament_gcode.empty()) {
|
//Orca: Ignore change_filament_gcode if is the first call for a tool change and manual_filament_change is enabled
|
||||||
|
if (!change_filament_gcode.empty() && !(m_config.manual_filament_change.value && m_toolchange_count == 1)) {
|
||||||
toolchange_gcode_parsed = placeholder_parser_process("change_filament_gcode", change_filament_gcode, extruder_id, &dyn_config);
|
toolchange_gcode_parsed = placeholder_parser_process("change_filament_gcode", change_filament_gcode, extruder_id, &dyn_config);
|
||||||
check_add_eol(toolchange_gcode_parsed);
|
check_add_eol(toolchange_gcode_parsed);
|
||||||
gcode += toolchange_gcode_parsed;
|
gcode += toolchange_gcode_parsed;
|
||||||
|
|
|
@ -60,6 +60,7 @@ const std::vector<std::string> GCodeProcessor::Reserved_Tags = {
|
||||||
"_GP_LAST_LINE_M73_PLACEHOLDER",
|
"_GP_LAST_LINE_M73_PLACEHOLDER",
|
||||||
"_GP_ESTIMATED_PRINTING_TIME_PLACEHOLDER",
|
"_GP_ESTIMATED_PRINTING_TIME_PLACEHOLDER",
|
||||||
"_GP_TOTAL_LAYER_NUMBER_PLACEHOLDER",
|
"_GP_TOTAL_LAYER_NUMBER_PLACEHOLDER",
|
||||||
|
" MANUAL_TOOL_CHANGE ",
|
||||||
"_DURING_PRINT_EXHAUST_FAN"
|
"_DURING_PRINT_EXHAUST_FAN"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -76,7 +77,8 @@ const std::vector<std::string> GCodeProcessor::Reserved_Tags_compatible = {
|
||||||
"_GP_FIRST_LINE_M73_PLACEHOLDER",
|
"_GP_FIRST_LINE_M73_PLACEHOLDER",
|
||||||
"_GP_LAST_LINE_M73_PLACEHOLDER",
|
"_GP_LAST_LINE_M73_PLACEHOLDER",
|
||||||
"_GP_ESTIMATED_PRINTING_TIME_PLACEHOLDER",
|
"_GP_ESTIMATED_PRINTING_TIME_PLACEHOLDER",
|
||||||
"_GP_TOTAL_LAYER_NUMBER_PLACEHOLDER"
|
"_GP_TOTAL_LAYER_NUMBER_PLACEHOLDER",
|
||||||
|
" MANUAL_TOOL_CHANGE "
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -1010,7 +1012,9 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
|
||||||
if (spiral_vase != nullptr)
|
if (spiral_vase != nullptr)
|
||||||
m_spiral_vase_active = spiral_vase->value;
|
m_spiral_vase_active = spiral_vase->value;
|
||||||
|
|
||||||
|
const ConfigOptionBool* manual_filament_change = config.option<ConfigOptionBool>("manual_filament_change");
|
||||||
|
if (manual_filament_change != nullptr)
|
||||||
|
m_manual_filament_change = manual_filament_change->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
||||||
|
@ -2108,6 +2112,13 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers
|
||||||
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid value for Width (" << comment << ").";
|
BOOST_LOG_TRIVIAL(error) << "GCodeProcessor encountered an invalid value for Width (" << comment << ").";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Orca: manual tool change tag
|
||||||
|
if (m_manual_filament_change && boost::starts_with(comment, reserved_tag(ETags::Manual_Tool_Change))) {
|
||||||
|
std::string_view tool_change_cmd = comment.substr(reserved_tag(ETags::Manual_Tool_Change).length());
|
||||||
|
if (boost::starts_with(tool_change_cmd, "T")) {
|
||||||
|
process_T(tool_change_cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// color change tag
|
// color change tag
|
||||||
|
|
|
@ -260,6 +260,7 @@ namespace Slic3r {
|
||||||
Last_Line_M73_Placeholder,
|
Last_Line_M73_Placeholder,
|
||||||
Estimated_Printing_Time_Placeholder,
|
Estimated_Printing_Time_Placeholder,
|
||||||
Total_Layer_Number_Placeholder,
|
Total_Layer_Number_Placeholder,
|
||||||
|
Manual_Tool_Change,
|
||||||
During_Print_Exhaust_Fan
|
During_Print_Exhaust_Fan
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -637,6 +638,7 @@ namespace Slic3r {
|
||||||
bool m_wiping;
|
bool m_wiping;
|
||||||
bool m_flushing;
|
bool m_flushing;
|
||||||
float m_remaining_volume;
|
float m_remaining_volume;
|
||||||
|
bool m_manual_filament_change;
|
||||||
|
|
||||||
//BBS: x, y offset for gcode generated
|
//BBS: x, y offset for gcode generated
|
||||||
double m_x_offset{ 0 };
|
double m_x_offset{ 0 };
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <GCode/GCodeProcessor.hpp>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <boost/spirit/include/karma.hpp>
|
#include <boost/spirit/include/karma.hpp>
|
||||||
|
@ -312,7 +313,8 @@ std::string GCodeWriter::update_progress(unsigned int num, unsigned int tot, boo
|
||||||
|
|
||||||
std::string GCodeWriter::toolchange_prefix() const
|
std::string GCodeWriter::toolchange_prefix() const
|
||||||
{
|
{
|
||||||
return FLAVOR_IS(gcfMakerWare) ? "M135 T" :
|
return config.manual_filament_change ? ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Manual_Tool_Change) + "T":
|
||||||
|
FLAVOR_IS(gcfMakerWare) ? "M135 T" :
|
||||||
FLAVOR_IS(gcfSailfish) ? "M108 T" : "T";
|
FLAVOR_IS(gcfSailfish) ? "M108 T" : "T";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -818,7 +818,7 @@ static std::vector<std::string> s_Preset_printer_options {
|
||||||
"printer_technology",
|
"printer_technology",
|
||||||
"printable_area", "bed_exclude_area","bed_custom_texture", "bed_custom_model", "gcode_flavor",
|
"printable_area", "bed_exclude_area","bed_custom_texture", "bed_custom_model", "gcode_flavor",
|
||||||
"fan_kickstart", "fan_speedup_time", "fan_speedup_overhangs",
|
"fan_kickstart", "fan_speedup_time", "fan_speedup_overhangs",
|
||||||
"single_extruder_multi_material", "machine_start_gcode", "machine_end_gcode", "before_layer_change_gcode", "layer_change_gcode", "time_lapse_gcode", "change_filament_gcode",
|
"single_extruder_multi_material", "manual_filament_change", "machine_start_gcode", "machine_end_gcode", "before_layer_change_gcode", "layer_change_gcode", "time_lapse_gcode", "change_filament_gcode",
|
||||||
"printer_model", "printer_variant", "printable_height", "extruder_clearance_radius", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
|
"printer_model", "printer_variant", "printable_height", "extruder_clearance_radius", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
|
||||||
"default_print_profile", "inherits",
|
"default_print_profile", "inherits",
|
||||||
"silent_mode",
|
"silent_mode",
|
||||||
|
|
|
@ -3367,6 +3367,14 @@ def = this->add("filament_loading_speed", coFloats);
|
||||||
def->readonly = true;
|
def->readonly = true;
|
||||||
def->set_default_value(new ConfigOptionBool(true));
|
def->set_default_value(new ConfigOptionBool(true));
|
||||||
|
|
||||||
|
def = this->add("manual_filament_change", coBool);
|
||||||
|
def->label = L("Manual Filament Change");
|
||||||
|
def->tooltip = L("Enable this option to omit the custom Change filament G-code only at the beginning of the print. "
|
||||||
|
"The tool change command (e.g., T0) will be skipped throughout the entire print. "
|
||||||
|
"This is useful for manual multi-material printing, where we use M600/PAUSE to trigger the manual filament change action.");
|
||||||
|
def->mode = comAdvanced;
|
||||||
|
def->set_default_value(new ConfigOptionBool(false));
|
||||||
|
|
||||||
def = this->add("purge_in_prime_tower", coBool);
|
def = this->add("purge_in_prime_tower", coBool);
|
||||||
def->label = L("Purge in prime tower");
|
def->label = L("Purge in prime tower");
|
||||||
def->tooltip = L("Purge remaining filament into prime tower");
|
def->tooltip = L("Purge remaining filament into prime tower");
|
||||||
|
|
|
@ -944,6 +944,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
||||||
((ConfigOptionString, machine_start_gcode))
|
((ConfigOptionString, machine_start_gcode))
|
||||||
((ConfigOptionStrings, filament_start_gcode))
|
((ConfigOptionStrings, filament_start_gcode))
|
||||||
((ConfigOptionBool, single_extruder_multi_material))
|
((ConfigOptionBool, single_extruder_multi_material))
|
||||||
|
((ConfigOptionBool, manual_filament_change))
|
||||||
((ConfigOptionBool, single_extruder_multi_material_priming))
|
((ConfigOptionBool, single_extruder_multi_material_priming))
|
||||||
((ConfigOptionBool, wipe_tower_no_sparse_layers))
|
((ConfigOptionBool, wipe_tower_no_sparse_layers))
|
||||||
((ConfigOptionString, change_filament_gcode))
|
((ConfigOptionString, change_filament_gcode))
|
||||||
|
|
|
@ -3480,6 +3480,8 @@ void TabPrinter::build_unregular_pages(bool from_initial_build/* = false*/)
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
optgroup->append_single_option_line("manual_filament_change");
|
||||||
|
|
||||||
optgroup = page->new_optgroup(L("Wipe tower"));
|
optgroup = page->new_optgroup(L("Wipe tower"));
|
||||||
optgroup->append_single_option_line("purge_in_prime_tower");
|
optgroup->append_single_option_line("purge_in_prime_tower");
|
||||||
optgroup->append_single_option_line("enable_filament_ramming");
|
optgroup->append_single_option_line("enable_filament_ramming");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue