mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Added "Filament -> Spool weight" parameter
This commit is contained in:
parent
d5e6b17d70
commit
5330b34d0a
6 changed files with 61 additions and 2 deletions
|
@ -1156,7 +1156,43 @@ void Sidebar::update_sliced_info_sizer()
|
|||
new_label = imperial_units ? _L("Used Filament (in³)") : _L("Used Filament (mm³)");
|
||||
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);
|
||||
p->sliced_info->SetTextAndShow(siFilament_g, ps.total_weight == 0.0 ? "N/A" : wxString::Format("%.2f", ps.total_weight));
|
||||
|
||||
if (ps.total_weight == 0.0)
|
||||
p->sliced_info->SetTextAndShow(siFilament_g, "N/A");
|
||||
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);
|
||||
}
|
||||
|
||||
double spool_weight = filament_preset->config.opt_float("filament_spool_weight", 0);
|
||||
if (spool_weight != 0.0) {
|
||||
new_label += "\n " + _L("(weight with spool)");
|
||||
info_text += wxString::Format(" (%.2f)\n", filament_weight + spool_weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
p->sliced_info->SetTextAndShow(siFilament_g, info_text, new_label);
|
||||
}
|
||||
|
||||
new_label = _L("Cost");
|
||||
if (is_wipe_tower)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue