From 63e77fcfd8c5955116d5b67995888e110980e27e Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Tue, 7 Aug 2012 20:50:54 +0200 Subject: [PATCH] Refactor extruder settings --- lib/Slic3r/Extruder.pm | 9 ++++----- lib/Slic3r/Print.pm | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Slic3r/Extruder.pm b/lib/Slic3r/Extruder.pm index 5f9ad418c..20d10d0db 100644 --- a/lib/Slic3r/Extruder.pm +++ b/lib/Slic3r/Extruder.pm @@ -3,11 +3,10 @@ use Moo; use Slic3r::Geometry qw(PI); -has 'nozzle_diameter' => (is => 'ro', required => 1); -has 'filament_diameter' => (is => 'ro', required => 1); -has 'extrusion_multiplier' => (is => 'ro', required => 1); -has 'temperature' => (is => 'ro', required => 1); -has 'first_layer_temperature' => (is => 'rw', required => 1); +use constant OPTIONS => [qw( + nozzle_diameter filament_diameter extrusion_multiplier temperature first_layer_temperature +)]; +has $_ => (is => 'ro', required => 1) for @{&OPTIONS}; has 'e_per_mm3' => (is => 'lazy'); has '_mm3_per_mm_cache' => (is => 'ro', default => sub {{}}); diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index ebe2a8abc..db0009e82 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -46,7 +46,7 @@ sub _trigger_config { for my $t (0, map $_-1, map $self->config->get($_), qw(perimeter_extruder infill_extruder support_material_extruder)) { $Slic3r::extruders->[$t] ||= Slic3r::Extruder->new( map { $_ => $self->config->get($_)->[$t] // $self->config->get($_)->[0] } #/ - qw(nozzle_diameter filament_diameter extrusion_multiplier temperature first_layer_temperature) + @{&Slic3r::Extruder::OPTIONS} ); }