Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix an issue that pressure eq may cause 0 feedrate in vase mode #4398

Merged
merged 1 commit into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/libslic3r/GCode/PressureEqualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,11 @@ inline bool is_just_line_with_extrude_set_speed_tag(const std::string &line)
return p_line <= line_end && is_eol(*p_line);
}

void PressureEqualizer::push_line_to_output(const size_t line_idx, const float new_feedrate, const char *comment)
void PressureEqualizer::push_line_to_output(const size_t line_idx, float new_feedrate, const char *comment)
{
// Orca: sanity check, 1 mm/s is the minimum feedrate.
if (new_feedrate < 60)
new_feedrate = 60;
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),
Expand Down
3 changes: 2 additions & 1 deletion src/libslic3r/GCode/PressureEqualizer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ class PressureEqualizer
float time() const { return dist_xyz() / feedrate(); }
float time_inv() const { return feedrate() / dist_xyz(); }
float volumetric_correction_avg() const {
float avg_correction = 0.5f * (volumetric_extrusion_rate_start + volumetric_extrusion_rate_end) / volumetric_extrusion_rate;
// Orca: cap the correction to 0.05 - 1.00000001 to avoid zero feedrate
float avg_correction = std::max(0.05f,0.5f * (volumetric_extrusion_rate_start + volumetric_extrusion_rate_end) / volumetric_extrusion_rate);
assert(avg_correction > 0.f);
assert(avg_correction <= 1.00000001f);
return avg_correction;
Expand Down
37 changes: 21 additions & 16 deletions src/slic3r/GUI/Plater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9108,7 +9108,7 @@ void Plater::cut_horizontal(size_t obj_idx, size_t instance_idx, double z, Model
void Plater::_calib_pa_tower(const Calib_Params& params) {
add_model(false, Slic3r::resources_dir() + "/calib/pressure_advance/tower_with_seam.stl");

auto print_config = &wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto& print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;

Expand All @@ -9135,6 +9135,8 @@ void Plater::_calib_pa_tower(const Calib_Params& params) {
obj_cfg.set_key_value("brim_object_gap", new ConfigOptionFloat(.0f));
obj_cfg.set_key_value("brim_ears_max_angle", new ConfigOptionFloat(135.f));
obj_cfg.set_key_value("brim_width", new ConfigOptionFloat(6.f));
obj_cfg.set_key_value("seam_slope_type", new ConfigOptionEnum<SeamScarfType>(SeamScarfType::None));
print_config.set_key_value("max_volumetric_extrusion_rate_slope", new ConfigOptionFloat(0));

changed_objects({ 0 });
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
Expand Down Expand Up @@ -9232,11 +9234,12 @@ void Plater::calib_flowrate(int pass) {
_obj->config.set_key_value("internal_solid_infill_line_width", new ConfigOptionFloatOrPercent(nozzle_diameter * 1.2f, false));
_obj->config.set_key_value("top_surface_pattern", new ConfigOptionEnum<InfillPattern>(ipMonotonic));
_obj->config.set_key_value("top_solid_infill_flow_ratio", new ConfigOptionFloat(1.0f));
_obj->config.set_key_value("top_surface_pattern", new ConfigOptionEnum<InfillPattern>(ipMonotonic));
_obj->config.set_key_value("infill_direction", new ConfigOptionFloat(45));
_obj->config.set_key_value("ironing_type", new ConfigOptionEnum<IroningType>(IroningType::NoIroning));
_obj->config.set_key_value("internal_solid_infill_speed", new ConfigOptionFloat(internal_solid_speed));
_obj->config.set_key_value("top_surface_speed", new ConfigOptionFloat(top_surface_speed));
_obj->config.set_key_value("seam_slope_type", new ConfigOptionEnum<SeamScarfType>(SeamScarfType::None));
print_config->set_key_value("max_volumetric_extrusion_rate_slope", new ConfigOptionFloat(0));

// extract flowrate from name, filename format: flowrate_xxx
std::string obj_name = _obj->name;
Expand Down Expand Up @@ -9278,6 +9281,7 @@ void Plater::calib_temp(const Calib_Params& params) {
model().objects[0]->config.set_key_value("brim_width", new ConfigOptionFloat(5.0));
model().objects[0]->config.set_key_value("brim_object_gap", new ConfigOptionFloat(0.0));
model().objects[0]->config.set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
model().objects[0]->config.set_key_value("seam_slope_type", new ConfigOptionEnum<SeamScarfType>(SeamScarfType::None));

changed_objects({ 0 });
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
Expand Down Expand Up @@ -9323,6 +9327,7 @@ void Plater::calib_max_vol_speed(const Calib_Params& params)
auto filament_config = &wxGetApp().preset_bundle->filaments.get_edited_preset().config;
auto printer_config = &wxGetApp().preset_bundle->printers.get_edited_preset().config;
auto obj = model().objects[0];
auto& obj_cfg = obj->config;

auto bed_shape = printer_config->option<ConfigOptionPoints>("printable_area")->values;
BoundingBoxf bed_ext = get_extents(bed_shape);
Expand All @@ -9343,21 +9348,21 @@ void Plater::calib_max_vol_speed(const Calib_Params& params)
filament_config->set_key_value("filament_max_volumetric_speed", new ConfigOptionFloats { 200 });
filament_config->set_key_value("slow_down_layer_time", new ConfigOptionFloats{0.0});

print_config->set_key_value("enable_overhang_speed", new ConfigOptionBool { false });
obj_cfg.set_key_value("enable_overhang_speed", new ConfigOptionBool { false });
obj_cfg.set_key_value("wall_loops", new ConfigOptionInt(1));
obj_cfg.set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
obj_cfg.set_key_value("top_shell_layers", new ConfigOptionInt(0));
obj_cfg.set_key_value("bottom_shell_layers", new ConfigOptionInt(0));
obj_cfg.set_key_value("sparse_infill_density", new ConfigOptionPercent(0));
obj_cfg.set_key_value("overhang_reverse", new ConfigOptionBool(false));
obj_cfg.set_key_value("outer_wall_line_width", new ConfigOptionFloatOrPercent(line_width, false));
obj_cfg.set_key_value("layer_height", new ConfigOptionFloat(layer_height));
obj_cfg.set_key_value("brim_type", new ConfigOptionEnum<BrimType>(btOuterAndInner));
obj_cfg.set_key_value("brim_width", new ConfigOptionFloat(5.0));
obj_cfg.set_key_value("brim_object_gap", new ConfigOptionFloat(0.0));
print_config->set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
print_config->set_key_value("wall_loops", new ConfigOptionInt(1));
print_config->set_key_value("alternate_extra_wall", new ConfigOptionBool(false));
print_config->set_key_value("top_shell_layers", new ConfigOptionInt(0));
print_config->set_key_value("bottom_shell_layers", new ConfigOptionInt(0));
print_config->set_key_value("sparse_infill_density", new ConfigOptionPercent(0));
print_config->set_key_value("overhang_reverse", new ConfigOptionBool(false));
print_config->set_key_value("spiral_mode", new ConfigOptionBool(true));
print_config->set_key_value("outer_wall_line_width", new ConfigOptionFloatOrPercent(line_width, false));
print_config->set_key_value("initial_layer_print_height", new ConfigOptionFloat(layer_height));
print_config->set_key_value("layer_height", new ConfigOptionFloat(layer_height));
obj->config.set_key_value("brim_type", new ConfigOptionEnum<BrimType>(btOuterAndInner));
obj->config.set_key_value("brim_width", new ConfigOptionFloat(5.0));
obj->config.set_key_value("brim_object_gap", new ConfigOptionFloat(0.0));
print_config->set_key_value("max_volumetric_extrusion_rate_slope", new ConfigOptionFloat(0));

changed_objects({ 0 });
wxGetApp().get_tab(Preset::TYPE_PRINT)->update_dirty();
Expand Down Expand Up @@ -9410,7 +9415,7 @@ void Plater::calib_retraction(const Calib_Params& params)
obj->config.set_key_value("top_shell_layers", new ConfigOptionInt(0));
obj->config.set_key_value("bottom_shell_layers", new ConfigOptionInt(3));
obj->config.set_key_value("sparse_infill_density", new ConfigOptionPercent(0));
obj->config.set_key_value("initial_layer_print_height", new ConfigOptionFloat(layer_height));
print_config->set_key_value("initial_layer_print_height", new ConfigOptionFloat(layer_height));
obj->config.set_key_value("layer_height", new ConfigOptionFloat(layer_height));
obj->config.set_key_value("alternate_extra_wall", new ConfigOptionBool(false));

Expand Down
Loading