diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 8c0e8bb4f5..3b5034bdad 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -3026,7 +3026,8 @@ static bool custom_gcode_sets_temperature(const std::string &gcode, const int mc void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print) { const auto flavor = print.config().gcode_flavor.value; - if (flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware) { + if ((flavor == gcfMarlinLegacy || flavor == gcfMarlinFirmware || flavor == gcfRepRapFirmware) && + print.config().emit_machine_limits_to_gcode.value == true) { int factor = flavor == gcfRepRapFirmware ? 60 : 1; // RRF M203 and M566 are in mm/min file.write_format("M201 X%d Y%d Z%d E%d\n", int(print.config().machine_max_acceleration_x.values.front() + 0.5), @@ -3069,7 +3070,6 @@ void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print) print.config().machine_max_jerk_y.values.front() * factor, print.config().machine_max_jerk_z.values.front() * factor, print.config().machine_max_jerk_e.values.front() * factor); - } } diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 127dc7aa57..89f1f49812 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -878,7 +878,7 @@ static std::vector s_Preset_printer_options { "cooling_tube_retraction", "cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "purge_in_prime_tower", "enable_filament_ramming", "z_offset", - "disable_m73", "preferred_orientation" + "disable_m73", "preferred_orientation", "emit_machine_limits_to_gcode" }; static std::vector s_Preset_sla_print_options { diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index c3fafc6cb8..ae3df21c86 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2564,6 +2564,14 @@ def = this->add("filament_loading_speed", coFloats); def->mode = comDevelop; def->set_default_value(new ConfigOptionBool(false)); + def = this->add("emit_machine_limits_to_gcode", coBool); + def->label = L("Emit limits to G-code"); + def->category = L("Machine limits"); + def->tooltip = L("If enabled, the machine limits will be emitted to G-code file.\nThis option will be ignored if the g-code flavor is " + "set to Klipper."); + def->mode = comAdvanced; + def->set_default_value(new ConfigOptionBool(true)); + def = this->add("machine_pause_gcode", coString); def->label = L("Pause G-code"); def->tooltip = L("This G-code will be used as a code for the pause print. User can insert pause G-code in gcode viewer"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 91993d3180..56fafb8b6e 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -907,6 +907,8 @@ PRINT_CONFIG_CLASS_DEFINE( PRINT_CONFIG_CLASS_DEFINE( MachineEnvelopeConfig, + // Orca: whether emit machine limits into the beginning of the G-code. + ((ConfigOptionBool, emit_machine_limits_to_gcode)) // M201 X... Y... Z... E... [mm/sec^2] ((ConfigOptionFloats, machine_max_acceleration_x)) ((ConfigOptionFloats, machine_max_acceleration_y)) diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index 402a7ebeda..c94c8771cb 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3684,6 +3684,8 @@ PageShp TabPrinter::build_kinematics_page() optgroup->append_line(line); } + auto optgroup = page->new_optgroup(L("Advanced"), "param_advanced"); + optgroup->append_single_option_line("emit_machine_limits_to_gcode"); const std::vector speed_axes{ "machine_max_speed_x", @@ -3691,7 +3693,7 @@ PageShp TabPrinter::build_kinematics_page() "machine_max_speed_z", "machine_max_speed_e" }; - auto optgroup = page->new_optgroup(L("Speed limitation"), "param_speed"); + optgroup = page->new_optgroup(L("Speed limitation"), "param_speed"); for (const std::string &speed_axis : speed_axes) { append_option_line(optgroup, speed_axis); }