mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Factored out the layer height logic
This commit is contained in:
parent
06a592f25e
commit
2275de9f0d
2 changed files with 24 additions and 32 deletions
|
@ -18,10 +18,30 @@ sub BUILD {
|
|||
my $self = shift;
|
||||
|
||||
# make layers
|
||||
my $print_z = my $slice_z = my $raft_z = 0;
|
||||
while (!@{$self->layers} || $self->layers->[-1]->slice_z < $self->size->[Z]) {
|
||||
my $id = $#{$self->layers} + 1;
|
||||
my $height = $id == 0
|
||||
? $Slic3r::Config->get_value('first_layer_height')
|
||||
: $Slic3r::Config->layer_height;
|
||||
$print_z += $height;
|
||||
|
||||
if ($id < $Slic3r::Config->raft_layers) {
|
||||
# this is a raft layer
|
||||
$raft_z += $height;
|
||||
$slice_z = -1;
|
||||
} else {
|
||||
$slice_z = $print_z - ($height/2) - $raft_z;
|
||||
}
|
||||
|
||||
### Slic3r::debugf "Layer %d: height = %s; slice_z = %s; print_z = %s\n", $id, $height, $slice_z, $print_z;
|
||||
|
||||
push @{$self->layers}, Slic3r::Layer->new(
|
||||
object => $self,
|
||||
id => $#{$self->layers} + 1,
|
||||
id => $id,
|
||||
height => $height,
|
||||
print_z => scale $print_z,
|
||||
slice_z => scale $slice_z,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue