mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-31 04:02:02 +08:00
#427 color id & order same for all the side panel (from last to first, beginning at 1)
This commit is contained in:
parent
1d1b1f0715
commit
0f5061da8e
@ -1070,9 +1070,9 @@ namespace DoExport {
|
||||
print_statistics.clear();
|
||||
print_statistics.estimated_normal_print_time = normal_time_estimator.get_time_dhm/*s*/();
|
||||
print_statistics.estimated_silent_print_time = silent_time_estimator_enabled ? silent_time_estimator.get_time_dhm/*s*/() : "N/A";
|
||||
print_statistics.estimated_normal_custom_gcode_print_times = normal_time_estimator.get_custom_gcode_times_dhm(true);
|
||||
print_statistics.estimated_normal_custom_gcode_print_times = normal_time_estimator.get_custom_gcode_times();
|
||||
if (silent_time_estimator_enabled)
|
||||
print_statistics.estimated_silent_custom_gcode_print_times = silent_time_estimator.get_custom_gcode_times_dhm(true);
|
||||
print_statistics.estimated_silent_custom_gcode_print_times = silent_time_estimator.get_custom_gcode_times();
|
||||
print_statistics.total_toolchanges = std::max(0, wipe_tower_data.number_of_toolchanges);
|
||||
if (! extruders.empty()) {
|
||||
std::pair<std::string, unsigned int> out_filament_used_mm ("; filament used [mm] = ", 0);
|
||||
|
@ -794,27 +794,6 @@ namespace Slic3r {
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<std::pair<CustomGcodeType, std::string>> GCodeTimeEstimator::get_custom_gcode_times_dhm(bool include_remaining) const
|
||||
{
|
||||
std::vector<std::pair<CustomGcodeType, std::string>> ret;
|
||||
|
||||
float total_time = 0.0f;
|
||||
for (const std::pair<CustomGcodeType, float> &t : m_custom_gcode_times)
|
||||
{
|
||||
std::string time = _get_time_dhm(t.second);
|
||||
if (include_remaining)
|
||||
{
|
||||
time += " (";
|
||||
time += _get_time_dhm(m_time - total_time);
|
||||
time += ")";
|
||||
}
|
||||
total_time += t.second;
|
||||
ret.push_back({t.first, time});
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Return an estimate of the memory consumed by the time estimator.
|
||||
size_t GCodeTimeEstimator::memory_used() const
|
||||
{
|
||||
|
@ -417,10 +417,6 @@ namespace Slic3r {
|
||||
// If include_remaining==true the strings will be formatted as: "time for color (remaining time at color start)"
|
||||
std::vector<std::string> get_color_times_minutes(bool include_remaining) const;
|
||||
|
||||
// Returns the estimated time, in format DDd HHh MMm, for each custom_gcode
|
||||
// If include_remaining==true the strings will be formatted as: "time for custom_gcode (remaining time at color start)"
|
||||
std::vector<std::pair<CustomGcodeType, std::string>> get_custom_gcode_times_dhm(bool include_remaining) const;
|
||||
|
||||
// Return an estimate of the memory consumed by the time estimator.
|
||||
size_t memory_used() const;
|
||||
|
||||
|
@ -319,8 +319,8 @@ struct PrintStatistics
|
||||
PrintStatistics() { clear(); }
|
||||
std::string estimated_normal_print_time;
|
||||
std::string estimated_silent_print_time;
|
||||
std::vector<std::pair<CustomGcodeType, std::string>> estimated_normal_custom_gcode_print_times;
|
||||
std::vector<std::pair<CustomGcodeType, std::string>> estimated_silent_custom_gcode_print_times;
|
||||
std::vector<std::pair<CustomGcodeType, float>> estimated_normal_custom_gcode_print_times;
|
||||
std::vector<std::pair<CustomGcodeType, float>> estimated_silent_custom_gcode_print_times;
|
||||
double total_used_filament;
|
||||
std::vector<std::pair<size_t, double>> color_extruderid_to_used_filament;
|
||||
double total_extruded_volume;
|
||||
|
@ -337,6 +337,30 @@ inline std::string get_time_dhms(float time_in_secs)
|
||||
return buffer;
|
||||
}
|
||||
|
||||
// Returns the given time is seconds in format DDd HHh MMm
|
||||
inline std::string get_time_dhm(float time_in_secs)
|
||||
{
|
||||
char buffer[64];
|
||||
|
||||
int minutes = std::round(time_in_secs / 60.);
|
||||
if (minutes <= 0) {
|
||||
::sprintf(buffer, "%ds", (int)time_in_secs);
|
||||
} else {
|
||||
int days = minutes / 1440;
|
||||
minutes -= days * 1440;
|
||||
int hours = minutes / 60;
|
||||
minutes -= hours * 60;
|
||||
if (days > 0)
|
||||
::sprintf(buffer, "%dd %dh %dm", days, hours, minutes);
|
||||
else if (hours > 0)
|
||||
::sprintf(buffer, "%dh %dm", hours, minutes);
|
||||
else
|
||||
::sprintf(buffer, "%dm", minutes);
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#if WIN32
|
||||
|
@ -1244,7 +1244,7 @@ void Sidebar::update_sliced_info_sizer()
|
||||
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 ).str());
|
||||
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);
|
||||
}
|
||||
@ -1260,7 +1260,7 @@ void Sidebar::update_sliced_info_sizer()
|
||||
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).str());
|
||||
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));
|
||||
@ -1292,25 +1292,23 @@ void Sidebar::update_sliced_info_sizer()
|
||||
wxString str_color = _(L("Color"));
|
||||
wxString str_pause = _(L("Pause"));
|
||||
|
||||
auto fill_labels = [str_color, str_pause](const std::vector<std::pair<CustomGcodeType, std::string>>& times,
|
||||
auto fill_labels = [str_color, str_pause](const std::vector<std::pair<CustomGcodeType, float>>& times,
|
||||
wxString& new_label, wxString& info_text)
|
||||
{
|
||||
int color_change_count = 0;
|
||||
for (auto time : times)
|
||||
if (time.first == cgtColorChange)
|
||||
color_change_count++;
|
||||
|
||||
for (int i = (int)times.size() - 1; i >= 0; --i)
|
||||
int color_change_count = 1;
|
||||
float time_from_beginning = 0;
|
||||
for (size_t i = 0; i < times.size(); ++i)
|
||||
{
|
||||
if (i == 0 || times[i - 1].first == cgtPausePrint)
|
||||
if (times[i].first == cgtPausePrint)
|
||||
new_label += from_u8((boost::format("\n - %1%%2%") % (std::string(str_color.ToUTF8()) + " ") % color_change_count).str());
|
||||
else if (times[i - 1].first == cgtColorChange)
|
||||
new_label += from_u8((boost::format("\n - %1%%2%") % (std::string(str_color.ToUTF8()) + " ") % color_change_count--).str());
|
||||
else if (times[i].first == cgtColorChange)
|
||||
new_label += from_u8((boost::format("\n - %1%%2%") % (std::string(str_color.ToUTF8()) + " ") % color_change_count++).str());
|
||||
|
||||
if (i != (int)times.size() - 1 && times[i].first == cgtPausePrint)
|
||||
new_label += from_u8((boost::format(" -> %1%") % std::string(str_pause.ToUTF8())).str());
|
||||
|
||||
info_text += from_u8((boost::format("\n%1%") % times[i].second).str());
|
||||
time_from_beginning += times[i].second;
|
||||
info_text += from_u8((boost::format("\n%1% (%2%)") % get_time_dhm(times[i].second) % get_time_dhm(time_from_beginning)).str());
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user