From 712fef0669a491c4335286d61d34ebb0b24345e6 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Wed, 12 Sep 2018 09:28:26 +0200 Subject: Added number of toolchanges into 'Sliced info' statistics --- xs/src/libslic3r/GCode/WipeTower.hpp | 3 +++ xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp | 2 +- xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp | 5 +++-- xs/src/libslic3r/Print.cpp | 1 + xs/src/libslic3r/Print.hpp | 1 + 5 files changed, 9 insertions(+), 3 deletions(-) (limited to 'xs/src/libslic3r') diff --git a/xs/src/libslic3r/GCode/WipeTower.hpp b/xs/src/libslic3r/GCode/WipeTower.hpp index e7cd8ea1a..21c10969a 100644 --- a/xs/src/libslic3r/GCode/WipeTower.hpp +++ b/xs/src/libslic3r/GCode/WipeTower.hpp @@ -158,6 +158,9 @@ public: // Returns used filament length per extruder: virtual std::vector get_used_filament() const = 0; + + // Returns total number of toolchanges: + virtual int get_number_of_toolchanges() const = 0; }; }; // namespace Slic3r diff --git a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp index 23a2bef9b..0427e32d6 100644 --- a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp +++ b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp @@ -613,10 +613,10 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::tool_change(unsigned int tool, boo toolchange_Load(writer, cleaning_box); writer.travel(writer.x(),writer.y()-m_perimeter_width); // cooling and loading were done a bit down the road toolchange_Wipe(writer, cleaning_box, wipe_volume); // Wipe the newly loaded filament until the end of the assigned wipe area. + ++ m_num_tool_changes; } else toolchange_Unload(writer, cleaning_box, m_filpar[m_current_tool].material, m_filpar[m_current_tool].temperature); - ++ m_num_tool_changes; m_depth_traversed += wipe_area; if (last_change_in_layer) {// draw perimeter line diff --git a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp index 964ee0039..06625d189 100644 --- a/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp +++ b/xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp @@ -46,7 +46,7 @@ public: WipeTowerPrusaMM(float x, float y, float width, float rotation_angle, float cooling_tube_retraction, float cooling_tube_length, float parking_pos_retraction, float extra_loading_move, float bridging, const std::vector>& wiping_matrix, unsigned int initial_tool) : - m_wipe_tower_pos(x, y), + m_wipe_tower_pos(x, y), m_wipe_tower_width(width), m_wipe_tower_rotation_angle(rotation_angle), m_y_shift(0.f), @@ -174,7 +174,8 @@ public: return ( (m_is_first_layer ? m_wipe_tower_depth - m_perimeter_width : m_layer_info->depth) - WT_EPSILON < m_depth_traversed); } - virtual std::vector get_used_filament() const { return m_used_filament_length; } + virtual std::vector get_used_filament() const override { return m_used_filament_length; } + virtual int get_number_of_toolchanges() const override { return m_num_tool_changes; } private: diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index ba8abd040..eb2112ef0 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -1195,6 +1195,7 @@ void Print::_make_wipe_tower() wipe_tower.tool_change((unsigned int)-1, false)); m_wipe_tower_used_filament = wipe_tower.get_used_filament(); + m_wipe_tower_number_of_toolchanges = wipe_tower.get_number_of_toolchanges(); } std::string Print::output_filename() diff --git a/xs/src/libslic3r/Print.hpp b/xs/src/libslic3r/Print.hpp index 537070a34..95b8abc5b 100644 --- a/xs/src/libslic3r/Print.hpp +++ b/xs/src/libslic3r/Print.hpp @@ -310,6 +310,7 @@ public: std::vector> m_wipe_tower_tool_changes; std::unique_ptr m_wipe_tower_final_purge; std::vector m_wipe_tower_used_filament; + int m_wipe_tower_number_of_toolchanges = -1; std::string output_filename(); std::string output_filepath(const std::string &path); -- cgit v1.2.3