mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-07 05:54:03 -06:00
Replace multitude of Extruder fields with querying a PrintConfig object by id.
This commit is contained in:
parent
b319dc9361
commit
2565d80679
7 changed files with 38 additions and 140 deletions
|
@ -25,19 +25,19 @@ use constant EXTRUDER_ROLE_INFILL => 2;
|
|||
use constant EXTRUDER_ROLE_SUPPORT_MATERIAL => 3;
|
||||
use constant EXTRUDER_ROLE_SUPPORT_MATERIAL_INTERFACE => 4;
|
||||
|
||||
sub new_from_config {
|
||||
my ($class, $config, $extruder_id) = @_;
|
||||
|
||||
my %conf = (
|
||||
id => $extruder_id,
|
||||
use_relative_e_distances => $config->use_relative_e_distances,
|
||||
);
|
||||
foreach my $opt_key (@{&OPTIONS}) {
|
||||
$conf{$opt_key} = $config->get_at($opt_key, $extruder_id);
|
||||
|
||||
# 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);
|
||||
};
|
||||
}
|
||||
return $class->new(%conf);
|
||||
}
|
||||
|
||||
|
||||
sub e_per_mm3 {
|
||||
my $self = shift;
|
||||
return $self->extrusion_multiplier * (4 / (($self->filament_diameter ** 2) * PI));
|
||||
|
|
|
@ -53,7 +53,7 @@ sub set_extruders {
|
|||
my ($self, $extruder_ids) = @_;
|
||||
|
||||
foreach my $i (@$extruder_ids) {
|
||||
$self->extruders->{$i} = my $e = Slic3r::Extruder->new_from_config($self->print_config, $i);
|
||||
$self->extruders->{$i} = my $e = Slic3r::Extruder->new($i, $self->print_config);
|
||||
$self->enable_wipe(1) if $e->wipe;
|
||||
}
|
||||
|
||||
|
|
|
@ -714,7 +714,7 @@ sub make_skirt {
|
|||
if ($self->config->min_skirt_length > 0) {
|
||||
$extruded_length[$extruder_idx] ||= 0;
|
||||
if (!$extruders_e_per_mm[$extruder_idx]) {
|
||||
my $extruder = Slic3r::Extruder->new_from_config($self->config, $extruder_idx);
|
||||
my $extruder = Slic3r::Extruder->new($extruder_idx, $self->config);
|
||||
$extruders_e_per_mm[$extruder_idx] = $extruder->e_per_mm($mm3_per_mm);
|
||||
}
|
||||
$extruded_length[$extruder_idx] += unscale $loop->length * $extruders_e_per_mm[$extruder_idx];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue