New --resolution option to simplify input models
This commit is contained in:
parent
10b6bc9d15
commit
cf5adca928
@ -289,6 +289,7 @@ The author of the Silk icon set is Mark James.
|
||||
|
||||
Miscellaneous options:
|
||||
--notes Notes to be added as comments to the output file
|
||||
--resolution Minimum detail resolution (mm, set zero for full resolution, default: 0)
|
||||
|
||||
Flow options (advanced):
|
||||
--extrusion-width Set extrusion width manually; it accepts either an absolute value in mm
|
||||
|
@ -37,6 +37,15 @@ our $Options = {
|
||||
default => $Slic3r::have_threads ? 2 : 1,
|
||||
readonly => !$Slic3r::have_threads,
|
||||
},
|
||||
'resolution' => {
|
||||
label => 'Resolution',
|
||||
tooltip => 'Minimum detail resolution, used to simplify the input file for speeding up the slicing job and reducing memory usage. High-resolution models often carry more detail than printers can render. Set to zero to disable any simplification and use full resolution from input.',
|
||||
sidetext => 'mm',
|
||||
cli => 'resolution=f',
|
||||
type => 'f',
|
||||
min => 0,
|
||||
default => 0,
|
||||
},
|
||||
|
||||
# output options
|
||||
'output_filename_format' => {
|
||||
|
@ -517,10 +517,10 @@ sub build {
|
||||
title => 'Flow',
|
||||
options => [qw(bridge_flow_ratio)],
|
||||
},
|
||||
$Slic3r::have_threads ? {
|
||||
{
|
||||
title => 'Other',
|
||||
options => [qw(threads)],
|
||||
} : (),
|
||||
options => [($Slic3r::have_threads ? qw(threads) : ()), qw(resolution)],
|
||||
},
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -313,6 +313,16 @@ sub size {
|
||||
return [ $bb[X2] - $bb[X1], $bb[Y2] - $bb[Y1] ];
|
||||
}
|
||||
|
||||
sub _simplify_slices {
|
||||
my $self = shift;
|
||||
my ($distance) = @_;
|
||||
|
||||
foreach my $layer (map @{$_->layers}, @{$self->objects}) {
|
||||
@$_ = map $_->simplify($distance), @$_
|
||||
for $layer->slices, (map $_->slices, @{$layer->regions});
|
||||
}
|
||||
}
|
||||
|
||||
sub export_gcode {
|
||||
my $self = shift;
|
||||
my %params = @_;
|
||||
@ -326,6 +336,11 @@ sub export_gcode {
|
||||
$status_cb->(10, "Processing triangulated mesh");
|
||||
$_->slice for @{$self->objects};
|
||||
|
||||
if ($Slic3r::Config->resolution) {
|
||||
$status_cb->(15, "Simplifying input");
|
||||
$self->_simplify_slices(scale $Slic3r::Config->resolution);
|
||||
}
|
||||
|
||||
# make perimeters
|
||||
# this will add a set of extrusion loops to each layer
|
||||
# as well as generate infill boundaries
|
||||
@ -334,10 +349,7 @@ sub export_gcode {
|
||||
|
||||
# simplify slices (both layer and region slices),
|
||||
# we only need the max resolution for perimeters
|
||||
foreach my $layer (map @{$_->layers}, @{$self->objects}) {
|
||||
@$_ = map $_->simplify(&Slic3r::SCALED_RESOLUTION), @$_
|
||||
for $layer->slices, (map $_->slices, @{$layer->regions});
|
||||
}
|
||||
$self->_simplify_slices(&Slic3r::SCALED_RESOLUTION);
|
||||
|
||||
# this will assign a type (top/bottom/internal) to $layerm->slices
|
||||
# and transform $layerm->fill_surfaces from expolygon
|
||||
|
@ -342,6 +342,7 @@ $j
|
||||
|
||||
Miscellaneous options:
|
||||
--notes Notes to be added as comments to the output file
|
||||
--resolution Minimum detail resolution (mm, set zero for full resolution, default: $config->{resolution})
|
||||
|
||||
Flow options (advanced):
|
||||
--extrusion-width Set extrusion width manually; it accepts either an absolute value in mm
|
||||
|
Loading…
Reference in New Issue
Block a user