From f495f1b20725557915b0f8cb1d55d2863acd492e Mon Sep 17 00:00:00 2001 From: Vovodroid Date: Fri, 12 Jan 2024 20:34:10 +0200 Subject: [PATCH] Advanced role jerk control --- src/libslic3r/GCode.cpp | 37 +++++++++ src/libslic3r/GCode/GCodeWriter.cpp | 29 +++++++ src/libslic3r/GCode/GCodeWriter.hpp | 4 + src/libslic3r/Preset.cpp | 3 + src/libslic3r/Print.cpp | 10 +++ src/libslic3r/PrintConfig.cpp | 109 +++++++++++++++++++++++--- src/libslic3r/PrintConfig.hpp | 10 +++ src/slic3r/GUI/ConfigManipulation.cpp | 8 +- src/slic3r/GUI/Tab.cpp | 61 +++++++++++--- 9 files changed, 249 insertions(+), 22 deletions(-) diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 9993b018273..d5308075ead 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2900,6 +2900,8 @@ std::string GCodeGenerator::extrude_loop(const ExtrusionLoop &loop_src, bool rev // reset acceleration gcode += m_writer.set_print_acceleration(fast_round_up(m_config.default_acceleration.value)); + //reset jerk + gcode += m_writer.set_jerk(fast_round_up(m_config.default_jerk.value)); if (m_wipe.enabled()) { // Wipe will hide the seam. @@ -2947,6 +2949,8 @@ std::string GCodeGenerator::extrude_skirt( // reset acceleration gcode += m_writer.set_print_acceleration(fast_round_up(m_config.default_acceleration.value)); + // reset jerk + gcode += m_writer.set_jerk(fast_round_up(m_config.default_jerk.value)); if (m_wipe.enabled()) // Wipe will hide the seam. @@ -2972,6 +2976,8 @@ std::string GCodeGenerator::extrude_multi_path(const ExtrusionMultiPath &multipa m_wipe.set_path(std::move(smooth_path), true); // reset acceleration gcode += m_writer.set_print_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5)); + // reset jerk + gcode += m_writer.set_jerk(m_config.default_jerk.value); return gcode; } @@ -3011,6 +3017,8 @@ std::string GCodeGenerator::extrude_path(const ExtrusionPath &path, bool reverse m_wipe.set_path(std::move(smooth_path)); // reset acceleration gcode += m_writer.set_print_acceleration((unsigned int)floor(m_config.default_acceleration.value + 0.5)); + // reset jerk + gcode += m_writer.set_jerk(m_config.default_jerk.value); return gcode; } @@ -3169,6 +3177,31 @@ std::string GCodeGenerator::_extrude( gcode += m_writer.set_print_acceleration((unsigned int)floor(acceleration + 0.5)); } + // adjust jerk + if (m_config.default_jerk.value > 0) { + int jerk; + if (this->on_first_layer() && m_config.first_layer_jerk.value > 0) { + jerk = m_config.first_layer_jerk.value; + } else if (this->object_layer_over_raft() && m_config.first_layer_jerk_over_raft.value > 0) { + jerk = m_config.first_layer_jerk_over_raft.value; + } else if (m_config.bridge_jerk.value > 0 && path_attr.role.is_bridge()) { + jerk = m_config.bridge_jerk.value; + } else if (m_config.top_solid_infill_jerk > 0 && path_attr.role == ExtrusionRole::TopSolidInfill) { + jerk = m_config.top_solid_infill_jerk.value; + } else if (m_config.solid_infill_jerk > 0 && path_attr.role.is_solid_infill()) { + jerk = m_config.solid_infill_jerk.value; + } else if (m_config.infill_jerk.value > 0 && path_attr.role.is_infill()) { + jerk = m_config.infill_jerk.value; + } else if (m_config.external_perimeter_jerk > 0 && path_attr.role.is_external_perimeter()) { + jerk = m_config.external_perimeter_jerk.value; + } else if (m_config.perimeter_jerk.value > 0 && path_attr.role.is_perimeter()) { + jerk = m_config.perimeter_jerk.value; + } else { + jerk = m_config.default_jerk.value; + } + gcode += m_writer.set_jerk(jerk); + } + // calculate extrusion length per distance unit double e_per_mm = m_writer.extruder()->e_per_mm3() * path_attr.mm3_per_mm; if (m_writer.extrusion_axis().empty()) @@ -3606,6 +3639,8 @@ std::string GCodeGenerator::generate_travel_gcode( // generate G-code for the travel move // use G1 because we rely on paths being straight (G0 may make round paths) gcode += this->m_writer.set_travel_acceleration(acceleration); + if (m_config.default_jerk > 0 && m_config.travel_jerk > 0) + gcode += this->m_writer.set_jerk(m_config.travel_jerk); for (const Vec3crd& point : travel) { gcode += this->m_writer.travel_to_xyz(to_3d(this->point_to_gcode(point.head<2>()), unscaled(point.z())), comment); @@ -3618,6 +3653,8 @@ std::string GCodeGenerator::generate_travel_gcode( gcode += this->m_writer.set_travel_acceleration(acceleration); } + if (m_config.default_jerk > 0 && m_config.travel_jerk > 0) + gcode += this->m_writer.set_jerk(m_config.default_jerk); return gcode; } diff --git a/src/libslic3r/GCode/GCodeWriter.cpp b/src/libslic3r/GCode/GCodeWriter.cpp index 5231f97cd8c..4562baeb272 100644 --- a/src/libslic3r/GCode/GCodeWriter.cpp +++ b/src/libslic3r/GCode/GCodeWriter.cpp @@ -51,6 +51,11 @@ void GCodeWriter::apply_print_config(const PrintConfig &print_config) print_config.machine_max_acceleration_extruding.values.front() : 0)); m_max_travel_acceleration = static_cast(std::round((use_mach_limits && print_config.machine_limits_usage.value == MachineLimitsUsage::EmitToGCode && supports_separate_travel_acceleration(print_config.gcode_flavor.value)) ? print_config.machine_max_acceleration_travel.values.front() : 0)); + + m_max_jerk_x = static_cast(std::round((use_mach_limits && print_config.machine_limits_usage.value == MachineLimitsUsage::EmitToGCode) ? + print_config.machine_max_jerk_x.values.front() : 0)); + m_max_jerk_y = static_cast(std::round((use_mach_limits && print_config.machine_limits_usage.value == MachineLimitsUsage::EmitToGCode) ? + print_config.machine_max_jerk_y.values.front() : 0)); } void GCodeWriter::set_extruders(std::vector extruder_ids) @@ -212,6 +217,30 @@ std::string GCodeWriter::set_acceleration_internal(Acceleration type, unsigned i return gcode.str(); } +std::string GCodeWriter::set_jerk(unsigned int jerk) +{ + if (jerk == 0) + return {}; + + // Clamp the acceleration to the allowed maximum. + int jerk_x = jerk, jerk_y = jerk; + if (m_max_jerk_x > 0 && jerk > m_max_jerk_x) + jerk_x = m_max_jerk_x; + if (m_max_jerk_y > 0 && jerk > m_max_jerk_y) + jerk_y = m_max_jerk_y; + + std::ostringstream gcode; + if (FLAVOR_IS(gcfRepRapFirmware)) + gcode << "M566 X" << jerk_x << " Y" << jerk_y; + else + gcode << "M205 X" << jerk_x << " Y" << jerk_y; + + if (this->config.gcode_comments) gcode << " ; adjust jerk"; + gcode << "\n"; + + return gcode.str(); +} + std::string GCodeWriter::reset_e(bool force) { return diff --git a/src/libslic3r/GCode/GCodeWriter.hpp b/src/libslic3r/GCode/GCodeWriter.hpp index b51b6269c5a..032fb445345 100644 --- a/src/libslic3r/GCode/GCodeWriter.hpp +++ b/src/libslic3r/GCode/GCodeWriter.hpp @@ -54,6 +54,7 @@ class GCodeWriter { std::string set_bed_temperature(unsigned int temperature, bool wait = false); std::string set_print_acceleration(unsigned int acceleration) { return set_acceleration_internal(Acceleration::Print, acceleration); } std::string set_travel_acceleration(unsigned int acceleration) { return set_acceleration_internal(Acceleration::Travel, acceleration); } + std::string set_jerk(unsigned int jerk); std::string reset_e(bool force = false); std::string update_progress(unsigned int num, unsigned int tot, bool allow_100 = false) const; // return false if this extruder was already selected @@ -112,6 +113,9 @@ class GCodeWriter { unsigned int m_max_acceleration; unsigned int m_max_travel_acceleration; + unsigned int m_max_jerk_x; + unsigned int m_max_jerk_y; + unsigned int m_last_bed_temperature; bool m_last_bed_temperature_reached; Vec3d m_pos = Vec3d::Zero(); diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index cfa816d1f8a..3e19aa4f72f 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -452,6 +452,9 @@ static std::vector s_Preset_print_options { "bridge_speed", "gap_fill_speed", "gap_fill_enabled", "travel_speed", "travel_speed_z", "first_layer_speed", "first_layer_speed_over_raft", "perimeter_acceleration", "infill_acceleration", "external_perimeter_acceleration", "top_solid_infill_acceleration", "solid_infill_acceleration", "travel_acceleration", "bridge_acceleration", "first_layer_acceleration", "first_layer_acceleration_over_raft", "default_acceleration", "skirts", "skirt_distance", "skirt_height", "draft_shield", "draft_shield_loops", + "perimeter_jerk", "infill_jerk", + "external_perimeter_jerk", "top_solid_infill_jerk", "solid_infill_jerk", "travel_jerk", + "bridge_jerk", "first_layer_jerk", "first_layer_jerk_over_raft", "default_jerk", "min_skirt_length", "brim_width", "brim_separation", "brim_type", "support_material", "support_material_auto", "support_material_threshold", "support_material_enforce_layers", "raft_layers", "raft_first_layer_density", "raft_first_layer_expansion", "raft_contact_distance", "raft_expansion", "support_material_pattern", "support_material_with_sheath", "support_material_spacing", "support_material_closing_radius", "support_material_style", diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 9b5028c06f0..f1fcfbc2d84 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -88,6 +88,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "between_objects_gcode", "binary_gcode", "bridge_acceleration", + "bridge_jerk", "bridge_fan_speed", "enable_dynamic_fan_speeds", "overhang_fan_speed_0", @@ -99,12 +100,14 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "colorprint_heights", "cooling", "default_acceleration", + "default_jerk", "deretract_speed", "disable_fan_first_layers", "duplicate_distance", "end_gcode", "end_filament_gcode", "external_perimeter_acceleration", + "external_perimeter_jerk", "extrusion_axis", "extruder_clearance_height", "extruder_clearance_radius", @@ -122,11 +125,14 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "filament_spool_weight", "first_layer_acceleration", "first_layer_acceleration_over_raft", + "first_layer_jerk", + "first_layer_jerk_over_raft", "first_layer_bed_temperature", "first_layer_speed_over_raft", "gcode_comments", "gcode_label_objects", "infill_acceleration", + "infill_jerk", "layer_gcode", "min_fan_speed", "max_fan_speed", @@ -140,6 +146,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "only_retract_when_crossing_perimeters", "output_filename_format", "perimeter_acceleration", + "perimeter_jerk", "post_process", "gcode_substitutions", "printer_notes", @@ -162,12 +169,15 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n "single_extruder_multi_material_priming", "slowdown_below_layer_time", "solid_infill_acceleration", + "solid_infill_jerk", "standby_temperature_delta", "start_gcode", "start_filament_gcode", "toolchange_gcode", "top_solid_infill_acceleration", + "top_solid_infill_jerk", "travel_acceleration", + "travel_jerk", "thumbnails", "thumbnails_format", "use_firmware_retraction", diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 6e2dd47b7aa..453f43ef362 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -528,7 +528,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(0.)); def = this->add("bridge_acceleration", coFloat); - def->label = L("Bridge"); + def->label = L("Acceleration"); def->tooltip = L("This is the acceleration your printer will use for bridges. " "Set zero to disable acceleration control for bridges."); def->sidetext = L("mm/s²"); @@ -536,6 +536,15 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionFloat(0)); + def = this->add("bridge_jerk", coInt); + def->label = L("Jerk"); + def->tooltip = L("This is the jerk your printer will use for bridges. " + "Set zero to disable jerk control for bridges."); + def->sidetext = L("mm/s"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionInt(0)); + def = this->add("bridge_angle", coFloat); def->label = L("Bridging angle"); def->category = L("Infill"); @@ -867,7 +876,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(5.)); def = this->add("default_acceleration", coFloat); - def->label = L("Default"); + def->label = L("Acceleration"); def->tooltip = L("This is the acceleration your printer will be reset to after " "the role-specific acceleration values are used (perimeter/infill). " "Set zero to prevent resetting acceleration at all."); @@ -876,6 +885,16 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionFloat(0)); + def = this->add("default_jerk", coInt); + def->label = L("Jerk"); + def->tooltip = L("This is the jerk your printer will be reset to after " + "the role-specific jerk values are used (perimeter/infill). " + "Set zero to prevent resetting jerk at all."); + def->sidetext = L("mm/s"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionInt(0)); + def = this->add("default_filament_profile", coStrings); def->label = L("Default filament profile"); def->tooltip = L("Default filament profile associated with the current printer profile. " @@ -1469,7 +1488,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionEnum(ipStars)); def = this->add("first_layer_acceleration", coFloat); - def->label = L("First layer"); + def->label = L("Acceleration"); def->tooltip = L("This is the acceleration your printer will use for first layer. Set zero " "to disable acceleration control for first layer."); def->sidetext = L("mm/s²"); @@ -1478,7 +1497,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(0)); def = this->add("first_layer_acceleration_over_raft", coFloat); - def->label = L("First object layer over raft interface"); + def->label = L("Acceleration"); def->tooltip = L("This is the acceleration your printer will use for first layer of object above raft interface. Set zero " "to disable acceleration control for first layer of object above raft interface."); def->sidetext = L("mm/s²"); @@ -1486,6 +1505,24 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionFloat(0)); + def = this->add("first_layer_jerk", coInt); + def->label = L("Jerk"); + def->tooltip = L("This is the jerk your printer will use for first layer. Set zero " + "to disable jerk control for first layer."); + def->sidetext = L("mm/s"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionInt(0)); + + def = this->add("first_layer_jerk_over_raft", coInt); + def->label = L("Jerk"); + def->tooltip = L("This is the jerk your printer will use for first layer of object above raft interface. Set zero " + "to disable jerk control for first layer of object above raft interface."); + def->sidetext = L("mm/s"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionInt(0)); + def = this->add("first_layer_bed_temperature", coInts); def->label = L("First layer"); def->full_label = L("First layer bed temperature"); @@ -1672,7 +1709,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionBool(0)); def = this->add("infill_acceleration", coFloat); - def->label = L("Infill"); + def->label = L("Acceleration"); def->tooltip = L("This is the acceleration your printer will use for infill. Set zero to disable " "acceleration control for infill."); def->sidetext = L("mm/s²"); @@ -1681,7 +1718,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(0)); def = this->add("solid_infill_acceleration", coFloat); - def->label = L("Solid infill"); + def->label = L("Acceleration"); def->tooltip = L("This is the acceleration your printer will use for solid infill. Set zero to use " "the value for infill."); def->sidetext = L("mm/s²"); @@ -1690,7 +1727,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(0)); def = this->add("top_solid_infill_acceleration", coFloat); - def->label = L("Top solid infill"); + def->label = L("Acceleration"); def->tooltip = L("This is the acceleration your printer will use for top solid infill. Set zero to use " "the value for solid infill."); def->sidetext = L("mm/s²"); @@ -1699,7 +1736,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(0)); def = this->add("travel_acceleration", coFloat); - def->label = L("Travel"); + def->label = L("Acceleration"); def->tooltip = L("This is the acceleration your printer will use for travel moves. Set zero to disable " "acceleration control for travel."); def->sidetext = L("mm/s²"); @@ -1707,6 +1744,42 @@ void PrintConfigDef::init_fff_params() def->mode = comExpert; def->set_default_value(new ConfigOptionFloat(0)); + def = this->add("infill_jerk", coInt); + def->label = L("Jerk"); + def->tooltip = L("This is the jerk your printer will use for infill. Set zero to disable " + "jerk control for infill."); + def->sidetext = L("mm/s"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionInt(0)); + + def = this->add("solid_infill_jerk", coInt); + def->label = L("Jerk"); + def->tooltip = L("This is the jerk your printer will use for solid infill. Set zero to use " + "the value for infill."); + def->sidetext = L("mm/s"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionInt(0)); + + def = this->add("top_solid_infill_jerk", coInt); + def->label = L("Jerk"); + def->tooltip = L("This is the jerk your printer will use for top solid infill. Set zero to use " + "the value for solid infill."); + def->sidetext = L("mm/s"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionInt(0)); + + def = this->add("travel_jerk", coInt); + def->label = L("Jerk"); + def->tooltip = L("This is the jerk your printer will use for travel moves. Set zero to disable " + "jerk control for travel."); + def->sidetext = L("mm/s"); + def->min = 0; + def->mode = comExpert; + def->set_default_value(new ConfigOptionInt(0)); + def = this->add("infill_every_layers", coInt); def->label = L("Combine infill every"); def->category = L("Infill"); @@ -2272,7 +2345,7 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(-2.)); def = this->add("perimeter_acceleration", coFloat); - def->label = L("Perimeters"); + def->label = L("Acceleration"); def->tooltip = L("This is the acceleration your printer will use for perimeters. " "Set zero to disable acceleration control for perimeters."); def->sidetext = L("mm/s²"); @@ -2280,13 +2353,29 @@ void PrintConfigDef::init_fff_params() def->set_default_value(new ConfigOptionFloat(0)); def = this->add("external_perimeter_acceleration", coFloat); - def->label = L("External perimeters"); + def->label = L("Acceleration"); def->tooltip = L("This is the acceleration your printer will use for external perimeters. " "Set zero to use the value for perimeters."); def->sidetext = L("mm/s²"); def->mode = comExpert; def->set_default_value(new ConfigOptionFloat(0)); + def = this->add("perimeter_jerk", coInt); + def->label = L("Jerk"); + def->tooltip = L("This is the jerk your printer will use for perimeters. " + "Set zero to disable jerk control for perimeters."); + def->sidetext = L("mm/s"); + def->mode = comExpert; + def->set_default_value(new ConfigOptionInt(0)); + + def = this->add("external_perimeter_jerk", coInt); + def->label = L("Jerk"); + def->tooltip = L("This is the acceleration your printer will use for external perimeters. " + "Set zero to use the value for perimeters."); + def->sidetext = L("mm/s"); + def->mode = comExpert; + def->set_default_value(new ConfigOptionInt(0)); + def = this->add("perimeter_extruder", coInt); def->label = L("Perimeter extruder"); def->category = L("Extruders"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 745e32088f0..be23f4f6f4a 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -531,6 +531,7 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionFloat, elefant_foot_compensation)) ((ConfigOptionFloatOrPercent, extrusion_width)) ((ConfigOptionFloat, first_layer_acceleration_over_raft)) + ((ConfigOptionInt, first_layer_jerk_over_raft)) ((ConfigOptionFloatOrPercent, first_layer_speed_over_raft)) // ((ConfigOptionBool, infill_only_where_needed)) // Force the generation of solid shells between adjacent materials/volumes. @@ -824,6 +825,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionPoints, bed_shape)) ((ConfigOptionInts, bed_temperature)) ((ConfigOptionFloat, bridge_acceleration)) + ((ConfigOptionInt, bridge_jerk)) ((ConfigOptionInts, bridge_fan_speed)) ((ConfigOptionBools, bridge_fan_internal_perimeter)) ((ConfigOptionBools, bridge_fan_external_perimeter)) @@ -837,11 +839,13 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionFloats, colorprint_heights)) ((ConfigOptionBools, cooling)) ((ConfigOptionFloat, default_acceleration)) + ((ConfigOptionInt, default_jerk)) ((ConfigOptionInts, disable_fan_first_layers)) ((ConfigOptionEnum, draft_shield)) ((ConfigOptionInt, draft_shield_loops)) ((ConfigOptionFloat, duplicate_distance)) ((ConfigOptionFloat, external_perimeter_acceleration)) + ((ConfigOptionInt, external_perimeter_jerk)) ((ConfigOptionFloat, extruder_clearance_height)) ((ConfigOptionFloat, extruder_clearance_radius)) ((ConfigOptionStrings, extruder_colour)) @@ -852,6 +856,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionStrings, filament_notes)) ((ConfigOptionPercents, filament_shrink)) ((ConfigOptionFloat, first_layer_acceleration)) + ((ConfigOptionInt, first_layer_jerk)) ((ConfigOptionInts, first_layer_bed_temperature)) ((ConfigOptionFloatOrPercent, first_layer_extrusion_width)) ((ConfigOptionFloat, first_layer_flow_ratio)) @@ -861,6 +866,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionIntsNullable, idle_temperature)) ((ConfigOptionInts, full_fan_speed_layer)) ((ConfigOptionFloat, infill_acceleration)) + ((ConfigOptionInt, infill_jerk)) ((ConfigOptionBool, infill_first)) ((ConfigOptionInts, max_fan_speed)) ((ConfigOptionFloats, max_layer_height)) @@ -875,6 +881,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionBool, ooze_prevention)) ((ConfigOptionString, output_filename_format)) ((ConfigOptionFloat, perimeter_acceleration)) + ((ConfigOptionInt, perimeter_jerk)) ((ConfigOptionStrings, post_process)) ((ConfigOptionString, printer_model)) ((ConfigOptionString, printer_notes)) @@ -887,6 +894,7 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionInt, skirts)) ((ConfigOptionInts, slowdown_below_layer_time)) ((ConfigOptionFloat, solid_infill_acceleration)) + ((ConfigOptionInt, solid_infill_jerk)) ((ConfigOptionBool, spiral_vase)) ((ConfigOptionInt, standby_temperature_delta)) ((ConfigOptionInts, temperature)) @@ -895,7 +903,9 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE( ((ConfigOptionEnum, thumbnails_format)) ((ConfigOptionFloat, top_layer_flow_ratio)) ((ConfigOptionFloat, top_solid_infill_acceleration)) + ((ConfigOptionInt, top_solid_infill_jerk)) ((ConfigOptionFloat, travel_acceleration)) + ((ConfigOptionInt, travel_jerk)) ((ConfigOptionBools, wipe)) ((ConfigOptionBool, wipe_tower)) ((ConfigOptionFloat, wipe_tower_x)) diff --git a/src/slic3r/GUI/ConfigManipulation.cpp b/src/slic3r/GUI/ConfigManipulation.cpp index 2398555fd24..63a0bc4e336 100644 --- a/src/slic3r/GUI/ConfigManipulation.cpp +++ b/src/slic3r/GUI/ConfigManipulation.cpp @@ -288,6 +288,12 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config) "bridge_acceleration", "first_layer_acceleration" }) toggle_field(el, have_default_acceleration); + bool have_default_jerk = config->opt_int("default_jerk") > 0; + for (auto el : { "perimeter_jerk", "infill_jerk", "top_solid_infill_jerk", + "solid_infill_jerk", "external_perimeter_jerk", "external_perimeter_jerk", + "bridge_jerk", "first_layer_jerk", "travel_jerk" }) + toggle_field(el, have_default_jerk); + bool have_skirt = config->opt_int("skirts") > 0; for (auto el : {"skirt_distance", "draft_shield", "draft_shield_loops", "min_skirt_length"}) toggle_field(el, have_skirt); @@ -334,7 +340,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig* config) toggle_field("support_material_speed", have_support_material || have_brim || have_skirt); toggle_field("raft_contact_distance", have_raft && !have_support_soluble); - for (auto el : { "raft_expansion", "first_layer_acceleration_over_raft", "first_layer_speed_over_raft" }) + for (auto el : { "raft_expansion", "first_layer_acceleration_over_raft", "first_layer_jerk_over_raft", "first_layer_speed_over_raft" }) toggle_field(el, have_raft); bool has_ironing = config->opt_bool("ironing"); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index a59908cfaad..1768baef038 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1630,17 +1630,56 @@ void TabPrint::build() optgroup->append_single_option_line("first_layer_speed"); optgroup->append_single_option_line("first_layer_speed_over_raft"); - optgroup = page->new_optgroup(L("Acceleration control (advanced)")); - optgroup->append_single_option_line("external_perimeter_acceleration"); - optgroup->append_single_option_line("perimeter_acceleration"); - optgroup->append_single_option_line("top_solid_infill_acceleration"); - optgroup->append_single_option_line("solid_infill_acceleration"); - optgroup->append_single_option_line("infill_acceleration"); - optgroup->append_single_option_line("bridge_acceleration"); - optgroup->append_single_option_line("first_layer_acceleration"); - optgroup->append_single_option_line("first_layer_acceleration_over_raft"); - optgroup->append_single_option_line("travel_acceleration"); - optgroup->append_single_option_line("default_acceleration"); + optgroup = page->new_optgroup(L("Acceleration/jerk control (advanced)")); + line = { L("External perimeters"), "" }; + line.append_option(optgroup->get_option("external_perimeter_acceleration")); + line.append_option(optgroup->get_option("external_perimeter_jerk")); + optgroup->append_line(line); + + line = { L("Perimeters"), "" }; + line.append_option(optgroup->get_option("perimeter_acceleration")); + line.append_option(optgroup->get_option("perimeter_jerk")); + optgroup->append_line(line); + + line = { L("Top solid infill"), "" }; + line.append_option(optgroup->get_option("top_solid_infill_acceleration")); + line.append_option(optgroup->get_option("top_solid_infill_jerk")); + optgroup->append_line(line); + + line = { L("Solid infill"), "" }; + line.append_option(optgroup->get_option("solid_infill_acceleration")); + line.append_option(optgroup->get_option("solid_infill_jerk")); + optgroup->append_line(line); + + line = { L("Infill"), "" }; + line.append_option(optgroup->get_option("infill_acceleration")); + line.append_option(optgroup->get_option("infill_jerk")); + optgroup->append_line(line); + + line = { L("Bridge"), "" }; + line.append_option(optgroup->get_option("bridge_acceleration")); + line.append_option(optgroup->get_option("bridge_jerk")); + optgroup->append_line(line); + + line = { L("First layer"), "" }; + line.append_option(optgroup->get_option("first_layer_acceleration")); + line.append_option(optgroup->get_option("first_layer_jerk")); + optgroup->append_line(line); + + line = { L("First object layer over raft interface"), "" }; + line.append_option(optgroup->get_option("first_layer_acceleration_over_raft")); + line.append_option(optgroup->get_option("first_layer_jerk_over_raft")); + optgroup->append_line(line); + + line = { L("Travel"), "" }; + line.append_option(optgroup->get_option("travel_acceleration")); + line.append_option(optgroup->get_option("travel_jerk")); + optgroup->append_line(line); + + line = { L("Default"), "" }; + line.append_option(optgroup->get_option("default_acceleration")); + line.append_option(optgroup->get_option("default_jerk")); + optgroup->append_line(line); optgroup = page->new_optgroup(L("Autospeed (advanced)")); optgroup->append_single_option_line("max_print_speed", "max-volumetric-speed_127176");