mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-24 00:28:38 -07:00
Merge 0bbdb56a87 into 506fde8f86
This commit is contained in:
commit
46aaf4d44a
3 changed files with 39 additions and 2 deletions
|
|
@ -3761,9 +3761,10 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line, const std::o
|
|||
return;
|
||||
|
||||
EMoveType type = move_type(delta_pos);
|
||||
const float delta_xyz = std::sqrt(sqr(delta_pos[X]) + sqr(delta_pos[Y]) + sqr(delta_pos[Z]));
|
||||
m_travel_dist = delta_xyz;
|
||||
|
||||
if (type == EMoveType::Extrude) {
|
||||
const float delta_xyz = std::sqrt(sqr(delta_pos[X]) + sqr(delta_pos[Y]) + sqr(delta_pos[Z]));
|
||||
m_travel_dist = delta_xyz;
|
||||
float volume_extruded_filament = area_filament_cross_section * delta_pos[E];
|
||||
float area_toolpath_cross_section = volume_extruded_filament / delta_xyz;
|
||||
|
||||
|
|
@ -5638,6 +5639,11 @@ void GCodeProcessor::store_move_vertex(EMoveType type, EMovePathType path_type)
|
|||
m_line_id + 1 :
|
||||
((type == EMoveType::Seam) ? m_last_line_id : m_line_id);
|
||||
|
||||
if (type == EMoveType::Travel) {
|
||||
m_result.print_statistics.total_travel_moves++;
|
||||
m_result.print_statistics.total_travel_distance += m_travel_dist;
|
||||
}
|
||||
|
||||
//BBS: apply plate's and extruder's offset to arc interpolation points
|
||||
if (path_type == EMovePathType::Arc_move_cw ||
|
||||
path_type == EMovePathType::Arc_move_ccw) {
|
||||
|
|
|
|||
|
|
@ -87,6 +87,8 @@ class Print;
|
|||
std::array<Mode, static_cast<size_t>(ETimeMode::Count)> modes;
|
||||
unsigned int total_filament_changes;
|
||||
unsigned int total_extruder_changes;
|
||||
float total_travel_distance;
|
||||
unsigned int total_travel_moves;
|
||||
|
||||
PrintEstimatedStatistics() { reset(); }
|
||||
|
||||
|
|
@ -104,6 +106,8 @@ class Print;
|
|||
used_filaments_per_role.clear();
|
||||
total_filament_changes = 0;
|
||||
total_extruder_changes = 0;
|
||||
total_travel_distance = 0.0f;
|
||||
total_travel_moves = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5080,6 +5080,8 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
|||
std::vector<std::string> used_filaments_length;
|
||||
std::vector<std::string> used_filaments_weight;
|
||||
std::string travel_percent;
|
||||
std::string travel_distance;
|
||||
std::string travel_moves;
|
||||
std::vector<double> model_used_filaments_m;
|
||||
std::vector<double> model_used_filaments_g;
|
||||
double total_model_used_filament_m = 0, total_model_used_filament_g = 0;
|
||||
|
|
@ -5211,10 +5213,33 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
|||
else
|
||||
percent > 0.001 ? ::sprintf(buffer, "%.1f", percent * 100) : ::sprintf(buffer, "<0.1");
|
||||
travel_percent = buffer;
|
||||
percents.push_back(travel_percent);
|
||||
|
||||
// Set travel distance and moves for the Travel row Usage columns
|
||||
if (m_print_statistics.total_travel_distance > 0.0f) {
|
||||
::sprintf(buffer, imperial_units ? "%.2fin" : "%.2fm", m_print_statistics.total_travel_distance / 1000.0f);
|
||||
travel_distance = buffer;
|
||||
} else {
|
||||
::sprintf(buffer, "0.00m");
|
||||
travel_distance = buffer;
|
||||
}
|
||||
used_filaments_length.push_back(travel_distance);
|
||||
|
||||
// Perhaps use m_statistics.travel_segments_count instead of m_print_statistics.total_travel_moves?
|
||||
// m_statistics.travel_segments_count is only available when ENABLE_GCODE_VIEWER_STATISTICS is defined
|
||||
if (m_print_statistics.total_travel_moves > 0) {
|
||||
::sprintf(buffer, "%d seg", m_print_statistics.total_travel_moves);
|
||||
travel_moves = buffer;
|
||||
} else {
|
||||
::sprintf(buffer, "0 seg");
|
||||
travel_moves = buffer;
|
||||
}
|
||||
used_filaments_weight.push_back(travel_moves);
|
||||
}
|
||||
|
||||
// ORCA use % symbol for percentage and use "Usage" for "Used filaments"
|
||||
offsets = calculate_offsets({ {_u8L("Line Type"), labels}, {_u8L("Time"), times}, {"%", percents}, {"", used_filaments_length}, {"", used_filaments_weight}, {_u8L("Display"), {""}}}, icon_size);
|
||||
percents.pop_back();
|
||||
append_headers({{_u8L("Line Type"), offsets[0]}, {_u8L("Time"), offsets[1]}, {"%", offsets[2]}, {_u8L("Usage"), offsets[3]}, {_u8L("Display"), offsets[5]}});
|
||||
break;
|
||||
}
|
||||
|
|
@ -5351,6 +5376,8 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
|
|||
columns_offsets.push_back({ _u8L("Travel"), offsets[0] });
|
||||
columns_offsets.push_back({ travel_time, offsets[1] });
|
||||
columns_offsets.push_back({ travel_percent, offsets[2] });
|
||||
columns_offsets.push_back({ travel_distance, offsets[3] }); // Usage column
|
||||
columns_offsets.push_back({ travel_moves, offsets[4] }); // Usage column
|
||||
append_item(EItemType::Rect, Travel_Colors[0], columns_offsets, true, offsets.back()/*ORCA checkbox_pos*/, visible, [this, item, visible]() {
|
||||
m_buffers[buffer_id(item)].visible = !m_buffers[buffer_id(item)].visible;
|
||||
// update buffers' render paths
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue