mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-31 20:51:12 -06:00 
			
		
		
		
	Export the first M73 line to gcode before custom gcode
This commit is contained in:
		
							parent
							
								
									00c51e06ed
								
							
						
					
					
						commit
						62894d3f7b
					
				
					 3 changed files with 23 additions and 2 deletions
				
			
		|  | @ -665,6 +665,14 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data) | |||
|         _write_format(file, "\n"); | ||||
|     } | ||||
|      | ||||
|     // adds tags for time estimators
 | ||||
|     if (print.config.remaining_times.value) | ||||
|     { | ||||
|         _writeln(file, GCodeTimeEstimator::Normal_First_M73_Output_Placeholder_Tag); | ||||
|         if (m_silent_time_estimator_enabled) | ||||
|             _writeln(file, GCodeTimeEstimator::Silent_First_M73_Output_Placeholder_Tag); | ||||
|     } | ||||
| 
 | ||||
|     // Prepare the helper object for replacing placeholders in custom G-code and output filename.
 | ||||
|     m_placeholder_parser = print.placeholder_parser; | ||||
|     m_placeholder_parser.update_timestamp(); | ||||
|  | @ -724,7 +732,6 @@ void GCode::_do_export(Print &print, FILE *file, GCodePreviewData *preview_data) | |||
|     m_placeholder_parser.set("has_wipe_tower", has_wipe_tower); | ||||
|     m_placeholder_parser.set("has_single_extruder_multi_material_priming", has_wipe_tower && print.config.single_extruder_multi_material_priming); | ||||
|     std::string start_gcode = this->placeholder_parser_process("start_gcode", print.config.start_gcode.value, initial_extruder_id); | ||||
|      | ||||
|     // Set bed temperature if the start G-code does not contain any bed temp control G-codes.
 | ||||
|     this->_print_first_layer_bed_temperature(file, print, start_gcode, initial_extruder_id, true); | ||||
|     // Set extruder(s) temperature before and after start G-code.
 | ||||
|  |  | |||
|  | @ -168,6 +168,9 @@ namespace Slic3r { | |||
|     } | ||||
| #endif // ENABLE_MOVE_STATS
 | ||||
| 
 | ||||
|     const std::string GCodeTimeEstimator::Normal_First_M73_Output_Placeholder_Tag = "; NORMAL_FIRST_M73_OUTPUT_PLACEHOLDER"; | ||||
|     const std::string GCodeTimeEstimator::Silent_First_M73_Output_Placeholder_Tag = "; SILENT_FIRST_M73_OUTPUT_PLACEHOLDER"; | ||||
| 
 | ||||
|     GCodeTimeEstimator::GCodeTimeEstimator(EMode mode) | ||||
|         : _mode(mode) | ||||
|     { | ||||
|  | @ -294,7 +297,15 @@ namespace Slic3r { | |||
|                 throw std::runtime_error(std::string("Remaining times export failed.\nError while reading from file.\n")); | ||||
|             } | ||||
| 
 | ||||
|             gcode_line += "\n"; | ||||
|             // replaces placeholders for initial line M73 with the real lines
 | ||||
|             if (((_mode == Normal) && (gcode_line == Normal_First_M73_Output_Placeholder_Tag)) || | ||||
|                 ((_mode == Silent) && (gcode_line == Silent_First_M73_Output_Placeholder_Tag))) | ||||
|             { | ||||
|                 sprintf(time_line, time_mask.c_str(), std::to_string(0), _get_time_minutes(_time).c_str()); | ||||
|                 gcode_line = time_line; | ||||
|             } | ||||
|             else | ||||
|                gcode_line += "\n"; | ||||
| 
 | ||||
|             // add remaining time lines where needed
 | ||||
|             _parser.parse_line(gcode_line, | ||||
|  |  | |||
|  | @ -17,6 +17,9 @@ namespace Slic3r { | |||
|     class GCodeTimeEstimator | ||||
|     { | ||||
|     public: | ||||
|         static const std::string Normal_First_M73_Output_Placeholder_Tag; | ||||
|         static const std::string Silent_First_M73_Output_Placeholder_Tag; | ||||
| 
 | ||||
|         enum EMode : unsigned char | ||||
|         { | ||||
|             Normal, | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Enrico Turri
						Enrico Turri