mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-11-02 20:51:23 -07:00
Assign extruders and flows to materials
This commit is contained in:
parent
e2ab340edb
commit
e696764af8
10 changed files with 161 additions and 120 deletions
|
|
@ -4,15 +4,14 @@ use Moo;
|
|||
use Slic3r::Geometry::Clipper qw(union_ex);
|
||||
|
||||
has 'id' => (is => 'rw', required => 1); # sequential number of layer, 0-based
|
||||
has 'object' => (is => 'ro', weak_ref => 1, required => 1);
|
||||
has 'materials' => (is => 'ro', default => sub { [] });
|
||||
has 'slicing_errors' => (is => 'rw');
|
||||
|
||||
has 'slice_z' => (is => 'lazy');
|
||||
has 'print_z' => (is => 'lazy');
|
||||
has 'height' => (is => 'lazy');
|
||||
has 'flow' => (is => 'lazy');
|
||||
has 'perimeter_flow' => (is => 'lazy');
|
||||
has 'infill_flow' => (is => 'lazy');
|
||||
has 'flow' => (is => 'ro', default => sub { $Slic3r::flow });
|
||||
|
||||
# collection of expolygons generated by slicing the original geometry;
|
||||
# also known as 'islands' (all materials are merged here)
|
||||
|
|
@ -43,34 +42,14 @@ sub _build_height {
|
|||
return $self->id == 0 ? $Slic3r::Config->get_value('first_layer_height') : $Slic3r::Config->layer_height;
|
||||
}
|
||||
|
||||
sub _build_flow {
|
||||
my $self = shift;
|
||||
return $self->id == 0 && $Slic3r::first_layer_flow
|
||||
? $Slic3r::first_layer_flow
|
||||
: $Slic3r::flow;
|
||||
}
|
||||
|
||||
sub _build_perimeter_flow {
|
||||
my $self = shift;
|
||||
return $self->id == 0 && $Slic3r::first_layer_flow
|
||||
? $Slic3r::first_layer_flow
|
||||
: $Slic3r::perimeter_flow;
|
||||
}
|
||||
|
||||
sub _build_infill_flow {
|
||||
my $self = shift;
|
||||
return $self->id == 0 && $Slic3r::first_layer_flow
|
||||
? $Slic3r::first_layer_flow
|
||||
: $Slic3r::infill_flow;
|
||||
}
|
||||
|
||||
sub material {
|
||||
my $self = shift;
|
||||
my ($material_idx) = @_;
|
||||
|
||||
if (!defined $self->materials->[$material_idx]) {
|
||||
$self->materials->[$material_idx] = Slic3r::Layer::Material->new(
|
||||
layer => $self,
|
||||
layer => $self,
|
||||
material => $self->object->print->materials->[$material_idx],
|
||||
);
|
||||
}
|
||||
return $self->materials->[$material_idx];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue