diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index e9e7563c16..e7dfd102b5 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -78,11 +78,13 @@ use Unicode::Normalize; # Scaling between the float and integer coordinates. # Floats are in mm. use constant SCALING_FACTOR => 0.000001; +use constant LOOP_CLIPPING_LENGTH_OVER_NOZZLE_DIAMETER => 0.15; + +# Following constants are used by the infill algorithms and integration tests. # Resolution to simplify perimeters to. These constants are now used in C++ code only. Better to publish them to Perl from the C++ code. # use constant RESOLUTION => 0.0125; # use constant SCALED_RESOLUTION => RESOLUTION / SCALING_FACTOR; -use constant LOOP_CLIPPING_LENGTH_OVER_NOZZLE_DIAMETER => 0.15; -# use constant INFILL_OVERLAP_OVER_SPACING => 0.3; +use constant INFILL_OVERLAP_OVER_SPACING => 0.3; # Keep track of threads we created. Each thread keeps its own list of threads it spwaned. my @my_threads = (); diff --git a/lib/Slic3r/GUI/Tab.pm b/lib/Slic3r/GUI/Tab.pm index e7ad8370be..4f8defd998 100644 --- a/lib/Slic3r/GUI/Tab.pm +++ b/lib/Slic3r/GUI/Tab.pm @@ -464,7 +464,8 @@ sub build { infill_every_layers infill_only_where_needed solid_infill_every_layers fill_angle solid_infill_below_area only_retract_when_crossing_perimeters infill_first - max_print_speed max_volumetric_speed + max_print_speed max_volumetric_speed + max_volumetric_extrusion_rate_slope_positive max_volumetric_extrusion_rate_slope_negative perimeter_speed small_perimeter_speed external_perimeter_speed infill_speed solid_infill_speed top_solid_infill_speed support_material_speed support_material_interface_speed bridge_speed gap_fill_speed @@ -627,6 +628,8 @@ sub build { my $optgroup = $page->new_optgroup('Autospeed (advanced)'); $optgroup->append_single_option_line('max_print_speed'); $optgroup->append_single_option_line('max_volumetric_speed'); + $optgroup->append_single_option_line('max_volumetric_extrusion_rate_slope_positive'); + $optgroup->append_single_option_line('max_volumetric_extrusion_rate_slope_negative'); } } diff --git a/lib/Slic3r/Print/GCode.pm b/lib/Slic3r/Print/GCode.pm index 62e3f3ae10..27cca32217 100644 --- a/lib/Slic3r/Print/GCode.pm +++ b/lib/Slic3r/Print/GCode.pm @@ -117,7 +117,8 @@ sub BUILD { if $self->config->pressure_advance > 0; $self->_pressure_equalizer(Slic3r::GCode::PressureEqualizer->new($self->config)) - if defined($ENV{"SLIC3R_PRESSURE_EQUALIZER"}) && $ENV{'SLIC3R_PRESSURE_EQUALIZER'} == 1; + if ($self->config->max_volumetric_extrusion_rate_slope_positive > 0 || + $self->config->max_volumetric_extrusion_rate_slope_negative > 0); $self->_gcodegen->set_enable_extrusion_role_markers(defined $self->_pressure_equalizer); } diff --git a/xs/src/libslic3r/GCode/PressureEqualizer.cpp b/xs/src/libslic3r/GCode/PressureEqualizer.cpp index 2067b0dd57..b3566ca5f9 100644 --- a/xs/src/libslic3r/GCode/PressureEqualizer.cpp +++ b/xs/src/libslic3r/GCode/PressureEqualizer.cpp @@ -44,11 +44,13 @@ void GCodePressureEqualizer::reset() } m_max_segment_length = 20.f; - // Volumetric rate of a 0.45mm x 0.2mm extrusion at 60mm/min XY movement: 0.45*0.2*60*60=5.4*60 = 324 mm^3/min - // Volumetric rate of a 0.45mm x 0.2mm extrusion at 20mm/min XY movement: 0.45*0.2*20*60=1.8*60 = 108 mm^3/min - // Slope of the volumetric rate, changing from 20mm^3/min to 60mm^3/min over 2 seconds: (5.4-1.8)*60*60/2=60*60*1.8 = 6480 mm^3/min^2 - m_max_volumetric_extrusion_rate_slope_positive = 6480.f; - m_max_volumetric_extrusion_rate_slope_negative = 6480.f; + // Volumetric rate of a 0.45mm x 0.2mm extrusion at 60mm/s XY movement: 0.45*0.2*60*60=5.4*60 = 324 mm^3/min + // Volumetric rate of a 0.45mm x 0.2mm extrusion at 20mm/s XY movement: 0.45*0.2*20*60=1.8*60 = 108 mm^3/min + // Slope of the volumetric rate, changing from 20mm/s to 60mm/s over 2 seconds: (5.4-1.8)*60*60/2=60*60*1.8 = 6480 mm^3/min^2 = 1.8 mm^3/s^2 + m_max_volumetric_extrusion_rate_slope_positive = (this->m_config == NULL) ? 6480.f : + this->m_config->max_volumetric_extrusion_rate_slope_positive.value * 60. * 60.; + m_max_volumetric_extrusion_rate_slope_negative = (this->m_config == NULL) ? 6480.f : + this->m_config->max_volumetric_extrusion_rate_slope_negative.value * 60. * 60.; for (size_t i = 0; i < numExtrusionRoles; ++ i) { m_max_volumetric_extrusion_rate_slopes[i].negative = m_max_volumetric_extrusion_rate_slope_negative; diff --git a/xs/src/libslic3r/PrintConfig.cpp b/xs/src/libslic3r/PrintConfig.cpp index e3bc4bad9f..5c0aec65d0 100644 --- a/xs/src/libslic3r/PrintConfig.cpp +++ b/xs/src/libslic3r/PrintConfig.cpp @@ -595,6 +595,24 @@ PrintConfigDef::PrintConfigDef() def->min = 0; def->default_value = new ConfigOptionFloat(0); + def = this->add("max_volumetric_extrusion_rate_slope_positive", coFloat); + def->label = "Max volumetric slope positive"; + def->tooltip = "This experimental setting is used to limit the speed of change in extrusion rate. A value of 1.8 mm³/s² ensures, that a change from the extrusion rate " + "of 1.8 mm³/s (0.45mm extrusion width, 0.2mm extrusion height, feedrate 20 mm/s) to 5.4 mm³/s (feedrate 60 mm/s) will take at least 2 seconds."; + def->sidetext = "mm³/s²"; + def->cli = "max-volumetric-extrusion-rate-slope-positive=f"; + def->min = 0; + def->default_value = new ConfigOptionFloat(0); + + def = this->add("max_volumetric_extrusion_rate_slope_negative", coFloat); + def->label = "Max volumetric slope negative"; + def->tooltip = "This experimental setting is used to limit the speed of change in extrusion rate. A value of 1.8 mm³/s² ensures, that a change from the extrusion rate " + "of 1.8 mm³/s (0.45mm extrusion width, 0.2mm extrusion height, feedrate 20 mm/s) to 5.4 mm³/s (feedrate 60 mm/s) will take at least 2 seconds."; + def->sidetext = "mm³/s²"; + def->cli = "max-volumetric-extrusion-rate-slope-negative=f"; + def->min = 0; + def->default_value = new ConfigOptionFloat(0); + def = this->add("min_fan_speed", coInt); def->label = "Min"; def->tooltip = "This setting represents the minimum PWM your fan needs to work."; diff --git a/xs/src/libslic3r/PrintConfig.hpp b/xs/src/libslic3r/PrintConfig.hpp index d8c57cb57c..eebd5d81de 100644 --- a/xs/src/libslic3r/PrintConfig.hpp +++ b/xs/src/libslic3r/PrintConfig.hpp @@ -289,6 +289,8 @@ class GCodeConfig : public virtual StaticPrintConfig ConfigOptionString layer_gcode; ConfigOptionFloat max_print_speed; ConfigOptionFloat max_volumetric_speed; + ConfigOptionFloat max_volumetric_extrusion_rate_slope_positive; + ConfigOptionFloat max_volumetric_extrusion_rate_slope_negative; ConfigOptionFloat pressure_advance; ConfigOptionFloats retract_length; ConfigOptionFloats retract_length_toolchange; @@ -321,6 +323,8 @@ class GCodeConfig : public virtual StaticPrintConfig OPT_PTR(layer_gcode); OPT_PTR(max_print_speed); OPT_PTR(max_volumetric_speed); + OPT_PTR(max_volumetric_extrusion_rate_slope_positive); + OPT_PTR(max_volumetric_extrusion_rate_slope_negative); OPT_PTR(pressure_advance); OPT_PTR(retract_length); OPT_PTR(retract_length_toolchange);