mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Added gcode_label_objects and gcode_comments option
This commit is contained in:
		
							parent
							
								
									11679d6858
								
							
						
					
					
						commit
						a47c756112
					
				
					 12 changed files with 37 additions and 19 deletions
				
			
		|  | @ -23,7 +23,8 @@ Prebuilt binaries are available through the [github releases page](https://githu | |||
| **Mac**: | ||||
| >  1. Download the right binaries for your computer: `arm64` version for Apple Silicon and `x86_64` for Intel CPU.   | ||||
| >  2. Double click to unzip the package, move OrcaSlicer.app to Application folder.   | ||||
| >  3. Run the following command in the terminal to allow running unsigned applications: `xattr -d com.apple.quarantine /Applications/OrcaSlicer.app`. | ||||
| >  3. Run the following command in the terminal to allow running unsigned applications:  | ||||
| >>>> `xattr -d com.apple.quarantine /Applications/OrcaSlicer.app`. | ||||
| 
 | ||||
| **Linux(Ubuntu)**: | ||||
| > Run the downlaoded AppImage.   | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| { | ||||
|     "name": "Bambulab", | ||||
|     "url": "http://www.bambulab.com/Parameters/vendor/BBL.json", | ||||
|     "version": "01.05.00.19", | ||||
|     "version": "01.05.00.20", | ||||
|     "force_update": "0", | ||||
|     "description": "the initial version of BBL configurations", | ||||
|     "machine_model_list": [ | ||||
|  |  | |||
|  | @ -106,5 +106,6 @@ | |||
|     "wipe_tower_no_sparse_layers": "0", | ||||
|     "prime_tower_width": "35", | ||||
|     "xy_hole_compensation": "0", | ||||
|     "xy_contour_compensation": "0" | ||||
|     "xy_contour_compensation": "0", | ||||
|     "gcode_label_objects": "0" | ||||
| } | ||||
|  |  | |||
|  | @ -80,8 +80,6 @@ static const float g_min_purge_volume = 100.f; | |||
| static const float g_purge_volume_one_time = 135.f; | ||||
| static const int g_max_flush_count = 4; | ||||
| 
 | ||||
| bool GCode::gcode_label_objects = true; | ||||
| 
 | ||||
| Vec2d travel_point_1; | ||||
| Vec2d travel_point_2; | ||||
| Vec2d travel_point_3; | ||||
|  | @ -1036,6 +1034,7 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu | |||
|     // BBS
 | ||||
|     m_curr_print = print; | ||||
| 
 | ||||
|     GCodeWriter::full_gcode_comment = print->config().gcode_comments; | ||||
|     CNumericLocalesSetter locales_setter; | ||||
| 
 | ||||
|     // Does the file exist? If so, we hope that it is still valid.
 | ||||
|  | @ -1046,11 +1045,6 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu | |||
|     GCodeProcessor::s_IsBBLPrinter = print->is_BBL_printer(); | ||||
|     print->set_started(psGCodeExport); | ||||
| 
 | ||||
|     if (print->is_BBL_printer()) | ||||
|       gcode_label_objects = false; | ||||
|     else | ||||
|       gcode_label_objects = true; | ||||
| 
 | ||||
| 
 | ||||
|     // check if any custom gcode contains keywords used by the gcode processor to
 | ||||
|     // produce time estimation and gcode toolpaths
 | ||||
|  | @ -3189,7 +3183,7 @@ GCode::LayerResult GCode::process_layer( | |||
|                 m_object_layer_over_raft = object_layer_over_raft; | ||||
|                 if (m_config.reduce_crossing_wall) | ||||
|                     m_avoid_crossing_perimeters.init_layer(*m_layer); | ||||
|                 if (GCode::gcode_label_objects) { | ||||
|                 if (this->config().gcode_label_objects) { | ||||
|                     gcode += std::string("; printing object ") + instance_to_print.print_object.model_object()->name + " id:" + std::to_string(instance_to_print.layer_id) + " copy " + std::to_string(instance_to_print.instance_id) + "\n"; | ||||
|                     if (!m_config.use_relative_e_distances) | ||||
|                         gcode += m_writer.reset_e(true); | ||||
|  | @ -3281,7 +3275,7 @@ GCode::LayerResult GCode::process_layer( | |||
|                     // ironing
 | ||||
|                     gcode += this->extrude_infill(print,by_region_specific, true); | ||||
|                 } | ||||
|                 if (GCode::gcode_label_objects) { | ||||
|                 if (this->config().gcode_label_objects) { | ||||
|                     gcode += std::string("; stop printing object ") + instance_to_print.print_object.model_object()->name + " id:" + std::to_string(instance_to_print.layer_id) + " copy " + std::to_string(instance_to_print.instance_id) + "\n"; | ||||
|                     if (!m_config.use_relative_e_distances) | ||||
|                         gcode += m_writer.reset_e(true); | ||||
|  |  | |||
|  | @ -492,8 +492,6 @@ private: | |||
|     coordf_t m_nominal_z; | ||||
|     bool m_need_change_layer_lift_z = false; | ||||
| 
 | ||||
|     static bool gcode_label_objects; | ||||
| 
 | ||||
|     // BBS
 | ||||
|     int get_bed_temperature(const int extruder_id, const bool is_first_layer, const BedType bed_type) const; | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,7 +15,7 @@ | |||
| 
 | ||||
| namespace Slic3r { | ||||
| 
 | ||||
| const bool GCodeWriter::full_gcode_comment = true; | ||||
| bool GCodeWriter::full_gcode_comment = true; | ||||
| const double GCodeWriter::slope_threshold = 3 * PI / 180; | ||||
| 
 | ||||
| void GCodeWriter::apply_print_config(const PrintConfig &print_config) | ||||
|  |  | |||
|  | @ -92,7 +92,7 @@ public: | |||
|     void set_current_position_clear(bool clear) { m_is_current_pos_clear = clear; }; | ||||
|     bool is_current_position_clear() const { return m_is_current_pos_clear; }; | ||||
|     //BBS:
 | ||||
|     static const bool full_gcode_comment; | ||||
|     static bool full_gcode_comment; | ||||
|     //Radian threshold of slope for lazy lift and spiral lift;
 | ||||
|     static const double slope_threshold; | ||||
|     //SoftFever
 | ||||
|  |  | |||
|  | @ -754,7 +754,8 @@ static std::vector<std::string> s_Preset_print_options { | |||
|      "top_solid_infill_flow_ratio","bottom_solid_infill_flow_ratio","only_one_wall_first_layer", "print_flow_ratio", "seam_gap", | ||||
|     "role_based_wipe_speed", "wipe_speed", "accel_to_decel_enable", "accel_to_decel_factor", "wipe_on_loops", | ||||
|     "bridge_density", "precise_outer_wall", "overhang_speed_classic", "bridge_acceleration", | ||||
|     "sparse_infill_acceleration", "internal_solid_infill_acceleration", "tree_support_adaptive_layer_height" | ||||
|     "sparse_infill_acceleration", "internal_solid_infill_acceleration", "tree_support_adaptive_layer_height", | ||||
|     "gcode_comments", "gcode_label_objects" | ||||
| 
 | ||||
| }; | ||||
| 
 | ||||
|  |  | |||
|  | @ -158,7 +158,9 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n | |||
|         "use_relative_e_distances", | ||||
|         "accel_to_decel_enable", | ||||
|         "accel_to_decel_factor", | ||||
|         "wipe_on_loops" | ||||
|         "wipe_on_loops", | ||||
|         "gcode_comments", | ||||
|         "gcode_label_objects" | ||||
|     }; | ||||
| 
 | ||||
|     static std::unordered_set<std::string> steps_ignore; | ||||
|  | @ -3325,4 +3327,4 @@ int Print::load_cached_data(const std::string& directory) | |||
|     return ret; | ||||
| } | ||||
| 
 | ||||
| } // namespace Slic3r
 | ||||
| } // namespace Slic3r
 | ||||
|  |  | |||
|  | @ -1795,6 +1795,22 @@ void PrintConfigDef::init_fff_params() | |||
|     def->readonly = false; | ||||
|     def->set_default_value(new ConfigOptionEnum<GCodeFlavor>(gcfMarlinLegacy)); | ||||
| 
 | ||||
|     def = this->add("gcode_label_objects", coBool); | ||||
|     def->label = L("Label objects"); | ||||
|     def->tooltip = L("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->mode = comAdvanced; | ||||
|     def->set_default_value(new ConfigOptionBool(1)); | ||||
|      | ||||
|     def = this->add("gcode_comments", coBool); | ||||
|     def->label = L("Verbose G-code"); | ||||
|     def->tooltip = L("Enable this to get a commented G-code file, with each line explained by a descriptive text. " | ||||
|                    "If you print from SD card, the additional weight of the file could make your firmware " | ||||
|                    "slow down."); | ||||
|     def->mode = comAdvanced; | ||||
|     def->set_default_value(new ConfigOptionBool(0)); | ||||
|      | ||||
|     //BBS
 | ||||
|     def = this->add("infill_combination", coBool); | ||||
|     def->label = L("Infill combination"); | ||||
|  |  | |||
|  | @ -844,6 +844,7 @@ PRINT_CONFIG_CLASS_DEFINE( | |||
|     ((ConfigOptionBool,                gcode_add_line_number)) | ||||
|     ((ConfigOptionBool,                bbl_bed_temperature_gcode)) | ||||
|     ((ConfigOptionEnum<GCodeFlavor>,   gcode_flavor)) | ||||
| 
 | ||||
|     ((ConfigOptionString,              layer_change_gcode)) | ||||
| //#ifdef HAS_PRESSURE_EQUALIZER
 | ||||
| //    ((ConfigOptionFloat,               max_volumetric_extrusion_rate_slope_positive))
 | ||||
|  | @ -997,6 +998,8 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( | |||
|     ((ConfigOptionBool, independent_support_layer_height)) | ||||
|     // SoftFever
 | ||||
|     ((ConfigOptionPercents,             filament_shrink)) | ||||
|     ((ConfigOptionBool,                gcode_label_objects)) | ||||
|     ((ConfigOptionBool,                gcode_comments)) | ||||
| 
 | ||||
| ) | ||||
| 
 | ||||
|  |  | |||
|  | @ -2053,6 +2053,8 @@ void TabPrint::build() | |||
|         optgroup = page->new_optgroup(L("G-code output"), L"param_gcode"); | ||||
|         optgroup->append_single_option_line("reduce_infill_retraction"); | ||||
|         optgroup->append_single_option_line("gcode_add_line_number"); | ||||
|         optgroup->append_single_option_line("gcode_comments"); | ||||
|         optgroup->append_single_option_line("gcode_label_objects"); | ||||
|         Option option = optgroup->get_option("filename_format"); | ||||
|         // option.opt.full_width = true;
 | ||||
|         option.opt.is_code = true; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 SoftFever
						SoftFever