diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index c97fda2403..95dec2c8fa 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -1286,10 +1286,11 @@ namespace DoExport { // get_time_dhms(result.print_statistics.modes[static_cast(PrintEstimatedStatistics::ETimeMode::Stealth)].time) : "N/A"; // } - static void update_print_estimated_stats(const GCodeProcessor& processor, const std::vector& extruders, PrintStatistics& print_statistics) + static void update_print_estimated_stats(const GCodeProcessor& processor, const std::vector& extruders, PrintStatistics& print_statistics, const PrintConfig& config) { const GCodeProcessorResult& result = processor.get_result(); - print_statistics.estimated_normal_print_time = get_time_dhms(result.print_statistics.modes[static_cast(PrintEstimatedStatistics::ETimeMode::Normal)].time); + double normal_print_time = result.print_statistics.modes[static_cast(PrintEstimatedStatistics::ETimeMode::Normal)].time; + print_statistics.estimated_normal_print_time = get_time_dhms(normal_print_time); print_statistics.estimated_silent_print_time = processor.is_stealth_time_estimator_enabled() ? get_time_dhms(result.print_statistics.modes[static_cast(PrintEstimatedStatistics::ETimeMode::Stealth)].time) : "N/A"; @@ -1327,7 +1328,9 @@ namespace DoExport { total_weight += weight; total_cost += weight * extruder->filament_cost() * 0.001; } - + + total_cost += config.time_cost.getFloat() * (normal_print_time/3600.0); + print_statistics.total_extruded_volume = total_extruded_volume; print_statistics.total_used_filament = total_used_filament; print_statistics.total_weight = total_weight; @@ -1488,7 +1491,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->m_print_statistics, print->config()); if (result != nullptr) { *result = std::move(m_processor.extract_result()); // set the filename to the correct value diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 08ccb659f8..82747b7578 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -814,7 +814,7 @@ static std::vector 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", "template_custom_gcode", + "scan_first_layer", "machine_load_filament_time", "machine_unload_filament_time","time_cost", "machine_pause_gcode", "template_custom_gcode", "nozzle_type", "nozzle_hrc","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types", "retract_lift_enforce", //SoftFever "host_type", "print_host", "printhost_apikey", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 026f28786d..48f54e8005 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2090,6 +2090,14 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comAdvanced; def->set_default_value(new ConfigOptionFloat(0)); + def = this->add("time_cost", coFloat); + def->label = L("Time cost"); + def->tooltip = L("The printer cost per hour"); + def->sidetext = L("money/h"); + def->min = 0; + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionFloat(0)); + def = this->add("gcode_flavor", coEnum); def->label = L("G-code flavor"); def->tooltip = L("What kind of gcode the printer is compatible with"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index b33ae8aa6d..e7a3a0a48f 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -878,7 +878,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionBool, gcode_add_line_number)) ((ConfigOptionBool, bbl_bed_temperature_gcode)) ((ConfigOptionEnum, gcode_flavor)) - + ((ConfigOptionFloat, time_cost)) ((ConfigOptionString, layer_change_gcode)) ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope)) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 9838efd945..5f9e731fbe 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3126,6 +3126,7 @@ void TabPrinter::build_fff() // optgroup->append_single_option_line("spaghetti_detector"); optgroup->append_single_option_line("machine_load_filament_time"); optgroup->append_single_option_line("machine_unload_filament_time"); + optgroup->append_single_option_line("time_cost"); optgroup = page->new_optgroup(L("Cooling Fan")); Line line = Line{ L("Fan speed-up time"), optgroup->get_option("fan_speedup_time").opt.tooltip };