Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsupermerill <merill@free.fr>2022-04-13 00:16:12 +0300
committersupermerill <merill@free.fr>2022-04-15 13:33:39 +0300
commit54ac5805cea3a18227d2eeb00599a61624b2a479 (patch)
tree7e8a43cb3aaac6e6b50d8cae0b876bc4298f358e /src
parentde609f61c56f959f4a9b87b7cddc1950df8357f1 (diff)
Add print time estimation settings
supermerill/SuperSlicer#2150 supermerill/SuperSlicer#1133 supermerill/SuperSlicer#2688
Diffstat (limited to 'src')
-rw-r--r--src/libslic3r/GCode.cpp5
-rw-r--r--src/libslic3r/GCode/GCodeProcessor.cpp15
-rw-r--r--src/libslic3r/GCode/GCodeProcessor.hpp4
-rw-r--r--src/libslic3r/Preset.cpp3
-rw-r--r--src/libslic3r/Print.cpp3
-rw-r--r--src/libslic3r/PrintConfig.cpp29
-rw-r--r--src/libslic3r/PrintConfig.hpp3
-rw-r--r--src/slic3r/GUI/Tab.cpp11
8 files changed, 68 insertions, 5 deletions
diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp
index 6b8e3841e..ad4c10582 100644
--- a/src/libslic3r/GCode.cpp
+++ b/src/libslic3r/GCode.cpp
@@ -721,7 +721,7 @@ namespace DoExport {
// get_time_dhms(result.print_statistics.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Stealth)].time) : "N/A";
// }
- static void update_print_estimated_stats(const GCodeProcessor& processor, const std::vector<Extruder>& extruders, PrintStatistics& print_statistics)
+ static void update_print_estimated_stats(const GCodeProcessor& processor, const std::vector<Extruder>& extruders, const PrintConfig& config, PrintStatistics& print_statistics)
{
const GCodeProcessorResult& result = processor.get_result();
print_statistics.estimated_normal_print_time = get_time_dhms(result.print_statistics.modes[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)].time);
@@ -747,6 +747,7 @@ namespace DoExport {
total_weight += weight;
total_cost += weight * extruder->filament_cost() * 0.001;
}
+ total_cost += config.time_cost.value * (processor.get_time(PrintEstimatedStatistics::ETimeMode::Normal) / 3600.f);
print_statistics.total_extruded_volume = total_extruded_volume;
print_statistics.total_used_filament = total_used_filament;
@@ -908,7 +909,7 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
// Post-process the G-code to update time stamps.
m_processor.finalize(true);
// DoExport::update_print_estimated_times_stats(m_processor, print->m_print_statistics);
- DoExport::update_print_estimated_stats(m_processor, m_writer.extruders(), print->m_print_statistics);
+ DoExport::update_print_estimated_stats(m_processor, m_writer.extruders(), print->config() ,print->m_print_statistics);
if (result != nullptr) {
*result = std::move(m_processor.extract_result());
// set the filename to the correct value
diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp
index 3c9d2c844..ba2b39cae 100644
--- a/src/libslic3r/GCode/GCodeProcessor.cpp
+++ b/src/libslic3r/GCode/GCodeProcessor.cpp
@@ -954,10 +954,17 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
machine.time_acceleration = float(time_estimation_compensation);
}
}
+ m_time_processor.time_start_gcode = config.get_computed_value("time_start_gcode");
+ m_time_processor.time_toolchange = config.get_computed_value("time_toolchange");
m_time_processor.machines[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Normal)].remaining_times_type = config.remaining_times_type.value;
m_time_processor.machines[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Stealth)].remaining_times_type = config.remaining_times_type.value == rtM73 ? rtM73_Quiet : rtNone;
+ // add start gcode time
+ for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
+ m_time_processor.machines[i].time = m_time_processor.time_start_gcode;
+ }
+
}
void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
@@ -1231,6 +1238,8 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
machine.time_acceleration = float(time_estimation_compensation);
}
}
+ m_time_processor.time_start_gcode = config.get_computed_value("time_start_gcode");
+ m_time_processor.time_toolchange = config.get_computed_value("time_toolchange");
const ConfigOptionEnum<RemainingTimeType>* remaining_times_type = config.option<ConfigOptionEnum<RemainingTimeType>>("remaining_times_type");
@@ -1239,6 +1248,11 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
m_time_processor.machines[static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Stealth)].remaining_times_type = remaining_times_type->value == rtM73 ? rtM73_Quiet : rtNone;
}
+ // add start gcode time
+ for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count); ++i) {
+ m_time_processor.machines[i].time = m_time_processor.time_start_gcode;
+ }
+
}
void GCodeProcessor::enable_stealth_time_estimator(bool enabled)
@@ -3532,6 +3546,7 @@ void GCodeProcessor::process_T(uint16_t new_id)
float extra_time = get_filament_unload_time(static_cast<size_t>(old_extruder_id));
m_time_processor.extruder_unloaded = false;
extra_time += get_filament_load_time(static_cast<size_t>(m_extruder_id));
+ extra_time += m_time_processor.time_toolchange;
simulate_st_synchronize(extra_time);
}
diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp
index c5b03ec24..456212b62 100644
--- a/src/libslic3r/GCode/GCodeProcessor.hpp
+++ b/src/libslic3r/GCode/GCodeProcessor.hpp
@@ -354,6 +354,10 @@ namespace Slic3r {
// Additional load / unload times for a filament exchange sequence.
std::vector<float> filament_load_times = {};
std::vector<float> filament_unload_times = {};
+ //addtional time for start gcode
+ float time_start_gcode = 0.f;
+ //addtional time for tool change
+ float time_toolchange = 0.f;
std::array<TimeMachine, static_cast<size_t>(PrintEstimatedStatistics::ETimeMode::Count)> machines;
TimeProcessor() {
diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp
index 5bfa74985..85619dddf 100644
--- a/src/libslic3r/Preset.cpp
+++ b/src/libslic3r/Preset.cpp
@@ -808,6 +808,9 @@ static std::vector<std::string> s_Preset_printer_options {
"wipe_advanced_multiplier",
"wipe_advanced_algo",
"time_estimation_compensation",
+ "time_cost",
+ "time_start_gcode",
+ "time_toolchange",
};
static std::vector<std::string> s_Preset_sla_print_options {
diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp
index a409ac583..4916e3845 100644
--- a/src/libslic3r/Print.cpp
+++ b/src/libslic3r/Print.cpp
@@ -180,6 +180,9 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver& /* ne
"thumbnails_format",
"thumbnails_with_bed",
"time_estimation_compensation",
+ "time_cost",
+ "time_start_gcode",
+ "time_toolchange",
"tool_name",
"toolchange_gcode",
"top_fan_speed",
diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp
index e0db228a2..fb8db9ea2 100644
--- a/src/libslic3r/PrintConfig.cpp
+++ b/src/libslic3r/PrintConfig.cpp
@@ -5201,15 +5201,42 @@ void PrintConfigDef::init_fff_params()
def->cli = ConfigOptionDef::nocli;
}
+ def = this->add("time_cost", coFloat);
+ def->label = L("Time cost");
+ def->category = OptionCategory::firmware;
+ def->tooltip = L("This setting allows you to set how much an hour of printing time is costing you in printer maintenance, loan, human albor, etc.");
+ def->mode = comExpert | comSuSi;
+ def->sidetext = L("$ per hour");
+ def->min = 0;
+ def->set_default_value(new ConfigOptionFloat(0));
+
def = this->add("time_estimation_compensation", coPercent);
def->label = L("Time estimation compensation");
def->category = OptionCategory::firmware;
def->tooltip = L("This setting allows you to modify the time estimation by a % amount. As Slic3r only uses the Marlin algorithm, it's not precise enough if another firmware is used.");
- def->mode = comAdvancedE | comSuSi;
+ def->mode = comExpert | comSuSi;
def->sidetext = L("%");
def->min = 0;
def->set_default_value(new ConfigOptionPercent(100));
+ def = this->add("time_start_gcode", coFloat);
+ def->label = L("Time for start custom gcode");
+ def->category = OptionCategory::firmware;
+ def->tooltip = L("This setting allows you to modify the time estimation by a flat amount to compensate for start script, the homing routine, and other things.");
+ def->mode = comExpert | comSuSi;
+ def->sidetext = L("s");
+ def->min = 0;
+ def->set_default_value(new ConfigOptionFloat(20));
+
+ def = this->add("time_toolchange", coFloat);
+ def->label = L("Time for toolchange");
+ def->category = OptionCategory::firmware;
+ def->tooltip = L("This setting allows you to modify the time estimation by a flat amount for each toolchange.");
+ def->mode = comExpert | comSuSi;
+ def->sidetext = L("s");
+ def->min = 0;
+ def->set_default_value(new ConfigOptionFloat(30));
+
def = this->add("toolchange_gcode", coString);
def->label = L("Tool change G-code");
def->category = OptionCategory::customgcode;
diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp
index d500818eb..8db96ff38 100644
--- a/src/libslic3r/PrintConfig.hpp
+++ b/src/libslic3r/PrintConfig.hpp
@@ -1173,6 +1173,9 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionBool, thumbnails_end_file))
((ConfigOptionBool, thumbnails_with_bed))
((ConfigOptionPercent, time_estimation_compensation))
+ ((ConfigOptionFloat, time_cost))
+ ((ConfigOptionFloat, time_start_gcode))
+ ((ConfigOptionFloat, time_toolchange))
((ConfigOptionInts, top_fan_speed))
((ConfigOptionFloatOrPercent, top_solid_infill_acceleration))
((ConfigOptionFloatOrPercent, travel_acceleration))
diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp
index e52fe7677..e2fc4ba7d 100644
--- a/src/slic3r/GUI/Tab.cpp
+++ b/src/slic3r/GUI/Tab.cpp
@@ -3016,14 +3016,21 @@ PageShp TabPrinter::build_kinematics_page()
{
PageShp page = create_options_page(L("Machine limits"), "cog");
ConfigOptionsGroupShp optgroup;
+ Line line{ "", "" };
GCodeFlavor flavor = m_config->option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
+ optgroup = page->new_optgroup(_L("Time estimation compensation"));
if (flavor != gcfMarlinLegacy && flavor != gcfMarlinFirmware && flavor != gcfLerdge) {
- optgroup = page->new_optgroup(_L("not-marlin/lerdge firmware compensation"));
optgroup->append_single_option_line("time_estimation_compensation");
}
+ line = { _L("Flat time compensation"), wxString{""} };
+ line.append_option(optgroup->get_option("time_start_gcode"));
+ line.append_option(optgroup->get_option("time_toolchange"));
+ optgroup->append_line(line);
+ optgroup->append_single_option_line("time_cost");
+
optgroup = page->new_optgroup(_L("Machine Limits"));
optgroup->append_single_option_line("machine_limits_usage");
- Line line { "", "" };
+ line = { "", "" };
line.full_width = 1;
line.widget = [this](wxWindow* parent) {
return description_line_widget(parent, &m_machine_limits_description_line);