diff options
author | supermerill <merill@free.fr> | 2021-12-11 00:48:19 +0300 |
---|---|---|
committer | supermerill <merill@free.fr> | 2021-12-11 00:48:19 +0300 |
commit | eaa52a4d13600d6aac321742eb75c2b28b62351c (patch) | |
tree | b7f944c63268d1491c82bf5b6c4186773dddf08f | |
parent | 23e97c63d04d1797761669410918de31aa66f135 (diff) | |
parent | ae73056055edfda6e125eb56d1a420a5423086a3 (diff) |
"sliced info" for MMU, no 0-speed retraction
-rw-r--r-- | src/libslic3r/GCode.cpp | 14 | ||||
-rw-r--r-- | src/libslic3r/PrintConfig.cpp | 1 | ||||
-rw-r--r-- | src/slic3r/GUI/Plater.cpp | 129 |
3 files changed, 87 insertions, 57 deletions
diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index f5c8a8599..ee6eb01f0 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2070,20 +2070,12 @@ std::string GCode::emit_custom_gcode_per_print_z( pause_print_msg = custom_gcode->extra; if (color_change) { - //update stats : weight - double previously_extruded = 0; - for (const auto& tuple : stats.color_extruderid_to_used_weight) - if (tuple.first == this->m_writer.tool()->id()) - previously_extruded += tuple.second; - double extruded = this->m_writer.tool()->filament_density() * this->m_writer.tool()->extruded_volume(); - stats.color_extruderid_to_used_weight.emplace_back(this->m_writer.tool()->id(), extruded - previously_extruded); - //update stats : length - previously_extruded = 0; + double previously_extruded = 0; for (const auto& tuple : stats.color_extruderid_to_used_filament) - if (tuple.first == this->m_writer.tool()->id()) + if (tuple.first == m600_extruder_before_layer) previously_extruded += tuple.second; - stats.color_extruderid_to_used_filament.emplace_back(this->m_writer.tool()->id(), this->m_writer.tool()->used_filament() - previously_extruded); + stats.color_extruderid_to_used_filament.emplace_back(m600_extruder_before_layer, this->m_writer.get_tool(m600_extruder_before_layer)->used_filament() - previously_extruded); } // we should add or not colorprint_change in respect to nozzle_diameter count instead of really used extruders count diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index e67320a34..d67c516fd 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -3512,6 +3512,7 @@ void PrintConfigDef::init_fff_params() def->tooltip = L("The speed for retractions (this only applies to the extruder motor)."); def->sidetext = L("mm/s"); def->mode = comAdvanced; + def->min = 0.001; def->is_vector_extruder = true; def->set_default_value(new ConfigOptionFloats { 40. }); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 82e75a6ca..f00244f50 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1158,15 +1158,33 @@ void Sidebar::update_sliced_info_sizer() (ps.total_used_filament - ps.total_wipe_tower_filament) / /*1000*/koef, ps.total_wipe_tower_filament / /*1000*/koef) : wxString::Format("%.2f", ps.total_used_filament / /*1000*/koef); - if (ps.color_extruderid_to_used_filament.size() > 0) { - double total_length = 0; - for (int i = 0; i < ps.color_extruderid_to_used_filament.size(); i++) { - new_label+= from_u8((boost::format("\n - %1% %2%") % _utf8(L("Color")) % (i+1) ).str()); - total_length += ps.color_extruderid_to_used_filament[i].second; - info_text += wxString::Format("\n%.2f (%.2f)", ps.color_extruderid_to_used_filament[i].second / 1000, total_length / 1000); + //if multiple filament/extruderss, then print them all + if (ps.filament_stats.size() > 1 || ps.color_extruderid_to_used_filament.size() > 0) { + new_label += ":"; + //for each extruder + for (auto filament : ps.filament_stats) { + int items_printed = 0; + double total_length = 0; + // print each color change for this extruder + for (auto entry : ps.color_extruderid_to_used_filament) { + if (filament.first == entry.first) { + items_printed++; + new_label += "\n - " + format_wxstr(_L("Color %1% at extruder %2%"), items_printed , (filament.first + 1)); + total_length += entry.second; + info_text += wxString::Format("\n%.2f (%.2f)", entry.second / 1000, total_length / 1000); + } + } + //print total for this extruder + if (items_printed == 0) { + new_label += "\n - " + format_wxstr(_L("Filament at extruder %1%"), filament.first + 1); + //new_label += from_u8((boost::format("\n - %1% %2%") % _utf8(L("Color")) % ps.color_extruderid_to_used_filament.size()).str()); + info_text += wxString::Format("\n%.2f", filament.second / 1000); + } + else { + new_label += "\n - " + format_wxstr(_L("Color %1% at extruder %2%"), (items_printed+1), (filament.first + 1)); + info_text += wxString::Format("\n%.2f (%.2f)", (filament.second - total_length) / 1000, filament.second / 1000); + } } - new_label += from_u8((boost::format("\n - %1% %2%") % _utf8(L("Color")) % ps.color_extruderid_to_used_filament.size()).str()); - info_text += wxString::Format("\n%.2f (%.2f)", (ps.total_used_filament - total_length) / 1000, ps.total_used_filament / 1000); } p->sliced_info->SetTextAndShow(siFilament_m, info_text, new_label); @@ -1175,61 +1193,80 @@ void Sidebar::update_sliced_info_sizer() info_text = wxString::Format("%.2f", imperial_units ? ps.total_extruded_volume * koef : ps.total_extruded_volume); p->sliced_info->SetTextAndShow(siFilament_mm3, info_text, new_label); - if (ps.color_extruderid_to_used_weight.size() > 0 && ps.total_weight != 0) { - new_label = _L("Used Filament (g)"); - info_text = wxString::Format("%.2f", ps.total_weight); - double total_weight = 0; - for (int i = 0; i < ps.color_extruderid_to_used_weight.size(); i++) { - new_label += from_u8((boost::format("\n - %1% %2%") % _utf8(L("Color")) % (i + 1)).str()); - total_weight += ps.color_extruderid_to_used_weight[i].second; - info_text += (ps.color_extruderid_to_used_weight[i].second == 0 ? "\nN/A": wxString::Format("\n%.2f", ps.color_extruderid_to_used_weight[i].second / 1000)) - + (total_weight == 0 ? " (N/A)" : wxString::Format(" (%.2f)", total_weight / 1000)); - } - new_label += from_u8((boost::format("\n - %1% %2%") % _utf8(L("Color")) % ps.color_extruderid_to_used_weight.size()).str()); - info_text += ((ps.total_weight - total_weight / 1000) == 0 ? "\nN/A" : wxString::Format("\n%.2f", (ps.total_weight - total_weight / 1000))) - + wxString::Format(" (%.2f)", ps.total_weight); - p->sliced_info->SetTextAndShow(siFilament_g, info_text, new_label); - }else - p->sliced_info->SetTextAndShow(siFilament_g, ps.total_weight == 0.0 ? "N/A" : wxString::Format("%.2f", ps.total_weight), _(L("Used Filament (g)"))); -/* prusa version - -if (ps.total_weight == 0.0) + if (ps.total_weight == 0.0) p->sliced_info->SetTextAndShow(siFilament_g, "N/A"); - else { + else{ new_label = _L("Used Filament (g)"); info_text = wxString::Format("%.2f", ps.total_weight); const std::vector<std::string>& filament_presets = wxGetApp().preset_bundle->filament_presets; const PresetCollection& filaments = wxGetApp().preset_bundle->filaments; - if (ps.filament_stats.size() > 1) - new_label += ":"; - for (auto filament : ps.filament_stats) { - const Preset* filament_preset = filaments.find_preset(filament_presets[filament.first], false); - if (filament_preset) { - double filament_weight; - if (ps.filament_stats.size() == 1) - filament_weight = ps.total_weight; - else { - double filament_density = filament_preset->config.opt_float("filament_density", 0); - filament_weight = filament.second * filament_density * 2.4052f * 0.001; // assumes 1.75mm filament diameter; - - new_label += "\n - " + format_wxstr(_L("Filament at extruder %1%"), filament.first + 1); - info_text += wxString::Format("\n%.2f", filament_weight); + if (ps.filament_stats.size() > 1 || ps.color_extruderid_to_used_weight.size() > 0) { + bool has_spool = false; + new_label += ":"; + //for each extruder + for (auto filament : ps.filament_stats) { + const Preset* filament_preset = filaments.find_preset(filament_presets[filament.first], false); + if (filament_preset) { + double spool_weight = filament_preset->config.opt_float("filament_spool_weight", 0); + double filament_density = filament_preset->config.opt_float("filament_density", filament.first); + double crosssection = filament_preset->config.opt_float("filament_diameter", filament.first); + crosssection *= crosssection; + crosssection *= 0.25 * PI; + double m_to_g = filament_density / (crosssection * 1000); + int items_printed = 0; + double total_length = 0; + //for (int i = 0; i < ps.color_extruderid_to_used_filament.size(); i++) { + // new_label += from_u8((boost::format("\n - %1% %2%") % _utf8(L("Color")) % (i + 1)).str()); + // total_weight += ps.color_extruderid_to_used_weight[i].second; + // info_text += (ps.color_extruderid_to_used_weight[i].second == 0 ? "\nN/A" : wxString::Format("\n%.2f", ps.color_extruderid_to_used_weight[i].second / 1000)) + // + (total_weight == 0 ? " (N/A)" : wxString::Format(" (%.2f)", total_weight / 1000)); + //} + if (spool_weight != 0.0) + has_spool = true; + for (auto entry : ps.color_extruderid_to_used_filament) { + if (filament.first == entry.first) { + items_printed++; + new_label += "\n - " + format_wxstr(_L("Color %1% at extruder %2%"), items_printed, (filament.first + 1)); + total_length += entry.second; + info_text += wxString::Format("\n%.2f", entry.second * m_to_g); + if (spool_weight != 0.0) + info_text += wxString::Format(" (%.2f)", entry.second * m_to_g + spool_weight); + } + } + //print total for this extruder + if (items_printed == 0) { + new_label += "\n - " + format_wxstr(_L("Filament at extruder %1%"), filament.first + 1); + //new_label += from_u8((boost::format("\n - %1% %2%") % _utf8(L("Color")) % ps.color_extruderid_to_used_filament.size()).str()); + info_text += wxString::Format("\n%.2f", filament.second * m_to_g); + if (spool_weight != 0.0) + info_text += wxString::Format(" (%.2f)", filament.second * m_to_g + spool_weight); + } else { + new_label += "\n - " + format_wxstr(_L("Color %1% at extruder %2%"), (items_printed + 1), (filament.first + 1)); + info_text += wxString::Format("\n%.2f", (filament.second - total_length) * m_to_g); + if (spool_weight != 0.0) + info_text += wxString::Format(" (%.2f)", (filament.second - total_length) * m_to_g + spool_weight); + } } - + } + if (has_spool) + new_label += "\n " + _L("(including spool)"); + } else { + //add spool to main line if there is only one filament + const Preset* filament_preset = filaments.find_preset(filament_presets.front(), false); + if (filament_preset) { double spool_weight = filament_preset->config.opt_float("filament_spool_weight", 0); if (spool_weight != 0.0) { new_label += "\n " + _L("(including spool)"); - info_text += wxString::Format(" (%.2f)\n", filament_weight + spool_weight); + info_text += wxString::Format(" (%.2f)\n", ps.total_weight + spool_weight); } } } - p->sliced_info->SetTextAndShow(siFilament_g, info_text, new_label); } -*/ + new_label = _L("Cost"); if (is_wipe_tower) new_label += format_wxstr(":\n - %1%\n - %2%", _L("objects"), _L("wipe tower")); |