mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-21 21:58:03 -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
|
@ -10,9 +10,9 @@ has 'object' => (is => 'ro', weak_ref => 1, required => 1);
|
|||
has 'regions' => (is => 'ro', default => sub { [] });
|
||||
has 'slicing_errors' => (is => 'rw');
|
||||
|
||||
has 'slice_z' => (is => 'lazy');
|
||||
has 'print_z' => (is => 'lazy');
|
||||
has 'height' => (is => 'lazy');
|
||||
has 'slice_z' => (is => 'ro', required => 1); # Z used for slicing in scaled coordinates
|
||||
has 'print_z' => (is => 'ro', required => 1); # Z used for printing in scaled coordinates
|
||||
has 'height' => (is => 'ro', required => 1); # layer height in unscaled coordinates
|
||||
|
||||
# collection of expolygons generated by slicing the original geometry;
|
||||
# also known as 'islands' (all regions are merged here)
|
||||
|
@ -28,34 +28,6 @@ sub _trigger_id {
|
|||
$_->_trigger_layer for @{$self->regions || []};
|
||||
}
|
||||
|
||||
# Z used for slicing in scaled coordinates
|
||||
sub _build_slice_z {
|
||||
my $self = shift;
|
||||
|
||||
if ($Slic3r::Config->raft_layers == 0) {
|
||||
if ($self->id == 0) {
|
||||
return scale $Slic3r::Config->get_value('first_layer_height') / 2;
|
||||
}
|
||||
return scale($Slic3r::Config->get_value('first_layer_height') + ($self->id-1 + 0.5) * $Slic3r::Config->layer_height);
|
||||
} else {
|
||||
return -1 if $self->id < $Slic3r::Config->raft_layers;
|
||||
my $object_layer_id = $self->id - $Slic3r::Config->raft_layers;
|
||||
return scale ($object_layer_id + 0.5) * $Slic3r::Config->layer_height;
|
||||
}
|
||||
}
|
||||
|
||||
# Z used for printing in scaled coordinates
|
||||
sub _build_print_z {
|
||||
my $self = shift;
|
||||
return ($Slic3r::Config->get_value('first_layer_height') + ($self->id * $Slic3r::Config->layer_height)) / &Slic3r::SCALING_FACTOR;
|
||||
}
|
||||
|
||||
# layer height in unscaled coordinates
|
||||
sub _build_height {
|
||||
my $self = shift;
|
||||
return $self->id == 0 ? $Slic3r::Config->get_value('first_layer_height') : $Slic3r::Config->layer_height;
|
||||
}
|
||||
|
||||
# layer height of contact paths in unscaled coordinates
|
||||
sub support_material_contact_height {
|
||||
my $self = shift;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue