mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 04:31:15 -06:00 
			
		
		
		
	Miscellaneous changes for PA calib:
1. Changed printing speed for all PA tests, where the speed will be calculated by max(100, outer_wall_speed) with consideration of max_volumetric_speed. 2. PA tower now uses the classic wall generator. #1616
This commit is contained in:
		
							parent
							
								
									b571318be8
								
							
						
					
					
						commit
						92b1ff824a
					
				
					 4 changed files with 36 additions and 9 deletions
				
			
		|  | @ -1892,9 +1892,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato | ||||||
| 
 | 
 | ||||||
|         CalibPressureAdvanceLine pa_test(this); |         CalibPressureAdvanceLine pa_test(this); | ||||||
| 
 | 
 | ||||||
|         double filament_max_volumetric_speed = m_config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(initial_extruder_id); |         auto fast_speed = CalibPressureAdvance::find_optimal_PA_speed(print.full_print_config(), pa_test.line_width(), 0.2); | ||||||
|         Flow pattern_line = Flow(pa_test.line_width(), 0.2, m_config.nozzle_diameter.get_at(0)); |  | ||||||
|         auto fast_speed = std::min(print.default_region_config().outer_wall_speed.value, filament_max_volumetric_speed / pattern_line.mm3_per_mm()); |  | ||||||
|         auto slow_speed = std::max(20.0, fast_speed / 10.0); |         auto slow_speed = std::max(20.0, fast_speed / 10.0); | ||||||
|          |          | ||||||
|         pa_test.set_speed(fast_speed, slow_speed); |         pa_test.set_speed(fast_speed, slow_speed); | ||||||
|  |  | ||||||
|  | @ -1,8 +1,22 @@ | ||||||
| #include "calib.hpp" | #include "calib.hpp" | ||||||
| #include "BoundingBox.hpp" | #include "BoundingBox.hpp" | ||||||
|  | #include "Config.hpp" | ||||||
| #include "Model.hpp" | #include "Model.hpp" | ||||||
|  | #include <cmath> | ||||||
| 
 | 
 | ||||||
| namespace Slic3r { | namespace Slic3r { | ||||||
|  | 
 | ||||||
|  | // Calculate the optimal Pressure Advance speed
 | ||||||
|  | float CalibPressureAdvance::find_optimal_PA_speed(const DynamicPrintConfig &config, double line_width, double layer_height, | ||||||
|  |                                                                                                     int filament_idx) { | ||||||
|  |     const double general_suggested_min_speed = 100.0; | ||||||
|  |     double filament_max_volumetric_speed = config.option<ConfigOptionFloats>("filament_max_volumetric_speed")->get_at(0); | ||||||
|  |     Flow pattern_line = Flow(line_width, layer_height, config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0)); | ||||||
|  |     auto pa_speed = std::min(std::max(general_suggested_min_speed,config.option<ConfigOptionFloat>("outer_wall_speed")->value), filament_max_volumetric_speed / pattern_line.mm3_per_mm()); | ||||||
|  | 
 | ||||||
|  |     return std::floor(pa_speed); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| std::string CalibPressureAdvance::move_to(Vec2d pt, GCodeWriter& writer, std::string comment) | std::string CalibPressureAdvance::move_to(Vec2d pt, GCodeWriter& writer, std::string comment) | ||||||
| { | { | ||||||
|     std::stringstream gcode; |     std::stringstream gcode; | ||||||
|  |  | ||||||
|  | @ -26,7 +26,11 @@ struct Calib_Params { | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| class CalibPressureAdvance { | class CalibPressureAdvance { | ||||||
| protected: |   public: | ||||||
|  |     static float find_optimal_PA_speed(const DynamicPrintConfig &config, double line_width, double layer_height, | ||||||
|  |                                        int filament_idx = 0); | ||||||
|  | 
 | ||||||
|  |   protected: | ||||||
|     CalibPressureAdvance() =default; |     CalibPressureAdvance() =default; | ||||||
|     ~CalibPressureAdvance() =default; |     ~CalibPressureAdvance() =default; | ||||||
| 
 | 
 | ||||||
|  | @ -120,8 +124,7 @@ struct SuggestedConfigCalibPAPattern { | ||||||
|     const std::vector<std::pair<std::string, double>> float_pairs { |     const std::vector<std::pair<std::string, double>> float_pairs { | ||||||
|         {"initial_layer_print_height", 0.25}, |         {"initial_layer_print_height", 0.25}, | ||||||
|         {"layer_height", 0.2}, |         {"layer_height", 0.2}, | ||||||
|         {"initial_layer_speed", 30}, |         {"initial_layer_speed", 30} | ||||||
|         {"outer_wall_speed", 100} |  | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     const std::vector<std::pair<std::string, double>> nozzle_ratio_pairs { |     const std::vector<std::pair<std::string, double>> nozzle_ratio_pairs { | ||||||
|  |  | ||||||
|  | @ -8144,6 +8144,7 @@ void Plater::_calib_pa_pattern(const Calib_Params& params) | ||||||
| 
 | 
 | ||||||
|     const DynamicPrintConfig& printer_config = wxGetApp().preset_bundle->printers.get_edited_preset().config; |     const DynamicPrintConfig& printer_config = wxGetApp().preset_bundle->printers.get_edited_preset().config; | ||||||
|     DynamicPrintConfig& print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; |     DynamicPrintConfig& print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; | ||||||
|  |     double nozzle_diameter = printer_config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0); | ||||||
| 
 | 
 | ||||||
|     for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) { |     for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) { | ||||||
|         print_config.set_key_value( |         print_config.set_key_value( | ||||||
|  | @ -8151,9 +8152,13 @@ void Plater::_calib_pa_pattern(const Calib_Params& params) | ||||||
|             new ConfigOptionFloat(opt.second) |             new ConfigOptionFloat(opt.second) | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
|  |     print_config.set_key_value( | ||||||
|  |         "outer_wall_speed", | ||||||
|  |         new ConfigOptionFloat(CalibPressureAdvance::find_optimal_PA_speed( | ||||||
|  |             wxGetApp().preset_bundle->full_config(), print_config.get_abs_value("line_width", nozzle_diameter), | ||||||
|  |             print_config.get_abs_value("layer_height"), 0))); | ||||||
| 
 | 
 | ||||||
|     for (const auto opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) { |     for (const auto opt : SuggestedConfigCalibPAPattern().nozzle_ratio_pairs) { | ||||||
|         double nozzle_diameter = printer_config.option<ConfigOptionFloats>("nozzle_diameter")->get_at(0); |  | ||||||
|         print_config.set_key_value( |         print_config.set_key_value( | ||||||
|             opt.first, |             opt.first, | ||||||
|             new ConfigOptionFloatOrPercent(nozzle_diameter * opt.second / 100, false) |             new ConfigOptionFloatOrPercent(nozzle_diameter * opt.second / 100, false) | ||||||
|  | @ -8235,12 +8240,19 @@ void Plater::_calib_pa_tower(const Calib_Params& params) { | ||||||
|     auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config; |     auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config; | ||||||
|     auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config; |     auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config; | ||||||
| 
 | 
 | ||||||
|  |     const double nozzle_diameter = printer_config->option<ConfigOptionFloats>("nozzle_diameter")->get_at(0); | ||||||
|  | 
 | ||||||
|     filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats{ 1.0f }); |     filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats{ 1.0f }); | ||||||
|     print_config->set_key_value("default_jerk", new ConfigOptionFloat(1.0f)); |     print_config->set_key_value("default_jerk", new ConfigOptionFloat(1.0f)); | ||||||
|     print_config->set_key_value("outer_wall_jerk", new ConfigOptionFloat(1.0f)); |     print_config->set_key_value("outer_wall_jerk", new ConfigOptionFloat(1.0f)); | ||||||
|     print_config->set_key_value("inner_wall_jerk", new ConfigOptionFloat(1.0f)); |     print_config->set_key_value("inner_wall_jerk", new ConfigOptionFloat(1.0f)); | ||||||
|     if(print_config->option<ConfigOptionEnum<PerimeterGeneratorType>>("wall_generator")->value == PerimeterGeneratorType::Arachne) |     auto full_config = wxGetApp().preset_bundle->full_config(); | ||||||
|         print_config->set_key_value("wall_transition_angle", new ConfigOptionFloat(25)); |     auto wall_speed = CalibPressureAdvance::find_optimal_PA_speed( | ||||||
|  |         full_config, full_config.get_abs_value("line_width", nozzle_diameter), | ||||||
|  |         full_config.get_abs_value("layer_height"), 0); | ||||||
|  |     print_config->set_key_value("outer_wall_speed", new ConfigOptionFloat(wall_speed)); | ||||||
|  |     print_config->set_key_value("inner_wall_speed", new ConfigOptionFloat(wall_speed)); | ||||||
|  |     print_config->set_key_value("wall_generator", new ConfigOptionEnum<PerimeterGeneratorType>(PerimeterGeneratorType::Classic)); | ||||||
|     model().objects[0]->config.set_key_value("seam_position", new ConfigOptionEnum<SeamPosition>(spRear)); |     model().objects[0]->config.set_key_value("seam_position", new ConfigOptionEnum<SeamPosition>(spRear)); | ||||||
| 
 | 
 | ||||||
|     changed_objects({ 0 }); |     changed_objects({ 0 }); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 SoftFever
						SoftFever