mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	Fix overly persistent pressure advance pattern (#1591)
* Reset model's calib_pa_pattern as needed * Add initial config for skirt and brim in PA pattern
This commit is contained in:
		
							parent
							
								
									c0cb91bb8a
								
							
						
					
					
						commit
						910d79ae6f
					
				
					 3 changed files with 17 additions and 5 deletions
				
			
		|  | @ -71,6 +71,7 @@ Model& Model::assign_copy(const Model &rhs) | |||
|     // BBS
 | ||||
|     this->plates_custom_gcodes = rhs.plates_custom_gcodes; | ||||
|     this->curr_plate_index = rhs.curr_plate_index; | ||||
|     this->calib_pa_pattern.reset(); | ||||
| 
 | ||||
|     if (rhs.calib_pa_pattern) { | ||||
|         this->calib_pa_pattern = std::make_unique<CalibPressureAdvancePattern>( | ||||
|  | @ -106,7 +107,8 @@ Model& Model::assign_copy(Model &&rhs) | |||
|     // BBS
 | ||||
|     this->plates_custom_gcodes = std::move(rhs.plates_custom_gcodes); | ||||
|     this->curr_plate_index = rhs.curr_plate_index; | ||||
|     this->calib_pa_pattern = std::move(rhs.calib_pa_pattern); | ||||
|     this->calib_pa_pattern.reset(); | ||||
|     this->calib_pa_pattern.swap(rhs.calib_pa_pattern); | ||||
| 
 | ||||
|     //BBS: add auxiliary path logic
 | ||||
|     // BBS: backup, all in one temp dir
 | ||||
|  |  | |||
|  | @ -116,7 +116,7 @@ private: | |||
|     bool m_draw_numbers {true}; | ||||
| }; | ||||
| 
 | ||||
| struct SuggestedCalibPressureAdvancePatternConfig { | ||||
| struct SuggestedConfigCalibPAPattern { | ||||
|     const std::vector<std::pair<std::string, double>> float_pairs { | ||||
|         {"initial_layer_print_height", 0.25}, | ||||
|         {"layer_height", 0.2}, | ||||
|  | @ -130,8 +130,11 @@ struct SuggestedCalibPressureAdvancePatternConfig { | |||
|     }; | ||||
| 
 | ||||
|     const std::vector<std::pair<std::string, int>> int_pairs { | ||||
|         {"skirt_loops", 0}, | ||||
|         {"wall_loops", 3} | ||||
|     }; | ||||
| 
 | ||||
|     const std::pair<std::string, BrimType> brim_pair {"brim_type", BrimType::btNoBrim}; | ||||
| }; | ||||
| 
 | ||||
| class CalibPressureAdvancePattern : public CalibPressureAdvance { | ||||
|  |  | |||
|  | @ -4150,6 +4150,7 @@ void Plater::priv::delete_all_objects_from_model() | |||
|     object_list_changed(); | ||||
| 
 | ||||
|     //BBS
 | ||||
|     model.calib_pa_pattern.reset(); | ||||
|     model.plates_custom_gcodes.clear(); | ||||
| } | ||||
| 
 | ||||
|  | @ -4201,6 +4202,7 @@ void Plater::priv::reset(bool apply_presets_change) | |||
|         wxGetApp().load_current_presets(false, false); | ||||
| 
 | ||||
|     //BBS
 | ||||
|     model.calib_pa_pattern.reset(); | ||||
|     model.plates_custom_gcodes.clear(); | ||||
| 
 | ||||
|     // BBS
 | ||||
|  | @ -8142,14 +8144,14 @@ void Plater::_calib_pa_pattern(const Calib_Params& params) | |||
|     const DynamicPrintConfig& printer_config = wxGetApp().preset_bundle->printers.get_edited_preset().config; | ||||
|     DynamicPrintConfig& print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; | ||||
| 
 | ||||
|     for (const auto opt : SuggestedCalibPressureAdvancePatternConfig().float_pairs) { | ||||
|     for (const auto opt : SuggestedConfigCalibPAPattern().float_pairs) { | ||||
|         print_config.set_key_value( | ||||
|             opt.first, | ||||
|             new ConfigOptionFloat(opt.second) | ||||
|         ); | ||||
|     } | ||||
| 
 | ||||
|     for (const auto opt : SuggestedCalibPressureAdvancePatternConfig().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( | ||||
|             opt.first, | ||||
|  | @ -8157,13 +8159,18 @@ void Plater::_calib_pa_pattern(const Calib_Params& params) | |||
|         ); | ||||
|     } | ||||
| 
 | ||||
|     for (const auto opt : SuggestedCalibPressureAdvancePatternConfig().int_pairs) { | ||||
|     for (const auto opt : SuggestedConfigCalibPAPattern().int_pairs) { | ||||
|         print_config.set_key_value( | ||||
|             opt.first, | ||||
|             new ConfigOptionInt(opt.second) | ||||
|         ); | ||||
|     } | ||||
| 
 | ||||
|     print_config.set_key_value( | ||||
|         SuggestedConfigCalibPAPattern().brim_pair.first, | ||||
|         new ConfigOptionEnum<BrimType>(SuggestedConfigCalibPAPattern().brim_pair.second) | ||||
|     ); | ||||
| 
 | ||||
|     wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty(); | ||||
|     wxGetApp().get_tab(Preset::TYPE_PRINT)->reload_config(); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 thewildmage
						thewildmage