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:
Joseph Lenox 2019-01-05 18:45:59 -06:00 committed by GitHub
parent 39b157b4f8
commit b84be0deb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -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
{

View File

@ -267,7 +267,11 @@ sub _update_canvas_size {
my @size = ($canvas_w - 2*$padding, $canvas_h - 2*$padding);
$self->{canvas_size} = [@size];
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};
}

View File

@ -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);
}