mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-13 21:35:56 +08:00
Fix division by zero when min=max layer heights (#4672)
* #4670 Avoid a division by 0 crash if max_layer_height == min_layer_height (use scaling of 1.0). * #4670 Limits -> Layer Height Limits * Add config validation to Config.pm for adaptive slicing * Also cover min_layer_height >= max_layer_height * Correct logic for min/max layer height.
This commit is contained in:
parent
39b157b4f8
commit
b84be0deb5
@ -270,6 +270,9 @@ sub validate {
|
||||
die "Spiral vase mode is not compatible with support material\n"
|
||||
if $self->support_material || $self->support_material_enforce_layers > 0;
|
||||
}
|
||||
# --min-layer-height and --max-layer-height
|
||||
die "Max layer height should be greater than min layer height."
|
||||
if $self->adaptive_slicing && ($self->max_layer_height < $self->min_layer_height);
|
||||
|
||||
# extrusion widths
|
||||
{
|
||||
|
@ -267,7 +267,11 @@ sub _update_canvas_size {
|
||||
my @size = ($canvas_w - 2*$padding, $canvas_h - 2*$padding);
|
||||
$self->{canvas_size} = [@size];
|
||||
|
||||
$self->{scaling_factor_x} = $size[0]/($self->{max_layer_height} - $self->{min_layer_height});
|
||||
if ($self->{max_layer_height} > $self->{min_layer_height}) {
|
||||
$self->{scaling_factor_x} = $size[0]/($self->{max_layer_height} - $self->{min_layer_height});
|
||||
} else {
|
||||
$self->{scaling_factor_x} = 1.0;
|
||||
}
|
||||
$self->{scaling_factor_y} = $size[1]/$self->{object_height};
|
||||
}
|
||||
|
||||
|
@ -1534,7 +1534,7 @@ sub _build_extruder_pages {
|
||||
$optgroup->append_single_option_line('nozzle_diameter', $extruder_idx);
|
||||
}
|
||||
{
|
||||
my $optgroup = $page->new_optgroup('Limits');
|
||||
my $optgroup = $page->new_optgroup('Layer Height Limits');
|
||||
$optgroup->append_single_option_line($_, $extruder_idx)
|
||||
for qw(min_layer_height max_layer_height);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user