Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Matena <lukasmatena@seznam.cz>2018-09-12 10:28:26 +0300
committerLukas Matena <lukasmatena@seznam.cz>2018-09-12 10:28:26 +0300
commit712fef0669a491c4335286d61d34ebb0b24345e6 (patch)
treeec8dacb5c8459b470ff41917488e001cff4294b6
parent961d8942187dcda70d87b358bceb6cf0a967a6b7 (diff)
Added number of toolchanges into 'Sliced info' statistics
-rw-r--r--lib/Slic3r/GUI/Plater.pm12
-rw-r--r--xs/src/libslic3r/GCode/WipeTower.hpp3
-rw-r--r--xs/src/libslic3r/GCode/WipeTowerPrusaMM.cpp2
-rw-r--r--xs/src/libslic3r/GCode/WipeTowerPrusaMM.hpp5
-rw-r--r--xs/src/libslic3r/Print.cpp1
-rw-r--r--xs/src/libslic3r/Print.hpp1
-rw-r--r--xs/xsp/Print.xsp10
7 files changed, 27 insertions, 7 deletions
diff --git a/lib/Slic3r/GUI/Plater.pm b/lib/Slic3r/GUI/Plater.pm
index 56c21bbbb..469fa42dd 100644
--- a/lib/Slic3r/GUI/Plater.pm
+++ b/lib/Slic3r/GUI/Plater.pm
@@ -1646,14 +1646,15 @@ sub print_info_box_show {
$grid_sizer->AddGrowableCol(1, 1);
$grid_sizer->AddGrowableCol(3, 1);
$print_info_sizer->Add($grid_sizer, 0, wxEXPAND);
+ my $is_wipe_tower = $self->{print}->total_wipe_tower_filament > 0;
my @info = (
L("Used Filament (m)")
- => $self->{print}->total_wipe_tower_filament > 0 ?
+ => $is_wipe_tower ?
sprintf("%.2f (%.2f %s + %.2f %s)" , $self->{print}->total_used_filament / 1000,
($self->{print}->total_used_filament - $self->{print}->total_wipe_tower_filament) / 1000,
L("objects"),
$self->{print}->total_wipe_tower_filament / 1000,
- L("wipe_tower")) :
+ L("wipe tower")) :
sprintf("%.2f" , $self->{print}->total_used_filament / 1000),
L("Used Filament (mm³)")
@@ -1661,18 +1662,21 @@ sub print_info_box_show {
L("Used Filament (g)"),
=> sprintf("%.2f" , $self->{print}->total_weight),
L("Cost"),
- => $self->{print}->total_wipe_tower_cost > 0 ?
+ => $is_wipe_tower ?
sprintf("%.2f (%.2f %s + %.2f %s)" , $self->{print}->total_cost,
($self->{print}->total_cost - $self->{print}->total_wipe_tower_cost),
L("objects"),
$self->{print}->total_wipe_tower_cost,
- L("wipe_tower")) :
+ L("wipe tower")) :
sprintf("%.2f" , $self->{print}->total_cost),
L("Estimated printing time (normal mode)")
=> $self->{print}->estimated_normal_print_time,
L("Estimated printing time (silent mode)")
=> $self->{print}->estimated_silent_print_time
);
+ # if there is a wipe tower, insert number of toolchanges info into the array:
+ splice (@info, 8, 0, L("Number of tool changes") => sprintf("%.d", $self->{print}->m_wipe_tower_number_of_toolchanges)) if ($is_wipe_tower);
+
while ( my $label = shift @info) {
my $value = shift @info;
next if $value eq "N/A";
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<float> 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<std::vector<float>>& 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<float> get_used_filament() const { return m_used_filament_length; }
+ virtual std::vector<float> 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<std::vector<WipeTower::ToolChangeResult>> m_wipe_tower_tool_changes;
std::unique_ptr<WipeTower::ToolChangeResult> m_wipe_tower_final_purge;
std::vector<float> 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);
diff --git a/xs/xsp/Print.xsp b/xs/xsp/Print.xsp
index 50f899f2c..1dee8a4c4 100644
--- a/xs/xsp/Print.xsp
+++ b/xs/xsp/Print.xsp
@@ -297,6 +297,16 @@ Print::total_wipe_tower_filament(...)
}
RETVAL = THIS->total_wipe_tower_filament;
OUTPUT:
+ RETVAL
+
+int
+Print::m_wipe_tower_number_of_toolchanges(...)
+ CODE:
+ if (items > 1) {
+ THIS->m_wipe_tower_number_of_toolchanges = (double)SvNV(ST(1));
+ }
+ RETVAL = THIS->m_wipe_tower_number_of_toolchanges;
+ OUTPUT:
RETVAL
%}
};