mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-22 04:28:05 +08:00
Factor out layer height in support material generation
This commit is contained in:
parent
2ab5fa9c72
commit
17cbca5e06
@ -710,13 +710,10 @@ sub generate_support_material {
|
|||||||
my $self = shift;
|
my $self = shift;
|
||||||
return if $self->layer_count < 2;
|
return if $self->layer_count < 2;
|
||||||
|
|
||||||
my $overhang_width;
|
my $threshold_rad;
|
||||||
if ($Slic3r::Config->support_material_threshold) {
|
if ($Slic3r::Config->support_material_threshold) {
|
||||||
my $threshold_rad = deg2rad($Slic3r::Config->support_material_threshold + 1); # +1 makes the threshold inclusive
|
$threshold_rad = deg2rad($Slic3r::Config->support_material_threshold + 1); # +1 makes the threshold inclusive
|
||||||
Slic3r::debugf "Threshold angle = %d°\n", rad2deg($threshold_rad);
|
Slic3r::debugf "Threshold angle = %d°\n", rad2deg($threshold_rad);
|
||||||
$overhang_width = scale $Slic3r::Config->layer_height * ((cos $threshold_rad) / (sin $threshold_rad));
|
|
||||||
} else {
|
|
||||||
$overhang_width = $self->layers->[1]->regions->[0]->overhang_width;
|
|
||||||
}
|
}
|
||||||
my $flow = $self->print->support_material_flow;
|
my $flow = $self->print->support_material_flow;
|
||||||
my $distance_from_object = 1.5 * $flow->scaled_width;
|
my $distance_from_object = 1.5 * $flow->scaled_width;
|
||||||
@ -740,6 +737,11 @@ sub generate_support_material {
|
|||||||
my $layer = $self->layers->[$i];
|
my $layer = $self->layers->[$i];
|
||||||
my $lower_layer = $i > 0 ? $self->layers->[$i-1] : undef;
|
my $lower_layer = $i > 0 ? $self->layers->[$i-1] : undef;
|
||||||
|
|
||||||
|
# overhang width must be computed on lower layer
|
||||||
|
my $overhang_width = $Slic3r::Config->support_material_threshold
|
||||||
|
? scale $lower_layer->height * ((cos $threshold_rad) / (sin $threshold_rad))
|
||||||
|
: $self->layers->[1]->regions->[0]->overhang_width;
|
||||||
|
|
||||||
my @current_layer_offsetted_slices = map $_->offset_ex($distance_from_object), @{$layer->slices};
|
my @current_layer_offsetted_slices = map $_->offset_ex($distance_from_object), @{$layer->slices};
|
||||||
|
|
||||||
# $upper_layers_overhangs[-1] contains the overhangs of the upper layer, regardless of any interface layers
|
# $upper_layers_overhangs[-1] contains the overhangs of the upper layer, regardless of any interface layers
|
||||||
|
Loading…
x
Reference in New Issue
Block a user