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@"

View file

@ -241,11 +241,18 @@ AboutDialog::AboutDialog()
// version
{
auto _build_string_font = Label::Body_10;
// _build_string_font.SetStyle(wxFONTSTYLE_ITALIC);
vesizer->Add(0, FromDIP(165), 1, wxEXPAND, FromDIP(5));
auto version_string = _L("Orca Slicer ") + " " + std::string(SoftFever_VERSION);
auto version_string = _L("Orca Slicer") + " " + std::string(SoftFever_VERSION);
wxStaticText* version = new wxStaticText(this, wxID_ANY, version_string.c_str(), wxDefaultPosition, wxDefaultSize);
wxStaticText* bs_version = new wxStaticText(this, wxID_ANY, wxString::Format("Based on PrusaSlicer and BambuStudio"), wxDefaultPosition, wxDefaultSize);
bs_version->SetFont(Label::Body_12);
wxStaticText* credits_string = new wxStaticText(this, wxID_ANY,
wxString::Format("Build %s.\nOrcaSlicer is based on PrusaSlicer and BambuStudio",
std::string(GIT_COMMIT_HASH)),
wxDefaultPosition, wxDefaultSize);
credits_string->SetFont(_build_string_font);
wxFont version_font = GetFont();
#ifdef __WXMSW__
version_font.SetPointSize(version_font.GetPointSize()-1);
@ -255,13 +262,12 @@ AboutDialog::AboutDialog()
version_font.SetPointSize(FromDIP(16));
version->SetFont(version_font);
version->SetForegroundColour(wxColour("#FFFFFD"));
bs_version->SetForegroundColour(wxColour("#FFFFFD"));
credits_string->SetForegroundColour(wxColour("#FFFFFD"));
version->SetBackgroundColour(wxColour("#4d4d4d"));
bs_version->SetBackgroundColour(wxColour("#4d4d4d"));
credits_string->SetBackgroundColour(wxColour("#4d4d4d"));
vesizer->Add(version, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, FromDIP(5));
vesizer->Add(bs_version, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, FromDIP(5));
vesizer->Add(credits_string, 0, wxALL | wxALIGN_CENTER_HORIZONTAL, FromDIP(5));
// #if BBL_INTERNAL_TESTING
// wxString build_time = wxString::Format("Build Time: %s", std::string(SLIC3R_BUILD_TIME));
// wxStaticText* build_time_text = new wxStaticText(this, wxID_ANY, build_time, wxDefaultPosition, wxDefaultSize);

View file

@ -494,13 +494,14 @@ 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;
float have_volumetric_extrusion_rate_slope_segment_length = config->option<ConfigOptionFloat>("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);
toggle_line("extrusion_rate_smoothing_external_perimeter_only", 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) {
if(have_volumetric_extrusion_rate_slope_segment_length < 0.5) {
DynamicPrintConfig new_conf = *config;
new_conf.set_key_value("max_volumetric_extrusion_rate_slope_segment_length", new ConfigOptionInt(1));
new_conf.set_key_value("max_volumetric_extrusion_rate_slope_segment_length", new ConfigOptionFloat(1));
apply(config, &new_conf);
}

View file

@ -2215,6 +2215,7 @@ void TabPrint::build()
optgroup = page->new_optgroup(L("Advanced"), L"param_advanced", 15);
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope", "extrusion-rate-smoothing");
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_segment_length", "extrusion-rate-smoothing");
optgroup->append_single_option_line("extrusion_rate_smoothing_external_perimeter_only", "extrusion-rate-smoothing");
page = add_options_page(L("Support"), "custom-gcode_support"); // ORCA: icon only visible on placeholders
optgroup = page->new_optgroup(L("Support"), L"param_support");
@ -3335,12 +3336,12 @@ void TabFilament::build()
optgroup->append_line(line);
optgroup = page->new_optgroup(L("Bed temperature"), L"param_bed_temp");
line = {L("Bambu Cool Plate SuperTack"), L("Bed temperature when cool plate is installed. Value 0 means the filament does not support to print on the Bambu Cool Plate SuperTack")};
line = {L("Cool Plate (SuperTack)"), L("Bed temperature when cool plate is installed. Value 0 means the filament does not support to print on the Cool Plate SuperTack")};
line.append_option(optgroup->get_option("supertack_plate_temp_initial_layer"));
line.append_option(optgroup->get_option("supertack_plate_temp"));
optgroup->append_line(line);
line = { L("Cool Plate / PLA Plate"), L("Bed temperature when cool plate is installed. Value 0 means the filament does not support to print on the Cool Plate") };
line = { L("Cool Plate"), L("Bed temperature when cool plate is installed. Value 0 means the filament does not support to print on the Cool Plate") };
line.append_option(optgroup->get_option("cool_plate_temp_initial_layer"));
line.append_option(optgroup->get_option("cool_plate_temp"));
optgroup->append_line(line);
@ -3611,7 +3612,9 @@ void TabFilament::toggle_options()
{
bool pa = m_config->opt_bool("enable_pressure_advance", 0);
toggle_option("pressure_advance", pa);
// Orca: Enable the plates that should be visible when multi bed support is enabled or a BBL printer is selected
auto support_multi_bed_types = is_BBL_printer || cfg.opt_bool("support_multi_bed_types");
toggle_line("supertack_plate_temp_initial_layer", support_multi_bed_types );
toggle_line("cool_plate_temp_initial_layer", support_multi_bed_types );
toggle_line("textured_cool_plate_temp_initial_layer", support_multi_bed_types);
toggle_line("eng_plate_temp_initial_layer", support_multi_bed_types);
@ -3633,9 +3636,6 @@ void TabFilament::toggle_options()
bool support_chamber_temp_control = this->m_preset_bundle->printers.get_edited_preset().config.opt_bool("support_chamber_temp_control");
toggle_line("chamber_temperatures", support_chamber_temp_control);
for (auto el : {"supertack_plate_temp", "supertack_plate_temp_initial_layer", "cool_plate_temp", "cool_plate_temp_initial_layer", "eng_plate_temp", "eng_plate_temp_initial_layer", "textured_plate_temp", "textured_plate_temp_initial_layer"})
toggle_line(el, is_BBL_printer);
}
if (m_active_page->title() == L("Setting Overrides"))
update_filament_overrides_page(&cfg);

View file

@ -227,6 +227,7 @@ enum FILAMENT_TYPE : int
tPLA = 0,
tABS_ASA,
tPETG,
tPCTG,
tTPU,
tPA_CF,
tPET_CF,
@ -384,6 +385,10 @@ void Temp_Calibration_Dlg::on_filament_type_changed(wxCommandEvent& event) {
start = 250;
end = 230;
break;
case tPCTG:
start = 240;
end = 280;
break;
case tTPU:
start = 240;
end = 210;