mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-09 14:55:08 -06:00
Turn fill_density into percentage
This commit is contained in:
parent
30aa255bb5
commit
7421a7bf63
11 changed files with 54 additions and 16 deletions
|
@ -119,6 +119,11 @@ sub _handle_legacy {
|
|||
if ($opt_key eq 'gcode_flavor' && $value eq 'makerbot') {
|
||||
$value = 'makerware';
|
||||
}
|
||||
if ($opt_key eq 'fill_density' && $value <= 1) {
|
||||
# fill_density was turned into a percent value
|
||||
$value *= 100;
|
||||
$value = "$value"; # force update of the PV value, workaround for bug https://rt.cpan.org/Ticket/Display.html?id=94110
|
||||
}
|
||||
|
||||
# For historical reasons, the world's full of configs having these very low values;
|
||||
# to avoid unexpected behavior we need to ignore them. Banning these two hard-coded
|
||||
|
@ -258,9 +263,9 @@ sub validate {
|
|||
|
||||
# --fill-density
|
||||
die "Invalid value for --fill-density\n"
|
||||
if $self->fill_density < 0 || $self->fill_density > 1;
|
||||
if $self->fill_density < 0 || $self->fill_density > 100;
|
||||
die "The selected fill pattern is not supposed to work at 100% density\n"
|
||||
if $self->fill_density == 1
|
||||
if $self->fill_density == 100
|
||||
&& !first { $_ eq $self->fill_pattern } @{$Options->{solid_fill_pattern}{values}};
|
||||
|
||||
# --infill-every-layers
|
||||
|
@ -343,10 +348,11 @@ sub validate {
|
|||
@values = ($self->$opt_key);
|
||||
}
|
||||
foreach my $value (@values) {
|
||||
if ($type eq 'i' || $type eq 'f') {
|
||||
if ($type eq 'i' || $type eq 'f' || $opt->{type} eq 'percent') {
|
||||
$value =~ s/%$// if $opt->{type} eq 'percent';
|
||||
die "Invalid value for $opt_key\n"
|
||||
if ($type eq 'i' && $value !~ /^-?\d+$/)
|
||||
|| ($type eq 'f' && $value !~ /^-?(?:\d+|\d*\.\d+)$/)
|
||||
|| (($type eq 'f' || $opt->{type} eq 'percent') && $value !~ /^-?(?:\d+|\d*\.\d+)$/)
|
||||
|| (defined $opt->{min} && $value < $opt->{min})
|
||||
|| (defined $opt->{max} && $value > $opt->{max});
|
||||
} elsif ($type eq 's' && $opt->{type} eq 'select') {
|
||||
|
|
|
@ -192,7 +192,7 @@ sub make_fill {
|
|||
|
||||
# force 100% density and rectilinear fill for external surfaces
|
||||
if ($surface->surface_type != S_TYPE_INTERNAL) {
|
||||
$density = 1;
|
||||
$density = 100;
|
||||
$filler = $layerm->config->solid_fill_pattern;
|
||||
if ($is_bridge) {
|
||||
$filler = 'rectilinear';
|
||||
|
@ -209,7 +209,7 @@ sub make_fill {
|
|||
$f->angle($layerm->config->fill_angle);
|
||||
my ($params, @polylines) = $f->fill_surface(
|
||||
$surface,
|
||||
density => $density,
|
||||
density => $density/100,
|
||||
flow => $flow,
|
||||
);
|
||||
next unless @polylines;
|
||||
|
|
|
@ -165,7 +165,7 @@ sub _build_field {
|
|||
|
||||
my $field;
|
||||
my $tooltip = $opt->{tooltip};
|
||||
if ($opt->{type} =~ /^(i|f|s|s@)$/) {
|
||||
if ($opt->{type} =~ /^(i|f|s|s@|percent)$/) {
|
||||
my $style = 0;
|
||||
$style = wxTE_MULTILINE if $opt->{multiline};
|
||||
# default width on Windows is too large
|
||||
|
|
|
@ -604,7 +604,7 @@ sub bridge_over_infill {
|
|||
|
||||
for my $region_id (0..$#{$self->print->regions}) {
|
||||
my $fill_density = $self->print->regions->[$region_id]->config->fill_density;
|
||||
next if $fill_density == 1 || $fill_density == 0;
|
||||
next if $fill_density == 100 || $fill_density == 0;
|
||||
|
||||
for my $layer_id (1..$#{$self->layers}) {
|
||||
my $layer = $self->layers->[$layer_id];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue