Replace Extruder::config accessor with Perl wrapper, with C++ option accessors.

This commit is contained in:
Y. Sapir 2014-04-28 00:49:05 +03:00
parent 71b0b211ec
commit e005ff32c4
6 changed files with 149 additions and 24 deletions

View file

@ -10,13 +10,6 @@ our %EXPORT_TAGS = (roles => \@EXPORT_OK);
use Slic3r::Geometry qw(PI scale);
use constant OPTIONS => [qw(
extruder_offset
nozzle_diameter filament_diameter extrusion_multiplier temperature first_layer_temperature
retract_length retract_lift retract_speed retract_restart_extra retract_before_travel
retract_layer_change retract_length_toolchange retract_restart_extra_toolchange wipe
)];
# has 'e_per_mm3' => (is => 'lazy');
# has 'retract_speed_mm_min' => (is => 'lazy');
@ -26,18 +19,6 @@ use constant EXTRUDER_ROLE_SUPPORT_MATERIAL => 3;
use constant EXTRUDER_ROLE_SUPPORT_MATERIAL_INTERFACE => 4;
# generate accessors
{
no strict 'refs';
for my $opt_key (@{&Slic3r::Extruder::OPTIONS}) {
*{$opt_key} = sub {
my $self = shift;
$self->config->get_at($opt_key, $self->id);
};
}
}
sub e_per_mm3 {
my $self = shift;
return $self->extrusion_multiplier * (4 / (($self->filament_diameter ** 2) * PI));