mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
Add a new option "emit_machine_limits_to_gcode" (#3236)
This commit is contained in:
parent
01706eff84
commit
cc23ec6626
5 changed files with 16 additions and 4 deletions
|
@ -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)
|
void GCode::print_machine_envelope(GCodeOutputStream &file, Print &print)
|
||||||
{
|
{
|
||||||
const auto flavor = print.config().gcode_flavor.value;
|
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
|
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",
|
file.write_format("M201 X%d Y%d Z%d E%d\n",
|
||||||
int(print.config().machine_max_acceleration_x.values.front() + 0.5),
|
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_y.values.front() * factor,
|
||||||
print.config().machine_max_jerk_z.values.front() * factor,
|
print.config().machine_max_jerk_z.values.front() * factor,
|
||||||
print.config().machine_max_jerk_e.values.front() * factor);
|
print.config().machine_max_jerk_e.values.front() * factor);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -878,7 +878,7 @@ static std::vector<std::string> s_Preset_printer_options {
|
||||||
"cooling_tube_retraction",
|
"cooling_tube_retraction",
|
||||||
"cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "purge_in_prime_tower", "enable_filament_ramming",
|
"cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "purge_in_prime_tower", "enable_filament_ramming",
|
||||||
"z_offset",
|
"z_offset",
|
||||||
"disable_m73", "preferred_orientation"
|
"disable_m73", "preferred_orientation", "emit_machine_limits_to_gcode"
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::vector<std::string> s_Preset_sla_print_options {
|
static std::vector<std::string> s_Preset_sla_print_options {
|
||||||
|
|
|
@ -2564,6 +2564,14 @@ def = this->add("filament_loading_speed", coFloats);
|
||||||
def->mode = comDevelop;
|
def->mode = comDevelop;
|
||||||
def->set_default_value(new ConfigOptionBool(false));
|
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 = this->add("machine_pause_gcode", coString);
|
||||||
def->label = L("Pause G-code");
|
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");
|
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");
|
||||||
|
|
|
@ -907,6 +907,8 @@ PRINT_CONFIG_CLASS_DEFINE(
|
||||||
PRINT_CONFIG_CLASS_DEFINE(
|
PRINT_CONFIG_CLASS_DEFINE(
|
||||||
MachineEnvelopeConfig,
|
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]
|
// M201 X... Y... Z... E... [mm/sec^2]
|
||||||
((ConfigOptionFloats, machine_max_acceleration_x))
|
((ConfigOptionFloats, machine_max_acceleration_x))
|
||||||
((ConfigOptionFloats, machine_max_acceleration_y))
|
((ConfigOptionFloats, machine_max_acceleration_y))
|
||||||
|
|
|
@ -3684,6 +3684,8 @@ PageShp TabPrinter::build_kinematics_page()
|
||||||
|
|
||||||
optgroup->append_line(line);
|
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<std::string> speed_axes{
|
const std::vector<std::string> speed_axes{
|
||||||
"machine_max_speed_x",
|
"machine_max_speed_x",
|
||||||
|
@ -3691,7 +3693,7 @@ PageShp TabPrinter::build_kinematics_page()
|
||||||
"machine_max_speed_z",
|
"machine_max_speed_z",
|
||||||
"machine_max_speed_e"
|
"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) {
|
for (const std::string &speed_axis : speed_axes) {
|
||||||
append_option_line(optgroup, speed_axis);
|
append_option_line(optgroup, speed_axis);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue