mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-05 16:51:07 -07:00
Introduced parameter smoothing segment length
This parameter influences the number of division a line will undergo in response to the requirement to adhere to the extrusion rate flow adjustment.
This commit is contained in:
parent
4726809a18
commit
f0a03d7921
9 changed files with 32 additions and 39 deletions
|
|
@ -12,37 +12,6 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
|
||||
/* IG For reference only. Defined in Extrusion Entity hpp. Do not uncomment:
|
||||
|
||||
// Each ExtrusionRole value identifies a distinct set of { extruder, speed }
|
||||
enum ExtrusionRole : uint8_t {
|
||||
erNone,
|
||||
erPerimeter,
|
||||
erExternalPerimeter,
|
||||
erOverhangPerimeter,
|
||||
erInternalInfill,
|
||||
erSolidInfill,
|
||||
erTopSolidInfill,
|
||||
erBottomSurface,
|
||||
erIroning,
|
||||
erBridgeInfill,
|
||||
erInternalBridgeInfill,
|
||||
erGapFill,
|
||||
erSkirt,
|
||||
erBrim,
|
||||
erSupportMaterial,
|
||||
erSupportMaterialInterface,
|
||||
erSupportTransition,
|
||||
erWipeTower,
|
||||
erCustom,
|
||||
// Extrusion role for a collection with multiple extrusion roles.
|
||||
erMixed,
|
||||
erCount
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
// Convert a rich bitmask based ExtrusionRole to a less expressive ordinal GCodeExtrusionRole.
|
||||
// GCodeExtrusionRole is to be serialized into G-code and deserialized by G-code viewer,
|
||||
GCodeExtrusionRole extrusion_role_to_gcode_extrusion_role(ExtrusionRole role)
|
||||
|
|
|
|||
|
|
@ -24,10 +24,6 @@ static const std::string EXTRUDE_END_TAG = ";_EXTRUDE_END";
|
|||
static const std::string EXTRUDE_SET_SPEED_TAG = ";_EXTRUDE_SET_SPEED";
|
||||
static const std::string EXTERNAL_PERIMETER_TAG = ";_EXTERNAL_PERIMETER";
|
||||
|
||||
// Maximum segment length to split a long segment if the initial and the final flow rate differ.
|
||||
// Smaller value means a smoother transition between two different flow rates.
|
||||
static constexpr float max_segment_length = 1.0f;
|
||||
|
||||
// For how many GCode lines back will adjust a flow rate from the latest line.
|
||||
// Bigger values affect the GCode export speed a lot, and smaller values could
|
||||
// affect how distant will be propagated a flow rate adjustment.
|
||||
|
|
@ -52,6 +48,8 @@ PressureEqualizer::PressureEqualizer(const Slic3r::GCodeConfig &config) : m_use_
|
|||
m_current_extrusion_role = GCodeExtrusionRole::None;
|
||||
// Expect the first command to fill the nozzle (deretract).
|
||||
m_retracted = true;
|
||||
|
||||
m_max_segment_length = 2.f;
|
||||
|
||||
// Calculate filamet crossections for the multiple extruders.
|
||||
m_filament_crossections.clear();
|
||||
|
|
@ -67,6 +65,7 @@ PressureEqualizer::PressureEqualizer(const Slic3r::GCodeConfig &config) : m_use_
|
|||
if(config.max_volumetric_extrusion_rate_slope.value > 0){
|
||||
m_max_volumetric_extrusion_rate_slope_positive = float(config.max_volumetric_extrusion_rate_slope.value) * 60.f * 60.f;
|
||||
m_max_volumetric_extrusion_rate_slope_negative = float(config.max_volumetric_extrusion_rate_slope.value) * 60.f * 60.f;
|
||||
m_max_segment_length = float(config.max_volumetric_extrusion_rate_slope_segment_length.value);
|
||||
}
|
||||
|
||||
for (ExtrusionRateSlope &extrusion_rate_slope : m_max_volumetric_extrusion_rate_slopes) {
|
||||
|
|
@ -489,7 +488,7 @@ void PressureEqualizer::output_gcode_line(const size_t line_idx)
|
|||
|
||||
// Emit the line with lowered extrusion rates.
|
||||
float l = line.dist_xyz();
|
||||
if (auto nSegments = size_t(ceil(l / max_segment_length)); nSegments == 1) { // Just update this segment.
|
||||
if (auto nSegments = size_t(ceil(l / m_max_segment_length)); nSegments == 1) { // Just update this segment.
|
||||
push_line_to_output(line_idx, line.feedrate() * line.volumetric_correction_avg(), comment);
|
||||
} else {
|
||||
bool accelerating = line.volumetric_extrusion_rate_start < line.volumetric_extrusion_rate_end;
|
||||
|
|
@ -512,11 +511,11 @@ void PressureEqualizer::output_gcode_line(const size_t line_idx)
|
|||
// One may achieve higher print speeds if part of the segment is not speed limited.
|
||||
l_acc = t_acc * feed_avg;
|
||||
l_steady = l - l_acc;
|
||||
if (l_steady < 0.5f * max_segment_length) {
|
||||
if (l_steady < 0.5f * m_max_segment_length) {
|
||||
l_acc = l;
|
||||
l_steady = 0.f;
|
||||
} else
|
||||
nSegments = size_t(ceil(l_acc / max_segment_length));
|
||||
nSegments = size_t(ceil(l_acc / m_max_segment_length));
|
||||
}
|
||||
float pos_start[5];
|
||||
float pos_end[5];
|
||||
|
|
|
|||
|
|
@ -86,6 +86,10 @@ private:
|
|||
bool m_retracted;
|
||||
bool m_use_relative_e_distances;
|
||||
|
||||
// Maximum segment length to split a long segment if the initial and the final flow rate differ.
|
||||
// Smaller value means a smoother transition between two different flow rates.
|
||||
float m_max_segment_length;
|
||||
|
||||
// Indicate if extrude set speed block was opened using the tag ";_EXTRUDE_SET_SPEED"
|
||||
// or not (not opened, or it was closed using the tag ";_EXTRUDE_END").
|
||||
bool opened_extrude_set_speed_block = false;
|
||||
|
|
|
|||
|
|
@ -725,7 +725,7 @@ static std::vector<std::string> s_Preset_print_options {
|
|||
"ironing_type", "ironing_pattern", "ironing_flow", "ironing_speed", "ironing_spacing",
|
||||
"max_travel_detour_distance",
|
||||
"fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance",
|
||||
"max_volumetric_extrusion_rate_slope",
|
||||
"max_volumetric_extrusion_rate_slope", "max_volumetric_extrusion_rate_slope_segment_length",
|
||||
"inner_wall_speed", "outer_wall_speed", "sparse_infill_speed", "internal_solid_infill_speed",
|
||||
"top_surface_speed", "support_speed", "support_object_xy_distance", "support_interface_speed",
|
||||
"bridge_speed", "internal_bridge_speed", "gap_infill_speed", "travel_speed", "travel_speed_z", "initial_layer_speed",
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
|
|||
"printable_height",
|
||||
"slow_down_min_speed",
|
||||
"max_volumetric_extrusion_rate_slope",
|
||||
"max_volumetric_extrusion_rate_slope_segment_length",
|
||||
"reduce_infill_retraction",
|
||||
"filename_format",
|
||||
"retraction_minimum_travel",
|
||||
|
|
|
|||
|
|
@ -2490,6 +2490,17 @@ def = this->add("filament_loading_speed", coFloats);
|
|||
def->min = 0;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionFloat(0));
|
||||
|
||||
def = this->add("max_volumetric_extrusion_rate_slope_segment_length", coInt);
|
||||
def->label = L("Smoothing segment length");
|
||||
def->tooltip = L("A lower value results in smoother extrusion rate transitions. However, this results in a significantly larger gcode file "
|
||||
"and more instructions for the printer to process. \n\n"
|
||||
"Default value of 2 works well for most cases. If your printer is stuttering, increase this value to reduce the number of adjustments made\n\n"
|
||||
"Allowed values: 1-5");
|
||||
def->min = 1;
|
||||
def->max = 5;
|
||||
def->mode = comAdvanced;
|
||||
def->set_default_value(new ConfigOptionInt(2));
|
||||
|
||||
def = this->add("fan_min_speed", coInts);
|
||||
def->label = L("Fan speed");
|
||||
|
|
|
|||
|
|
@ -883,6 +883,7 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
((ConfigOptionString, layer_change_gcode))
|
||||
|
||||
((ConfigOptionFloat, max_volumetric_extrusion_rate_slope))
|
||||
((ConfigOptionInt, max_volumetric_extrusion_rate_slope_segment_length))
|
||||
|
||||
((ConfigOptionPercents, retract_before_wipe))
|
||||
((ConfigOptionFloats, retraction_length))
|
||||
|
|
|
|||
|
|
@ -510,8 +510,15 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, co
|
|||
auto gcflavor = preset_bundle->printers.get_edited_preset().config.option<ConfigOptionEnum<GCodeFlavor>>("gcode_flavor")->value;
|
||||
|
||||
bool have_volumetric_extrusion_rate_slope = config->option<ConfigOptionFloat>("max_volumetric_extrusion_rate_slope")->value > 0;
|
||||
int have_volumetric_extrusion_rate_slope_segment_length = config->option<ConfigOptionInt>("max_volumetric_extrusion_rate_slope_segment_length")->value;
|
||||
toggle_field("enable_arc_fitting", !have_volumetric_extrusion_rate_slope);
|
||||
toggle_line("max_volumetric_extrusion_rate_slope_segment_length", have_volumetric_extrusion_rate_slope);
|
||||
if(have_volumetric_extrusion_rate_slope) config->set_key_value("enable_arc_fitting", new ConfigOptionBool(false));
|
||||
if(have_volumetric_extrusion_rate_slope_segment_length==0) {
|
||||
DynamicPrintConfig new_conf = *config;
|
||||
new_conf.set_key_value("max_volumetric_extrusion_rate_slope_segment_length", new ConfigOptionInt(1));
|
||||
apply(config, &new_conf);
|
||||
}
|
||||
|
||||
bool have_perimeters = config->opt_int("wall_loops") > 0;
|
||||
for (auto el : { "extra_perimeters_on_overhangs", "ensure_vertical_shell_thickness", "detect_thin_wall", "detect_overhang_wall",
|
||||
|
|
|
|||
|
|
@ -1998,6 +1998,7 @@ void TabPrint::build()
|
|||
|
||||
optgroup = page->new_optgroup(L("Advanced"), L"param_advanced", 15);
|
||||
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope");
|
||||
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_segment_length");
|
||||
|
||||
page = add_options_page(L("Support"), "support");
|
||||
optgroup = page->new_optgroup(L("Support"), L"param_support");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue