mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	Added number of toolchanges into 'Sliced info' statistics
This commit is contained in:
		
							parent
							
								
									961d894218
								
							
						
					
					
						commit
						712fef0669
					
				
					 7 changed files with 27 additions and 7 deletions
				
			
		|  | @ -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"; | ||||
|  |  | |||
|  | @ -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
 | ||||
|  |  | |||
|  | @ -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
 | ||||
|  |  | |||
|  | @ -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: | ||||
|  |  | |||
|  | @ -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() | ||||
|  |  | |||
|  | @ -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); | ||||
|  |  | |||
|  | @ -296,6 +296,16 @@ Print::total_wipe_tower_filament(...) | |||
|             THIS->total_wipe_tower_filament = (double)SvNV(ST(1)); | ||||
|         } | ||||
|         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         | ||||
| %} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lukas Matena
						Lukas Matena