diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index 08b0df649..96341c315 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -1009,7 +1009,8 @@ std::vector ToolOrdering::get_recommended_filament_maps(const std::vectorret(filament_nums, 0); + int master_extruder_id = print_config.master_extruder_id.value -1; // switch to 0 based idx + std::vectorret(filament_nums, master_extruder_id); bool ignore_ext_filament = false; // TODO: read from config // if mutli_extruder, calc group,otherwise set to 0 if (extruder_nums == 2) { @@ -1048,7 +1049,7 @@ std::vector ToolOrdering::get_recommended_filament_maps(const std::vector EPSILON || delta_change_to_single_ext > 0; - bool more_to_best = delta_weight_to_best > EPSILON || delta_change_to_best > 0; + bool any_less_to_single_ext = delta_weight_to_single_ext > EPSILON || delta_change_to_single_ext > 0; + bool any_more_to_best = delta_weight_to_best > EPSILON || delta_change_to_best > 0; + bool all_less_to_single_ext = delta_weight_to_single_ext > EPSILON && delta_change_to_single_ext > 0; + bool all_more_to_best = delta_weight_to_best > EPSILON && delta_change_to_best > 0; auto get_filament_display_type = [](const ExtruderFilament& filament) { if (filament.is_support_filament && (filament.type == "PLA" || filament.type == "PA" || filament.type == "ABS")) @@ -4796,10 +4798,16 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding) } int tips_count = 8; - if (more_to_best) + if (any_more_to_best) { tips_count = 8; - else if (less_to_single_ext) + if (!all_more_to_best) + tips_count += 1; + } + else if (any_less_to_single_ext) { tips_count = 6; + if (!all_less_to_single_ext) + tips_count += 1; + } else tips_count = 5; @@ -4883,17 +4891,45 @@ void GCodeViewer::render_legend_color_arr_recommen(float window_padding) return static_cast(num); }; - if (more_to_best) { + if (any_more_to_best) { is_optimal_group = false; ImVec4 orangeColor = ImVec4(1.0f, 0.5f, 0.0f, 1.0f); ImGui::PushStyleColor(ImGuiCol_Text, orangeColor); imgui.text(_u8L("Tips:")); imgui.text(_u8L("Current grouping of slice result is not optimal.")); - imgui.text_wrapped(from_u8((boost::format(_u8L("Cost %1%g filament and %2% changes more than optimal grouping.")) % number_format(delta_weight_to_best) % delta_change_to_best).str()), parent_width); + wxString tip; + if (delta_weight_to_best >= 0 && delta_change_to_best >= 0) + tip = from_u8((boost::format(_u8L("Cost %1%g filament and %2% changes more than optimal grouping.")) + % number_format(delta_weight_to_best) + % delta_change_to_best).str()); + else if (delta_weight_to_best >= 0 && delta_change_to_best < 0) + tip = from_u8((boost::format(_u8L("Increase %1%g filament and reduce %2% changes compared to optimal grouping.")) + % number_format(delta_weight_to_best) + % std::abs(delta_change_to_best)).str()); + else if (delta_weight_to_best < 0 && delta_change_to_best >= 0) + tip = from_u8((boost::format(_u8L("Reduce %1%g filament and increase %2% changes compared to optimal grouping.")) + % number_format(std::abs(delta_weight_to_best)) + % delta_change_to_best).str()); + + imgui.text_wrapped(tip, parent_width); ImGui::PopStyleColor(1); } - else if (less_to_single_ext) { - imgui.text_wrapped(from_u8((boost::format(_u8L("Save %1%g filament and %2% changes than one-nozzle printer.")) % number_format(delta_weight_to_single_ext) % delta_change_to_single_ext).str()), parent_width); + else if (any_less_to_single_ext) { + wxString tip; + if (delta_weight_to_single_ext >= 0 && delta_change_to_single_ext >= 0) + tip = from_u8((boost::format(_u8L("Save %1%g filament and %2% changes than one-nozzle printer.")) + % number_format(delta_weight_to_single_ext) + % delta_change_to_single_ext).str()); + else if (delta_weight_to_single_ext >= 0 && delta_change_to_single_ext < 0) + tip = from_u8((boost::format(_u8L("Reduce %1%g filament and increase %2% changes compared to one-nozzle printer.")) + % number_format(delta_weight_to_single_ext) + % std::abs(delta_change_to_single_ext)).str()); + else if (delta_weight_to_single_ext < 0 && delta_change_to_single_ext >= 0) + tip = from_u8((boost::format(_u8L("Increase %1%g filament and reduce %2% changes compared to one-nozzle printer.")) + % number_format(std::abs(delta_weight_to_single_ext)) + % delta_change_to_single_ext).str()); + + imgui.text_wrapped(tip, parent_width); } ImGui::Dummy({window_padding, window_padding});