Added gcode_label_objects and gcode_comments option

This commit is contained in:
SoftFever 2023-03-12 17:36:54 +08:00
parent 11679d6858
commit a47c756112
12 changed files with 37 additions and 19 deletions

View file

@ -23,7 +23,8 @@ Prebuilt binaries are available through the [github releases page](https://githu
**Mac**: **Mac**:
> 1. Download the right binaries for your computer: `arm64` version for Apple Silicon and `x86_64` for Intel CPU. > 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. > 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)**: **Linux(Ubuntu)**:
> Run the downlaoded AppImage. > Run the downlaoded AppImage.

View file

@ -1,7 +1,7 @@
{ {
"name": "Bambulab", "name": "Bambulab",
"url": "http://www.bambulab.com/Parameters/vendor/BBL.json", "url": "http://www.bambulab.com/Parameters/vendor/BBL.json",
"version": "01.05.00.19", "version": "01.05.00.20",
"force_update": "0", "force_update": "0",
"description": "the initial version of BBL configurations", "description": "the initial version of BBL configurations",
"machine_model_list": [ "machine_model_list": [

View file

@ -106,5 +106,6 @@
"wipe_tower_no_sparse_layers": "0", "wipe_tower_no_sparse_layers": "0",
"prime_tower_width": "35", "prime_tower_width": "35",
"xy_hole_compensation": "0", "xy_hole_compensation": "0",
"xy_contour_compensation": "0" "xy_contour_compensation": "0",
"gcode_label_objects": "0"
} }

View file

@ -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 float g_purge_volume_one_time = 135.f;
static const int g_max_flush_count = 4; static const int g_max_flush_count = 4;
bool GCode::gcode_label_objects = true;
Vec2d travel_point_1; Vec2d travel_point_1;
Vec2d travel_point_2; Vec2d travel_point_2;
Vec2d travel_point_3; Vec2d travel_point_3;
@ -1036,6 +1034,7 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
// BBS // BBS
m_curr_print = print; m_curr_print = print;
GCodeWriter::full_gcode_comment = print->config().gcode_comments;
CNumericLocalesSetter locales_setter; CNumericLocalesSetter locales_setter;
// Does the file exist? If so, we hope that it is still valid. // 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(); GCodeProcessor::s_IsBBLPrinter = print->is_BBL_printer();
print->set_started(psGCodeExport); 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 // check if any custom gcode contains keywords used by the gcode processor to
// produce time estimation and gcode toolpaths // produce time estimation and gcode toolpaths
@ -3189,7 +3183,7 @@ GCode::LayerResult GCode::process_layer(
m_object_layer_over_raft = object_layer_over_raft; m_object_layer_over_raft = object_layer_over_raft;
if (m_config.reduce_crossing_wall) if (m_config.reduce_crossing_wall)
m_avoid_crossing_perimeters.init_layer(*m_layer); 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"; 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) if (!m_config.use_relative_e_distances)
gcode += m_writer.reset_e(true); gcode += m_writer.reset_e(true);
@ -3281,7 +3275,7 @@ GCode::LayerResult GCode::process_layer(
// ironing // ironing
gcode += this->extrude_infill(print,by_region_specific, true); 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"; 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) if (!m_config.use_relative_e_distances)
gcode += m_writer.reset_e(true); gcode += m_writer.reset_e(true);

View file

@ -492,8 +492,6 @@ private:
coordf_t m_nominal_z; coordf_t m_nominal_z;
bool m_need_change_layer_lift_z = false; bool m_need_change_layer_lift_z = false;
static bool gcode_label_objects;
// BBS // BBS
int get_bed_temperature(const int extruder_id, const bool is_first_layer, const BedType bed_type) const; int get_bed_temperature(const int extruder_id, const bool is_first_layer, const BedType bed_type) const;

View file

@ -15,7 +15,7 @@
namespace Slic3r { namespace Slic3r {
const bool GCodeWriter::full_gcode_comment = true; bool GCodeWriter::full_gcode_comment = true;
const double GCodeWriter::slope_threshold = 3 * PI / 180; const double GCodeWriter::slope_threshold = 3 * PI / 180;
void GCodeWriter::apply_print_config(const PrintConfig &print_config) void GCodeWriter::apply_print_config(const PrintConfig &print_config)

View file

@ -92,7 +92,7 @@ public:
void set_current_position_clear(bool clear) { m_is_current_pos_clear = clear; }; 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; }; bool is_current_position_clear() const { return m_is_current_pos_clear; };
//BBS: //BBS:
static const bool full_gcode_comment; static bool full_gcode_comment;
//Radian threshold of slope for lazy lift and spiral lift; //Radian threshold of slope for lazy lift and spiral lift;
static const double slope_threshold; static const double slope_threshold;
//SoftFever //SoftFever

View file

@ -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", "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", "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", "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"
}; };

View file

@ -158,7 +158,9 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
"use_relative_e_distances", "use_relative_e_distances",
"accel_to_decel_enable", "accel_to_decel_enable",
"accel_to_decel_factor", "accel_to_decel_factor",
"wipe_on_loops" "wipe_on_loops",
"gcode_comments",
"gcode_label_objects"
}; };
static std::unordered_set<std::string> steps_ignore; static std::unordered_set<std::string> steps_ignore;

View file

@ -1795,6 +1795,22 @@ void PrintConfigDef::init_fff_params()
def->readonly = false; def->readonly = false;
def->set_default_value(new ConfigOptionEnum<GCodeFlavor>(gcfMarlinLegacy)); 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 //BBS
def = this->add("infill_combination", coBool); def = this->add("infill_combination", coBool);
def->label = L("Infill combination"); def->label = L("Infill combination");

View file

@ -844,6 +844,7 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionBool, gcode_add_line_number)) ((ConfigOptionBool, gcode_add_line_number))
((ConfigOptionBool, bbl_bed_temperature_gcode)) ((ConfigOptionBool, bbl_bed_temperature_gcode))
((ConfigOptionEnum<GCodeFlavor>, gcode_flavor)) ((ConfigOptionEnum<GCodeFlavor>, gcode_flavor))
((ConfigOptionString, layer_change_gcode)) ((ConfigOptionString, layer_change_gcode))
//#ifdef HAS_PRESSURE_EQUALIZER //#ifdef HAS_PRESSURE_EQUALIZER
// ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_positive)) // ((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_positive))
@ -997,6 +998,8 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionBool, independent_support_layer_height)) ((ConfigOptionBool, independent_support_layer_height))
// SoftFever // SoftFever
((ConfigOptionPercents, filament_shrink)) ((ConfigOptionPercents, filament_shrink))
((ConfigOptionBool, gcode_label_objects))
((ConfigOptionBool, gcode_comments))
) )

View file

@ -2053,6 +2053,8 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("G-code output"), L"param_gcode"); optgroup = page->new_optgroup(L("G-code output"), L"param_gcode");
optgroup->append_single_option_line("reduce_infill_retraction"); optgroup->append_single_option_line("reduce_infill_retraction");
optgroup->append_single_option_line("gcode_add_line_number"); 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 option = optgroup->get_option("filename_format");
// option.opt.full_width = true; // option.opt.full_width = true;
option.opt.is_code = true; option.opt.is_code = true;