mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-11 06:31:49 +08:00
Bugfix: percent first layer speed was not applied over autospeed. #2945
This commit is contained in:
parent
f25ea9f493
commit
4e586b8eda
53
t/speed.t
Normal file
53
t/speed.t
Normal file
@ -0,0 +1,53 @@
|
||||
use Test::More tests => 2;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
BEGIN {
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
use local::lib "$FindBin::Bin/../local-lib";
|
||||
}
|
||||
|
||||
use List::Util qw(none);
|
||||
use Slic3r;
|
||||
use Slic3r::Geometry qw(epsilon);
|
||||
use Slic3r::Test;
|
||||
|
||||
{
|
||||
my $config = Slic3r::Config->new_from_defaults;
|
||||
my $test = sub {
|
||||
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
||||
my %speeds_by_z = (); # z => []
|
||||
Slic3r::GCode::Reader->new->parse(my $gcode = Slic3r::Test::gcode($print), sub {
|
||||
my ($self, $cmd, $args, $info) = @_;
|
||||
|
||||
if ($cmd eq 'G1' && $info->{dist_E} > 0 && $info->{dist_XY} > 0) {
|
||||
$speeds_by_z{$self->Z} //= [];
|
||||
push @{ $speeds_by_z{$self->Z} }, $self->F/60;
|
||||
}
|
||||
});
|
||||
return %speeds_by_z;
|
||||
};
|
||||
|
||||
{
|
||||
$config->set('perimeter_speed', 0);
|
||||
$config->set('external_perimeter_speed', 0);
|
||||
$config->set('infill_speed', 0);
|
||||
$config->set('support_material_speed', 0);
|
||||
$config->set('solid_infill_speed', 0);
|
||||
$config->set('first_layer_speed', '50%');
|
||||
$config->set('first_layer_height', 0.25);
|
||||
my %speeds_by_z = $test->();
|
||||
ok !!(none { $_ > $config->max_print_speed/2+&epsilon } @{ $speeds_by_z{$config->first_layer_height} }),
|
||||
'percent first_layer_speed is applied over autospeed';
|
||||
}
|
||||
|
||||
{
|
||||
$config->set('first_layer_speed', 33);
|
||||
my %speeds_by_z = $test->();
|
||||
ok !!(none { $_ > $config->first_layer_speed } @{ $speeds_by_z{$config->first_layer_height} }),
|
||||
'absolute first_layer_speed overrides autospeed';
|
||||
}
|
||||
}
|
||||
|
||||
__END__
|
@ -551,12 +551,12 @@ GCode::_extrude(ExtrusionPath path, std::string description, double speed)
|
||||
CONFESS("Invalid speed");
|
||||
}
|
||||
}
|
||||
if (this->first_layer) {
|
||||
speed = this->config.get_abs_value("first_layer_speed", speed);
|
||||
}
|
||||
if (this->volumetric_speed != 0 && speed == 0) {
|
||||
speed = this->volumetric_speed / path.mm3_per_mm;
|
||||
}
|
||||
if (this->first_layer) {
|
||||
speed = this->config.get_abs_value("first_layer_speed", speed);
|
||||
}
|
||||
if (this->config.max_volumetric_speed.value > 0) {
|
||||
// cap speed with max_volumetric_speed anyway (even if user is not using autospeed)
|
||||
speed = std::min(
|
||||
|
Loading…
x
Reference in New Issue
Block a user