mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Fixed a bug in initialization of some StaticPrintConfig derived classes.
Merged implementation of support for "Octoprint-Cancelobject" #972 thanks @supermerill
This commit is contained in:
		
							parent
							
								
									85f7d28c6f
								
							
						
					
					
						commit
						c82d346c1a
					
				
					 6 changed files with 22 additions and 5 deletions
				
			
		|  | @ -1622,6 +1622,8 @@ void GCode::process_layer( | |||
| 
 | ||||
|                 unsigned int copy_id = 0; | ||||
|                 for (const Point © : copies) { | ||||
|                     if (this->config().gcode_label_objects) | ||||
|                         gcode += std::string("; printing object ") + print_object->model_object()->name + " id:" + std::to_string(layer_id) + " copy " + std::to_string(copy_id) + "\n"; | ||||
|                     // When starting a new object, use the external motion planner for the first travel move.
 | ||||
|                     std::pair<const PrintObject*, Point> this_object_copy(print_object, copy); | ||||
|                     if (m_last_obj_copy != this_object_copy) | ||||
|  | @ -1646,7 +1648,9 @@ void GCode::process_layer( | |||
|                             gcode += this->extrude_infill(print,by_region_specific); | ||||
|                         } | ||||
|                     } | ||||
|                     ++copy_id; | ||||
|                     if (this->config().gcode_label_objects) | ||||
| 						gcode += std::string("; stop printing object ") + print_object->model_object()->name + " id:" + std::to_string(layer_id) + " copy " + std::to_string(copy_id) + "\n"; | ||||
|                     ++ copy_id; | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  |  | |||
|  | @ -127,6 +127,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option | |||
|         "first_layer_speed", | ||||
|         "gcode_comments", | ||||
|         "gcode_flavor", | ||||
|         "gcode_label_objects", | ||||
|         "infill_acceleration", | ||||
|         "layer_gcode", | ||||
|         "min_fan_speed", | ||||
|  |  | |||
|  | @ -930,6 +930,15 @@ void PrintConfigDef::init_fff_params() | |||
|     def->mode = comExpert; | ||||
|     def->default_value = new ConfigOptionEnum<GCodeFlavor>(gcfRepRap); | ||||
| 
 | ||||
|     def = this->add("gcode_label_objects", coBool); | ||||
|     def->label = "Label objects"; | ||||
|     def->tooltip = "Enable this to add comments into the G-Code labeling print moves with what object they belong to," | ||||
|                    " which is useful for the Octoprint CancelObject plugin. This settings is NOT compatible with " | ||||
|                    "Single Extruder Multi Material setup and Wipe into Object / Wipe into Infill."; | ||||
|     def->cli = "gcode-label-objects!"; | ||||
|     def->mode = comAdvanced; | ||||
|     def->default_value = new ConfigOptionBool(0); | ||||
| 
 | ||||
|     def = this->add("high_current_on_filament_swap", coBool); | ||||
|     def->label = L("High extruder current on filament swap"); | ||||
|     def->tooltip = L("It may be beneficial to increase the extruder motor current during the filament exchange" | ||||
|  |  | |||
|  | @ -619,6 +619,7 @@ public: | |||
|     ConfigOptionStrings             filament_ramming_parameters; | ||||
|     ConfigOptionBool                gcode_comments; | ||||
|     ConfigOptionEnum<GCodeFlavor>   gcode_flavor; | ||||
|     ConfigOptionBool                gcode_label_objects; | ||||
|     ConfigOptionString              layer_gcode; | ||||
|     ConfigOptionFloat               max_print_speed; | ||||
|     ConfigOptionFloat               max_volumetric_speed; | ||||
|  | @ -690,6 +691,7 @@ protected: | |||
|         OPT_PTR(filament_ramming_parameters); | ||||
|         OPT_PTR(gcode_comments); | ||||
|         OPT_PTR(gcode_flavor); | ||||
|         OPT_PTR(gcode_label_objects); | ||||
|         OPT_PTR(layer_gcode); | ||||
|         OPT_PTR(max_print_speed); | ||||
|         OPT_PTR(max_volumetric_speed); | ||||
|  | @ -730,7 +732,7 @@ protected: | |||
| class PrintConfig : public MachineEnvelopeConfig, public GCodeConfig | ||||
| { | ||||
|     STATIC_PRINT_CONFIG_CACHE_DERIVED(PrintConfig) | ||||
|     PrintConfig() : GCodeConfig(0) { initialize_cache(); *this = s_cache_PrintConfig.defaults(); } | ||||
| 	PrintConfig() : MachineEnvelopeConfig(0), GCodeConfig(0) { initialize_cache(); *this = s_cache_PrintConfig.defaults(); } | ||||
| public: | ||||
|     double                          min_object_distance() const; | ||||
|     static double                   min_object_distance(const ConfigBase *config); | ||||
|  | @ -808,7 +810,7 @@ public: | |||
|     ConfigOptionFloat               exp_time_first; | ||||
| 
 | ||||
| protected: | ||||
|     PrintConfig(int) : GCodeConfig(1) {} | ||||
| 	PrintConfig(int) : MachineEnvelopeConfig(1), GCodeConfig(1) {} | ||||
|     void initialize(StaticCacheBase &cache, const char *base_ptr) | ||||
|     { | ||||
|         this->MachineEnvelopeConfig::initialize(cache, base_ptr); | ||||
|  |  | |||
|  | @ -336,7 +336,7 @@ const std::vector<std::string>& Preset::print_options() | |||
|         "support_material_synchronize_layers", "support_material_angle", "support_material_interface_layers",  | ||||
|         "support_material_interface_spacing", "support_material_interface_contact_loops", "support_material_contact_distance",  | ||||
|         "support_material_buildplate_only", "dont_support_bridges", "notes", "complete_objects", "extruder_clearance_radius",  | ||||
|         "extruder_clearance_height", "gcode_comments", "output_filename_format", "post_process", "perimeter_extruder",  | ||||
|         "extruder_clearance_height", "gcode_comments", "gcode_label_objects", "output_filename_format", "post_process", "perimeter_extruder",  | ||||
|         "infill_extruder", "solid_infill_extruder", "support_material_extruder", "support_material_interface_extruder",  | ||||
|         "ooze_prevention", "standby_temperature_delta", "interface_shells", "extrusion_width", "first_layer_extrusion_width",  | ||||
|         "perimeter_extrusion_width", "external_perimeter_extrusion_width", "infill_extrusion_width", "solid_infill_extrusion_width",  | ||||
|  | @ -1163,7 +1163,7 @@ std::string PresetCollection::name() const | |||
|     case Preset::TYPE_PRINT:        return L("print"); | ||||
|     case Preset::TYPE_FILAMENT:     return L("filament"); | ||||
|     case Preset::TYPE_SLA_PRINT:    return L("SLA print"); | ||||
|     case Preset::TYPE_SLA_MATERIAL: return L("SLA material");     | ||||
|     case Preset::TYPE_SLA_MATERIAL: return L("SLA material"); | ||||
|     case Preset::TYPE_PRINTER:      return L("printer"); | ||||
|     default:                        return "invalid"; | ||||
|     } | ||||
|  |  | |||
|  | @ -1095,6 +1095,7 @@ void TabPrint::build() | |||
| 
 | ||||
| 		optgroup = page->new_optgroup(_(L("Output file"))); | ||||
| 		optgroup->append_single_option_line("gcode_comments"); | ||||
| 		optgroup->append_single_option_line("gcode_label_objects"); | ||||
| 		option = optgroup->get_option("output_filename_format"); | ||||
| 		option.opt.full_width = true; | ||||
| 		optgroup->append_single_option_line(option); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv