Moved vibration limit to its own G-code filter

This commit is contained in:
Alessandro Ranellucci 2013-08-28 16:51:58 +02:00
parent fb763b0187
commit 73c05a6092
18 changed files with 103 additions and 70 deletions

View file

@ -9,6 +9,7 @@ has 'gcodegen' => (is => 'ro', required => 1);
has 'shift' => (is => 'ro', required => 1);
has 'spiralvase' => (is => 'lazy');
has 'vibration_limit' => (is => 'lazy');
has 'skirt_done' => (is => 'rw', default => sub { {} }); # print_z => 1
has 'brim_done' => (is => 'rw');
has 'second_layer_things_done' => (is => 'rw');
@ -22,6 +23,14 @@ sub _build_spiralvase {
: undef;
}
sub _build_vibration_limit {
my $self = shift;
return $Slic3r::Config->vibration_limit
? Slic3r::GCode::VibrationLimit->new(config => $self->gcodegen->config)
: undef;
}
sub process_layer {
my $self = shift;
my ($layer, $object_copies) = @_;
@ -162,6 +171,10 @@ sub process_layer {
$gcode = $self->spiralvase->process_layer($gcode, $layer)
if $spiralvase;
# apply vibration limit if enabled
$gcode = $self->vibration_limit->process($gcode)
if $Slic3r::Config->vibration_limit != 0;
return $gcode;
}