Some initial work for refactoring Print->extruders
This commit is contained in:
parent
b9793b3f12
commit
52ce6e4a7b
2 changed files with 13 additions and 9 deletions
|
@ -18,7 +18,6 @@ has 'default_region_config' => (is => 'ro', default => sub { Slic3r::Config::Pr
|
||||||
has 'extra_variables' => (is => 'rw', default => sub {{}});
|
has 'extra_variables' => (is => 'rw', default => sub {{}});
|
||||||
has 'objects' => (is => 'rw', default => sub {[]});
|
has 'objects' => (is => 'rw', default => sub {[]});
|
||||||
has 'status_cb' => (is => 'rw');
|
has 'status_cb' => (is => 'rw');
|
||||||
has 'extruders' => (is => 'rw', default => sub {[]});
|
|
||||||
has 'regions' => (is => 'rw', default => sub {[]});
|
has 'regions' => (is => 'rw', default => sub {[]});
|
||||||
has '_state' => (is => 'ro', default => sub { Slic3r::Print::State->new });
|
has '_state' => (is => 'ro', default => sub { Slic3r::Print::State->new });
|
||||||
|
|
||||||
|
@ -282,8 +281,9 @@ sub validate {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub init_extruders {
|
# 0-based indices of used extruders
|
||||||
my $self = shift;
|
sub extruders {
|
||||||
|
my ($self) = @_;
|
||||||
|
|
||||||
# initialize all extruder(s) we need
|
# initialize all extruder(s) we need
|
||||||
my @used_extruders = ();
|
my @used_extruders = ();
|
||||||
|
@ -298,7 +298,15 @@ sub init_extruders {
|
||||||
qw(support_material support_material_interface);
|
qw(support_material support_material_interface);
|
||||||
}
|
}
|
||||||
|
|
||||||
for my $extruder_id (keys %{{ map {$_ => 1} @used_extruders }}) {
|
my %h = map { $_ => 1 } @used_extruders;
|
||||||
|
return [ sort keys %h ];
|
||||||
|
}
|
||||||
|
|
||||||
|
sub init_extruders {
|
||||||
|
my $self = shift;
|
||||||
|
|
||||||
|
# initialize all extruder(s) we need
|
||||||
|
for my $extruder_id (@{$self->extruders}) {
|
||||||
# make sure print config contains a value for all extruders
|
# make sure print config contains a value for all extruders
|
||||||
my %extruder_config = ();
|
my %extruder_config = ();
|
||||||
foreach my $opt_key (@{&Slic3r::Extruder::OPTIONS}) {
|
foreach my $opt_key (@{&Slic3r::Extruder::OPTIONS}) {
|
||||||
|
@ -845,10 +853,6 @@ sub write_gcode {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# always start with first extruder
|
|
||||||
# TODO: make sure we select the first *used* extruder
|
|
||||||
print $fh $gcodegen->set_extruder($self->extruders->[0]);
|
|
||||||
|
|
||||||
# initialize a motion planner for object-to-object travel moves
|
# initialize a motion planner for object-to-object travel moves
|
||||||
if ($self->config->avoid_crossing_perimeters) {
|
if ($self->config->avoid_crossing_perimeters) {
|
||||||
my $distance_from_objects = 1;
|
my $distance_from_objects = 1;
|
||||||
|
|
|
@ -758,7 +758,7 @@ sub combine_infill {
|
||||||
my $every = $region->config->infill_every_layers;
|
my $every = $region->config->infill_every_layers;
|
||||||
|
|
||||||
# limit the number of combined layers to the maximum height allowed by this regions' nozzle
|
# limit the number of combined layers to the maximum height allowed by this regions' nozzle
|
||||||
my $nozzle_diameter = $self->print->regions->[$region_id]->extruders->{infill}->nozzle_diameter;
|
my $nozzle_diameter = $self->print->config->nozzle_diameter->[ $region->config->infill_extruder-1 ];
|
||||||
|
|
||||||
# define the combinations
|
# define the combinations
|
||||||
my @combine = (); # layer_id => thickness in layers
|
my @combine = (); # layer_id => thickness in layers
|
||||||
|
|
Loading…
Add table
Reference in a new issue