Merge branch 'main' into dev/arachen-sync

This commit is contained in:
SoftFever 2025-01-05 23:47:38 +08:00 committed by GitHub
commit 4c1a42e2e8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
38 changed files with 3271 additions and 1699 deletions

View file

@ -62,6 +62,7 @@ PressureEqualizer::PressureEqualizer(const Slic3r::GCodeConfig &config) : m_use_
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);
m_extrusion_rate_smoothing_external_perimeter_only = bool(config.extrusion_rate_smoothing_external_perimeter_only.value);
}
for (ExtrusionRateSlope &extrusion_rate_slope : m_max_volumetric_extrusion_rate_slopes) {
@ -482,11 +483,25 @@ void PressureEqualizer::output_gcode_line(const size_t line_idx)
if (*comment != ';')
comment = nullptr;
// Emit the line with lowered extrusion rates.
// get the gcode line length
float l = line.dist_xyz();
if (auto nSegments = size_t(ceil(l / m_max_segment_length)); nSegments == 1) { // Just update this segment.
// number of segments this line can be broken down to
auto nSegments = size_t(ceil(l / m_max_segment_length));
// Orca:
// Calculate the absolute difference in volumetric extrusion rate between the start and end point of the line.
// Quantize it to 1mm3/min (0.016mm3/sec).
int delta_volumetric_rate = std::round(fabs(line.volumetric_extrusion_rate_end - line.volumetric_extrusion_rate_start));
// Emit the line with lowered extrusion rates.
// Orca:
// First, check if the change in volumetric extrusion rate is trivial (less than 10mm3/min -> 0.16mm3/sec (5mm/sec speed for a 0.25 mm nozzle).
// Or if the line size is equal in length with the smallest segment.
// If so, then emit the line as a single extrusion, i.e. dont split into segments.
if ( nSegments == 1 || delta_volumetric_rate < 10) {
push_line_to_output(line_idx, line.feedrate() * line.volumetric_correction_avg(), comment);
} else {
} else // The line needs to be split the line into segments and apply extrusion rate smoothing
{
bool accelerating = line.volumetric_extrusion_rate_start < line.volumetric_extrusion_rate_end;
// Update the initial and final feed rate values.
line.pos_start[4] = line.volumetric_extrusion_rate_start * line.pos_end[4] / line.volumetric_extrusion_rate;
@ -615,7 +630,9 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t fist_line_idx, const
rate_end = rate_succ;
// don't alter the flow rate for these extrusion types
if (!line.adjustable_flow || line.extrusion_role == ExtrusionRole::erBridgeInfill || line.extrusion_role == ExtrusionRole::erIroning) {
// Orca: Limit ERS to external perimeters and overhangs if option selected by user
if (!line.adjustable_flow || line.extrusion_role == ExtrusionRole::erBridgeInfill || line.extrusion_role == ExtrusionRole::erIroning ||
(m_extrusion_rate_smoothing_external_perimeter_only && line.extrusion_role != ExtrusionRole::erOverhangPerimeter && line.extrusion_role != ExtrusionRole::erExternalPerimeter)) {
rate_end = line.volumetric_extrusion_rate_end;
} else if (line.volumetric_extrusion_rate_end > rate_end) {
line.volumetric_extrusion_rate_end = rate_end;
@ -670,10 +687,13 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t fist_line_idx, const
float rate_start = feedrate_per_extrusion_role[iRole];
// don't alter the flow rate for these extrusion types
if (!line.adjustable_flow || line.extrusion_role == ExtrusionRole::erBridgeInfill || line.extrusion_role == ExtrusionRole::erIroning) {
// Orca: Limit ERS to external perimeters and overhangs if option selected by user
if (!line.adjustable_flow || line.extrusion_role == ExtrusionRole::erBridgeInfill || line.extrusion_role == ExtrusionRole::erIroning ||
(m_extrusion_rate_smoothing_external_perimeter_only && line.extrusion_role != ExtrusionRole::erOverhangPerimeter && line.extrusion_role != ExtrusionRole::erExternalPerimeter)) {
rate_start = line.volumetric_extrusion_rate_start;
} else if (iRole == size_t(line.extrusion_role) && rate_prec < rate_start)
rate_start = rate_prec;
if (line.volumetric_extrusion_rate_start > rate_start) {
line.volumetric_extrusion_rate_start = rate_start;
line.max_volumetric_extrusion_rate_slope_positive = rate_slope;
@ -769,7 +789,8 @@ void PressureEqualizer::push_line_to_output(const size_t line_idx, float new_fee
// Orca: sanity check, 1 mm/s is the minimum feedrate.
if (new_feedrate < 60)
new_feedrate = 60;
new_feedrate = std::round(new_feedrate);
// Quantize speed changes to a minimum of 1mm/sec, to reduce gcode volume for trivial speed changes.
new_feedrate = std::round(new_feedrate / 60.0) * 60.0;
const GCodeLine &line = m_gcode_lines[line_idx];
if (line_idx > 0 && output_buffer_length > 0) {
const std::string prev_line_str = std::string(output_buffer.begin() + int(this->output_buffer_prev_length),

View file

@ -83,6 +83,9 @@ private:
// 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;
// Apply ERS only on external perimeters and overhangs
bool m_extrusion_rate_smoothing_external_perimeter_only;
// 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").

View file

@ -770,7 +770,7 @@ static std::vector<std::string> s_Preset_print_options {
"ironing_type", "ironing_pattern", "ironing_flow", "ironing_speed", "ironing_spacing", "ironing_angle",
"max_travel_detour_distance",
"fuzzy_skin", "fuzzy_skin_thickness", "fuzzy_skin_point_distance", "fuzzy_skin_first_layer",
"max_volumetric_extrusion_rate_slope", "max_volumetric_extrusion_rate_slope_segment_length",
"max_volumetric_extrusion_rate_slope", "max_volumetric_extrusion_rate_slope_segment_length","extrusion_rate_smoothing_external_perimeter_only",
"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",

View file

@ -144,6 +144,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
"slow_down_min_speed",
"max_volumetric_extrusion_rate_slope",
"max_volumetric_extrusion_rate_slope_segment_length",
"extrusion_rate_smoothing_external_perimeter_only",
"reduce_infill_retraction",
"filename_format",
"retraction_minimum_travel",

View file

@ -722,7 +722,7 @@ void PrintConfigDef::init_fff_params()
def->label = L("Initial layer");
def->full_label = L("Initial layer bed temperature");
def->tooltip = L("Bed temperature of the initial layer. "
"Value 0 means the filament does not support to print on the Bambu Cool Plate SuperTack");
"Value 0 means the filament does not support to print on the Cool Plate SuperTack");
def->sidetext = "°C";
def->min = 0;
def->max = 120;
@ -789,8 +789,8 @@ void PrintConfigDef::init_fff_params()
def->enum_values.emplace_back("High Temp Plate");
def->enum_values.emplace_back("Textured PEI Plate");
def->enum_values.emplace_back("Textured Cool Plate");
def->enum_labels.emplace_back(L("Bambu Cool Plate SuperTack"));
def->enum_labels.emplace_back(L("Smooth Cool Plate / PLA Plate"));
def->enum_labels.emplace_back(L("Cool Plate (SuperTack)"));
def->enum_labels.emplace_back(L("Smooth Cool Plate"));
def->enum_labels.emplace_back(L("Engineering Plate"));
def->enum_labels.emplace_back(L("Smooth High Temp Plate"));
def->enum_labels.emplace_back(L("Textured PEI Plate"));
@ -3345,16 +3345,25 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(0));
def = this->add("max_volumetric_extrusion_rate_slope_segment_length", coInt);
def = this->add("max_volumetric_extrusion_rate_slope_segment_length", coFloat);
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 3 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;
"Allowed values: 0.5-5");
def->min = 0.5;
def->max = 5;
def->sidetext = L("mm");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionInt(3));
def->set_default_value(new ConfigOptionFloat(3.0));
def = this->add("extrusion_rate_smoothing_external_perimeter_only", coBool);
def->label = L("Apply only on external features");
def->tooltip = L("Applies extrusion rate smoothing only on external perimeters and overhangs. This can help reduce artefacts due to sharp speed transitions on externally visible "
"overhangs without impacting the print speed of features that will not be visible to the user.");
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionBool(false));
def = this->add("fan_min_speed", coFloats);
def->label = L("Fan speed");

View file

@ -1091,7 +1091,9 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionString, time_lapse_gcode))
((ConfigOptionFloat, max_volumetric_extrusion_rate_slope))
((ConfigOptionInt, max_volumetric_extrusion_rate_slope_segment_length))
((ConfigOptionFloat, max_volumetric_extrusion_rate_slope_segment_length))
((ConfigOptionBool, extrusion_rate_smoothing_external_perimeter_only))
((ConfigOptionPercents, retract_before_wipe))
((ConfigOptionFloats, retraction_length))

View file

@ -5,6 +5,9 @@
#define SLIC3R_APP_KEY "@SLIC3R_APP_KEY@"
#define SLIC3R_VERSION "@SLIC3R_VERSION@"
#define SoftFever_VERSION "@SoftFever_VERSION@"
#ifndef GIT_COMMIT_HASH
#define GIT_COMMIT_HASH "0000000" // 0000000 means uninitialized
#endif
#define SLIC3R_BUILD_ID "@SLIC3R_BUILD_ID@"
#define SLIC3R_BUILD_TIME "@SLIC3R_BUILD_TIME@"
//#define SLIC3R_RC_VERSION "@SLIC3R_VERSION@"