mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	NEW: show cost of filament in GUI
Signed-off-by: qing.zhang <qing.zhang@bambulab.com> Change-Id: If28f6e969728fb5edd9cb35d6bc6d0a6c155d96e (cherry picked from commit a4b8e620794f611c2f94f639cec49ec7c8fe8926)
This commit is contained in:
		
							parent
							
								
									663df48a95
								
							
						
					
					
						commit
						ef46654cca
					
				
					 11 changed files with 38 additions and 5 deletions
				
			
		|  | @ -1,7 +1,7 @@ | ||||||
| { | { | ||||||
|     "name": "Bambulab", |     "name": "Bambulab", | ||||||
|     "url": "http://www.bambulab.com/Parameters/vendor/BBL.json", |     "url": "http://www.bambulab.com/Parameters/vendor/BBL.json", | ||||||
|     "version": "01.01.01.03", |     "version": "01.01.01.04", | ||||||
|     "force_update": "0", |     "force_update": "0", | ||||||
|     "description": "the initial version of BBL configurations", |     "description": "the initial version of BBL configurations", | ||||||
|     "machine_model_list": [ |     "machine_model_list": [ | ||||||
|  |  | ||||||
|  | @ -8,6 +8,9 @@ | ||||||
|     "filament_flow_ratio": [ |     "filament_flow_ratio": [ | ||||||
|         "0.95" |         "0.95" | ||||||
|     ], |     ], | ||||||
|  |     "filament_cost": [ | ||||||
|  |         "24.99" | ||||||
|  |     ], | ||||||
|     "filament_vendor": [ |     "filament_vendor": [ | ||||||
|         "Bambu Lab" |         "Bambu Lab" | ||||||
|     ] |     ] | ||||||
|  |  | ||||||
|  | @ -20,6 +20,9 @@ | ||||||
|     "filament_type": [ |     "filament_type": [ | ||||||
|         "PA-CF" |         "PA-CF" | ||||||
|     ], |     ], | ||||||
|  |     "filament_cost": [ | ||||||
|  |         "44.99" | ||||||
|  |     ], | ||||||
|     "nozzle_temperature": [ |     "nozzle_temperature": [ | ||||||
|         "280" |         "280" | ||||||
|     ] |     ] | ||||||
|  |  | ||||||
|  | @ -8,6 +8,9 @@ | ||||||
|     "filament_vendor": [ |     "filament_vendor": [ | ||||||
|         "Bambu Lab" |         "Bambu Lab" | ||||||
|     ], |     ], | ||||||
|  |     "filament_cost": [ | ||||||
|  |         "34.99" | ||||||
|  |     ], | ||||||
|     "filament_flow_ratio": [ |     "filament_flow_ratio": [ | ||||||
|         "0.94" |         "0.94" | ||||||
|     ] |     ] | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ | ||||||
|         "Bambu Lab" |         "Bambu Lab" | ||||||
|     ], |     ], | ||||||
|     "filament_cost": [ |     "filament_cost": [ | ||||||
|         "25.4" |         "24.99" | ||||||
|     ], |     ], | ||||||
|     "filament_flow_ratio": [ |     "filament_flow_ratio": [ | ||||||
|         "0.98" |         "0.98" | ||||||
|  |  | ||||||
|  | @ -9,7 +9,7 @@ | ||||||
|         "Bambu Lab" |         "Bambu Lab" | ||||||
|     ], |     ], | ||||||
|     "filament_cost": [ |     "filament_cost": [ | ||||||
|         "25.4" |         "24.99" | ||||||
|     ], |     ], | ||||||
|     "filament_density": [ |     "filament_density": [ | ||||||
|         "1.32" |         "1.32" | ||||||
|  |  | ||||||
|  | @ -23,6 +23,9 @@ | ||||||
|     "fan_cooling_layer_time": [ |     "fan_cooling_layer_time": [ | ||||||
|         "10" |         "10" | ||||||
|     ], |     ], | ||||||
|  |     "filament_cost": [ | ||||||
|  |         "34.99" | ||||||
|  |     ], | ||||||
|     "slow_down_layer_time":[ |     "slow_down_layer_time":[ | ||||||
|         "6" |         "6" | ||||||
|     ] |     ] | ||||||
|  |  | ||||||
|  | @ -26,6 +26,9 @@ | ||||||
|     "hot_plate_temp_initial_layer": [ |     "hot_plate_temp_initial_layer": [ | ||||||
|         "40" |         "40" | ||||||
|     ], |     ], | ||||||
|  |     "filament_cost": [ | ||||||
|  |         "29.99" | ||||||
|  |     ], | ||||||
|     "slow_down_layer_time": [ |     "slow_down_layer_time": [ | ||||||
|         "8" |         "8" | ||||||
|     ] |     ] | ||||||
|  |  | ||||||
|  | @ -14,6 +14,9 @@ | ||||||
|     "nozzle_temperature_initial_layer": [ |     "nozzle_temperature_initial_layer": [ | ||||||
|         "230" |         "230" | ||||||
|     ], |     ], | ||||||
|  |     "filament_cost": [ | ||||||
|  |         "36.99" | ||||||
|  |     ], | ||||||
|     "nozzle_temperature": [ |     "nozzle_temperature": [ | ||||||
|         "230" |         "230" | ||||||
|     ] |     ] | ||||||
|  |  | ||||||
|  | @ -990,7 +990,7 @@ void PrintConfigDef::init_fff_params() | ||||||
|     def->tooltip = L("Filament price. For statistics only"); |     def->tooltip = L("Filament price. For statistics only"); | ||||||
|     def->sidetext = L("money/kg"); |     def->sidetext = L("money/kg"); | ||||||
|     def->min = 0; |     def->min = 0; | ||||||
|     def->mode = comDevelop; |     def->mode = comAdvanced; | ||||||
|     def->set_default_value(new ConfigOptionFloats { 0. }); |     def->set_default_value(new ConfigOptionFloats { 0. }); | ||||||
| 
 | 
 | ||||||
|     def = this->add("filament_settings_id", coStrings); |     def = this->add("filament_settings_id", coStrings); | ||||||
|  |  | ||||||
|  | @ -4998,6 +4998,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv | ||||||
|         ImGui::SameLine(); |         ImGui::SameLine(); | ||||||
|         imgui.title(time_title); |         imgui.title(time_title); | ||||||
|         std::string filament_str = _u8L("Filament"); |         std::string filament_str = _u8L("Filament"); | ||||||
|  |         std::string cost_str = _u8L("Cost"); | ||||||
|         std::string prepare_str = _u8L("Prepare time"); |         std::string prepare_str = _u8L("Prepare time"); | ||||||
|         std::string print_str = _u8L("Model printing time"); |         std::string print_str = _u8L("Model printing time"); | ||||||
|         std::string total_str = _u8L("Total"); |         std::string total_str = _u8L("Total"); | ||||||
|  | @ -5006,7 +5007,10 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv | ||||||
|         if (time_mode.layers_times.empty()) |         if (time_mode.layers_times.empty()) | ||||||
|             max_len += ImGui::CalcTextSize(total_str.c_str()).x; |             max_len += ImGui::CalcTextSize(total_str.c_str()).x; | ||||||
|         else { |         else { | ||||||
|             max_len += std::max(ImGui::CalcTextSize(print_str.c_str()).x ,std::max(std::max(ImGui::CalcTextSize(prepare_str.c_str()).x, ImGui::CalcTextSize(total_str.c_str()).x), ImGui::CalcTextSize(filament_str.c_str()).x)); |             max_len += std::max(ImGui::CalcTextSize(cost_str.c_str()).x, | ||||||
|  |                                 std::max(ImGui::CalcTextSize(print_str.c_str()).x, | ||||||
|  |                                          std::max(std::max(ImGui::CalcTextSize(prepare_str.c_str()).x, ImGui::CalcTextSize(total_str.c_str()).x), | ||||||
|  |                                                   ImGui::CalcTextSize(filament_str.c_str()).x))); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         //BBS display filament cost
 |         //BBS display filament cost
 | ||||||
|  | @ -5031,6 +5035,17 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv | ||||||
|             auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [role](const std::pair<ExtrusionRole, float>& item) { return role == item.first; }); |             auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [role](const std::pair<ExtrusionRole, float>& item) { return role == item.first; }); | ||||||
|             return (it != time_mode.roles_times.end()) ? it->second : 0.0f; |             return (it != time_mode.roles_times.end()) ? it->second : 0.0f; | ||||||
|         }; |         }; | ||||||
|  | 
 | ||||||
|  |         //BBS: display cost of filaments
 | ||||||
|  |         ImGui::Dummy({window_padding, window_padding}); | ||||||
|  |         ImGui::SameLine(); | ||||||
|  |         imgui.text(cost_str + ":"); | ||||||
|  |         ImGui::SameLine(max_len); | ||||||
|  | 
 | ||||||
|  |         //char   buf[64];
 | ||||||
|  |         ::sprintf(buf, "%.2f", ps.total_cost); | ||||||
|  |         imgui.text(buf); | ||||||
|  | 
 | ||||||
|         //BBS: start gcode is prepeare time
 |         //BBS: start gcode is prepeare time
 | ||||||
|         if (role_time(erCustom) != 0.0f) { |         if (role_time(erCustom) != 0.0f) { | ||||||
|             ImGui::Dummy({ window_padding, window_padding }); |             ImGui::Dummy({ window_padding, window_padding }); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 qing.zhang
						qing.zhang