mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-08 07:27:41 -06:00
parent
0cee513416
commit
a6c927d87f
8 changed files with 37 additions and 6 deletions
|
@ -403,6 +403,8 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
|||
if (in.f == nullptr)
|
||||
throw Slic3r::RuntimeError(std::string("Time estimator post process export failed.\nCannot open file for reading.\n"));
|
||||
|
||||
const bool disable_m73 = this->disable_m73;
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": before process %1%")%filename.c_str();
|
||||
// temporary file to contain modified gcode
|
||||
std::string out_path = filename + ".postprocess";
|
||||
|
@ -473,7 +475,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
|||
// replace placeholder lines with the proper final value
|
||||
// gcode_line is in/out parameter, to reduce expensive memory allocation
|
||||
auto process_placeholders = [&](std::string& gcode_line) {
|
||||
unsigned int extra_lines_count = 0;
|
||||
int extra_lines_count = 0;
|
||||
|
||||
// remove trailing '\n'
|
||||
auto line = std::string_view(gcode_line).substr(0, gcode_line.length() - 1);
|
||||
|
@ -482,6 +484,12 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
|||
if (line.length() > 1) {
|
||||
line = line.substr(1);
|
||||
if (line == reserved_tag(ETags::First_Line_M73_Placeholder) || line == reserved_tag(ETags::Last_Line_M73_Placeholder)) {
|
||||
if (disable_m73) {
|
||||
// Remove current line
|
||||
gcode_line = "";
|
||||
return std::tuple(true, -1);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
|
||||
const TimeMachine& machine = machines[i];
|
||||
if (machine.enabled) {
|
||||
|
@ -679,9 +687,10 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
|||
gcode_line += '\n';
|
||||
// replace placeholder lines
|
||||
auto [processed, lines_added_count] = process_placeholders(gcode_line);
|
||||
if (processed && lines_added_count > 0)
|
||||
if (processed && lines_added_count != 0)
|
||||
offsets.push_back({ line_id, lines_added_count });
|
||||
if (! processed && ! is_temporary_decoration(gcode_line) &&
|
||||
|
||||
if (!disable_m73 && !processed &&!is_temporary_decoration(gcode_line) &&
|
||||
(GCodeReader::GCodeLine::cmd_is(gcode_line, "G1") ||
|
||||
GCodeReader::GCodeLine::cmd_is(gcode_line, "G2") ||
|
||||
GCodeReader::GCodeLine::cmd_is(gcode_line, "G3"))) {
|
||||
|
@ -691,6 +700,12 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
|||
offsets.push_back({ line_id, extra_lines_count });
|
||||
}
|
||||
|
||||
if (disable_m73 && !processed && GCodeReader::GCodeLine::cmd_is(gcode_line, "M73")) {
|
||||
// Remove any existing M73 command
|
||||
gcode_line = "";
|
||||
offsets.push_back({line_id, -1});
|
||||
}
|
||||
|
||||
export_line += gcode_line;
|
||||
if (export_line.length() > 65535)
|
||||
write_string(export_line);
|
||||
|
@ -1041,6 +1056,8 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
|
|||
DEFAULT_TRAVEL_ACCELERATION;
|
||||
}
|
||||
|
||||
m_time_processor.disable_m73 = config.disable_m73;
|
||||
|
||||
const ConfigOptionFloat* initial_layer_print_height = config.option<ConfigOptionFloat>("initial_layer_print_height");
|
||||
if (initial_layer_print_height != nullptr)
|
||||
m_first_layer_height = std::abs(initial_layer_print_height->value);
|
||||
|
|
|
@ -478,6 +478,7 @@ namespace Slic3r {
|
|||
// Additional load / unload times for a filament exchange sequence.
|
||||
float filament_load_times;
|
||||
float filament_unload_times;
|
||||
bool disable_m73;
|
||||
|
||||
std::array<TimeMachine, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)> machines;
|
||||
|
||||
|
|
|
@ -342,6 +342,10 @@ std::string GCodeWriter::update_progress(unsigned int num, unsigned int tot, boo
|
|||
if (FLAVOR_IS_NOT(gcfMakerWare) && FLAVOR_IS_NOT(gcfSailfish))
|
||||
return "";
|
||||
|
||||
if (config.disable_m73) {
|
||||
return "";
|
||||
}
|
||||
|
||||
unsigned int percent = (unsigned int)floor(100.0 * num / tot + 0.5);
|
||||
if (!allow_100) percent = std::min(percent, (unsigned int)99);
|
||||
|
||||
|
|
|
@ -877,7 +877,8 @@ static std::vector<std::string> s_Preset_printer_options {
|
|||
"use_firmware_retraction", "use_relative_e_distances", "printer_notes",
|
||||
"cooling_tube_retraction",
|
||||
"cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "purge_in_prime_tower", "enable_filament_ramming",
|
||||
"z_offset"
|
||||
"z_offset",
|
||||
"disable_m73",
|
||||
};
|
||||
|
||||
static std::vector<std::string> s_Preset_sla_print_options {
|
||||
|
|
|
@ -206,8 +206,8 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||
"during_print_exhaust_fan_speed",
|
||||
"complete_print_exhaust_fan_speed",
|
||||
"activate_chamber_temp_control",
|
||||
"manual_filament_change"
|
||||
|
||||
"manual_filament_change",
|
||||
"disable_m73",
|
||||
};
|
||||
|
||||
static std::unordered_set<std::string> steps_ignore;
|
||||
|
|
|
@ -3253,6 +3253,12 @@ def = this->add("filament_loading_speed", coFloats);
|
|||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionBool(true));
|
||||
|
||||
def = this->add("disable_m73", coBool);
|
||||
def->label = L("Disable set remaining print time");
|
||||
def->tooltip = "Disable generating of the M73: Set remaining print time in the final gcode";
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
|
||||
def = this->add("seam_position", coEnum);
|
||||
def->label = L("Seam position");
|
||||
def->category = L("Quality");
|
||||
|
|
|
@ -1016,6 +1016,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
((ConfigOptionPercent, accel_to_decel_factor))
|
||||
((ConfigOptionFloatOrPercent, initial_layer_travel_speed))
|
||||
((ConfigOptionBool, bbl_calib_mark_logo))
|
||||
((ConfigOptionBool, disable_m73))
|
||||
|
||||
// Orca: mmu
|
||||
((ConfigOptionFloat, cooling_tube_retraction))
|
||||
|
|
|
@ -3405,6 +3405,7 @@ void TabPrinter::build_fff()
|
|||
optgroup = page->new_optgroup(L("Advanced"), L"param_advanced");
|
||||
optgroup->append_single_option_line("printer_structure");
|
||||
optgroup->append_single_option_line("gcode_flavor");
|
||||
optgroup->append_single_option_line("disable_m73");
|
||||
option = optgroup->get_option("thumbnails");
|
||||
option.opt.full_width = true;
|
||||
optgroup->append_single_option_line(option);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue