mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-07-30 16:52:01 +08:00
This commit is contained in:
parent
ad9b985772
commit
dcdb5056fe
@ -53,7 +53,7 @@ sub flush {
|
||||
* ($elapsed - $self->config->slowdown_below_layer_time)
|
||||
/ ($self->config->fan_below_layer_time - $self->config->slowdown_below_layer_time); #/
|
||||
}
|
||||
Slic3r::debugf " fan = %d%%, speed = %d%%\n", $fan_speed, $speed_factor * 100;
|
||||
Slic3r::debugf " fan = %d%%, speed = %f%%\n", $fan_speed, $speed_factor * 100;
|
||||
|
||||
if ($speed_factor < 1) {
|
||||
$gcode =~ s/^(?=.*?;_EXTRUDE_SET_SPEED)(?!.*?;_WIPE)(?<!;_BRIDGE_FAN_START\n)(G1\sF)(\d+(?:\.\d+)?)/
|
||||
|
27
t/cooling.t
27
t/cooling.t
@ -2,13 +2,14 @@ use Test::More;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
plan tests => 11;
|
||||
plan tests => 12;
|
||||
|
||||
BEGIN {
|
||||
use FindBin;
|
||||
use lib "$FindBin::Bin/../lib";
|
||||
}
|
||||
|
||||
use List::Util qw(first);
|
||||
use Slic3r;
|
||||
use Slic3r::Test;
|
||||
|
||||
@ -135,4 +136,28 @@ $config->set('disable_fan_first_layers', 0);
|
||||
ok !$bridge_with_no_fan, 'bridge fan is turned on for all bridges';
|
||||
}
|
||||
|
||||
{
|
||||
my $config = Slic3r::Config->new_from_defaults;
|
||||
$config->set('cooling', 1);
|
||||
$config->set('fan_below_layer_time', 0);
|
||||
$config->set('slowdown_below_layer_time', 10);
|
||||
$config->set('min_print_speed', 0);
|
||||
$config->set('start_gcode', '');
|
||||
|
||||
my $print = Slic3r::Test::init_print('20mm_cube', config => $config);
|
||||
my @layer_times = (0); # in seconds
|
||||
Slic3r::GCode::Reader->new->parse(Slic3r::Test::gcode($print), sub {
|
||||
my ($self, $cmd, $args, $info) = @_;
|
||||
|
||||
if ($cmd eq 'G1') {
|
||||
if ($info->{dist_Z}) {
|
||||
push @layer_times, 0;
|
||||
}
|
||||
$layer_times[-1] += abs($info->{dist_XY} || $info->{dist_E} || $info->{dist_Z} || 0) / ($args->{F} // $self->F) * 60;
|
||||
}
|
||||
});
|
||||
my $all_below = !defined first { $_ > 0 && $_ < $config->slowdown_below_layer_time } @layer_times;
|
||||
ok $all_below, 'slowdown_below_layer_time is honored';
|
||||
}
|
||||
|
||||
__END__
|
||||
|
@ -632,8 +632,13 @@ GCode::travel_to(const Point &point, ExtrusionRole role, std::string comment)
|
||||
for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line)
|
||||
gcode += this->writer.travel_to_xy(this->point_to_gcode(line->b), comment);
|
||||
|
||||
/* While this makes the estimate more accurate, CoolingBuffer calculates the slowdown
|
||||
factor on the whole elapsed time but only alters non-travel moves, thus the resulting
|
||||
time is still shorter than the configured threshold. We could create a new
|
||||
elapsed_travel_time but we would still need to account for bridges, retractions, wipe etc.
|
||||
if (this->config.cooling)
|
||||
this->elapsed_time += travel.length() / this->config.get_abs_value("travel_speed");
|
||||
this->elapsed_time += unscale(travel.length()) / this->config.get_abs_value("travel_speed");
|
||||
*/
|
||||
|
||||
return gcode;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user