New separate option to control the addition of automatic extra perimeters. Also, add none if perimeters are set to 0. #459
This commit is contained in:
parent
f61a1f5a07
commit
410279823c
@ -160,6 +160,7 @@ The author is Alessandro Ranellucci.
|
|||||||
home X axis [G28 X], disable motors [M84]).
|
home X axis [G28 X], disable motors [M84]).
|
||||||
--layer-gcode Load layer-change G-code from the supplied file (default: nothing).
|
--layer-gcode Load layer-change G-code from the supplied file (default: nothing).
|
||||||
--support-material Generate support material for overhangs
|
--support-material Generate support material for overhangs
|
||||||
|
--extra-perimeters Add more perimeters when needed (default: yes)
|
||||||
--randomize-start Randomize starting point across layers (default: yes)
|
--randomize-start Randomize starting point across layers (default: yes)
|
||||||
|
|
||||||
Retraction options:
|
Retraction options:
|
||||||
|
@ -120,6 +120,7 @@ our $fill_pattern = 'rectilinear';
|
|||||||
our $solid_fill_pattern = 'rectilinear';
|
our $solid_fill_pattern = 'rectilinear';
|
||||||
our $fill_density = 0.4; # 1 = 100%
|
our $fill_density = 0.4; # 1 = 100%
|
||||||
our $fill_angle = 45;
|
our $fill_angle = 45;
|
||||||
|
our $extra_perimeters = 1;
|
||||||
our $randomize_start = 1;
|
our $randomize_start = 1;
|
||||||
our $support_material = 0;
|
our $support_material = 0;
|
||||||
our $support_material_tool = 0;
|
our $support_material_tool = 0;
|
||||||
|
@ -235,7 +235,7 @@ our $Options = {
|
|||||||
|
|
||||||
# print options
|
# print options
|
||||||
'perimeters' => {
|
'perimeters' => {
|
||||||
label => 'Perimeters (minimum)',
|
label => 'Perimeters',
|
||||||
cli => 'perimeters=i',
|
cli => 'perimeters=i',
|
||||||
type => 'i',
|
type => 'i',
|
||||||
aliases => [qw(perimeter_offsets)],
|
aliases => [qw(perimeter_offsets)],
|
||||||
@ -269,6 +269,11 @@ our $Options = {
|
|||||||
cli => 'fill-angle=i',
|
cli => 'fill-angle=i',
|
||||||
type => 'i',
|
type => 'i',
|
||||||
},
|
},
|
||||||
|
'extra_perimeters' => {
|
||||||
|
label => 'Generate extra perimeters when needed',
|
||||||
|
cli => 'extra-perimeters!',
|
||||||
|
type => 'bool',
|
||||||
|
},
|
||||||
'randomize_start' => {
|
'randomize_start' => {
|
||||||
label => 'Randomize starting points',
|
label => 'Randomize starting points',
|
||||||
cli => 'randomize-start!',
|
cli => 'randomize-start!',
|
||||||
|
@ -78,7 +78,7 @@ sub new {
|
|||||||
},
|
},
|
||||||
other => {
|
other => {
|
||||||
title => 'Other',
|
title => 'Other',
|
||||||
options => [$Slic3r::have_threads ? qw(threads) : ()],
|
options => [ ($Slic3r::have_threads ? qw(threads) : ()), qw(extra_perimeters) ],
|
||||||
},
|
},
|
||||||
notes => {
|
notes => {
|
||||||
title => 'Notes',
|
title => 'Notes',
|
||||||
@ -112,7 +112,7 @@ sub new {
|
|||||||
$make_tab->([qw(cooling)]),
|
$make_tab->([qw(cooling)]),
|
||||||
$make_tab->([qw(printer filament)], [qw(print_speed speed)]),
|
$make_tab->([qw(printer filament)], [qw(print_speed speed)]),
|
||||||
$make_tab->([qw(gcode)]),
|
$make_tab->([qw(gcode)]),
|
||||||
$make_tab->([qw(extrusion other sequential_printing)], [qw(output)]),
|
$make_tab->([qw(extrusion sequential_printing)], [qw(output other)]),
|
||||||
);
|
);
|
||||||
|
|
||||||
$tabpanel->AddPage(Slic3r::GUI::Plater->new($tabpanel), "Plater");
|
$tabpanel->AddPage(Slic3r::GUI::Plater->new($tabpanel), "Plater");
|
||||||
|
@ -170,53 +170,55 @@ sub make_perimeters {
|
|||||||
# one additional inner perimeter, like the top of domed objects-
|
# one additional inner perimeter, like the top of domed objects-
|
||||||
|
|
||||||
# this algorithm makes sure that almost one perimeter is overlapping
|
# this algorithm makes sure that almost one perimeter is overlapping
|
||||||
for my $layer_id (0 .. $self->layer_count-2) {
|
if ($Slic3r::extra_perimeters && $Slic3r::perimeters > 0) {
|
||||||
my $layer = $self->layers->[$layer_id];
|
for my $layer_id (0 .. $self->layer_count-2) {
|
||||||
my $upper_layer = $self->layers->[$layer_id+1];
|
my $layer = $self->layers->[$layer_id];
|
||||||
|
my $upper_layer = $self->layers->[$layer_id+1];
|
||||||
|
|
||||||
my $overlap = $layer->perimeters_flow->spacing; # one perimeter
|
my $overlap = $layer->perimeters_flow->spacing; # one perimeter
|
||||||
|
|
||||||
# compute polygons representing the thickness of the first external perimeter of
|
# compute polygons representing the thickness of the first external perimeter of
|
||||||
# the upper layer slices
|
# the upper layer slices
|
||||||
my $upper = diff_ex(
|
my $upper = diff_ex(
|
||||||
[ map @$_, map $_->expolygon->offset_ex(+ 0.5 * scale $layer->perimeters_flow->spacing), @{$upper_layer->slices} ],
|
[ map @$_, map $_->expolygon->offset_ex(+ 0.5 * scale $layer->perimeters_flow->spacing), @{$upper_layer->slices} ],
|
||||||
[ map @$_, map $_->expolygon->offset_ex(- scale($overlap) + (0.5 * scale $layer->perimeters_flow->spacing)), @{$upper_layer->slices} ],
|
[ map @$_, map $_->expolygon->offset_ex(- scale($overlap) + (0.5 * scale $layer->perimeters_flow->spacing)), @{$upper_layer->slices} ],
|
||||||
);
|
|
||||||
next if !@$upper;
|
|
||||||
|
|
||||||
# we need to limit our detection to the areas which would actually benefit from
|
|
||||||
# more perimeters. so, let's compute the area we want to ignore
|
|
||||||
my $ignore = [];
|
|
||||||
{
|
|
||||||
my $diff = diff_ex(
|
|
||||||
[ map @$_, map $_->expolygon->offset_ex(- ($Slic3r::perimeters-0.5) * scale $layer->perimeters_flow->spacing), @{$layer->slices} ],
|
|
||||||
[ map @{$_->expolygon}, @{$upper_layer->slices} ],
|
|
||||||
);
|
);
|
||||||
$ignore = [ map @$_, map $_->offset_ex(scale $layer->perimeters_flow->spacing), @$diff ];
|
next if !@$upper;
|
||||||
}
|
|
||||||
|
|
||||||
foreach my $slice (@{$layer->slices}) {
|
# we need to limit our detection to the areas which would actually benefit from
|
||||||
my $hypothetical_perimeter_num = $Slic3r::perimeters + 1;
|
# more perimeters. so, let's compute the area we want to ignore
|
||||||
CYCLE: while (1) {
|
my $ignore = [];
|
||||||
# compute polygons representing the thickness of the hypotetical new internal perimeter
|
{
|
||||||
# of our slice
|
my $diff = diff_ex(
|
||||||
my $hypothetical_perimeter;
|
[ map @$_, map $_->expolygon->offset_ex(- ($Slic3r::perimeters-0.5) * scale $layer->perimeters_flow->spacing), @{$layer->slices} ],
|
||||||
{
|
[ map @{$_->expolygon}, @{$upper_layer->slices} ],
|
||||||
my $outer = [ map @$_, $slice->expolygon->offset_ex(- ($hypothetical_perimeter_num-1.5) * scale $layer->perimeters_flow->spacing) ];
|
);
|
||||||
last CYCLE if !@$outer;
|
$ignore = [ map @$_, map $_->offset_ex(scale $layer->perimeters_flow->spacing), @$diff ];
|
||||||
my $inner = [ map @$_, $slice->expolygon->offset_ex(- ($hypothetical_perimeter_num-0.5) * scale $layer->perimeters_flow->spacing) ];
|
}
|
||||||
last CYCLE if !@$inner;
|
|
||||||
$hypothetical_perimeter = diff_ex($outer, $inner);
|
foreach my $slice (@{$layer->slices}) {
|
||||||
|
my $hypothetical_perimeter_num = $Slic3r::perimeters + 1;
|
||||||
|
CYCLE: while (1) {
|
||||||
|
# compute polygons representing the thickness of the hypotetical new internal perimeter
|
||||||
|
# of our slice
|
||||||
|
my $hypothetical_perimeter;
|
||||||
|
{
|
||||||
|
my $outer = [ map @$_, $slice->expolygon->offset_ex(- ($hypothetical_perimeter_num-1.5) * scale $layer->perimeters_flow->spacing) ];
|
||||||
|
last CYCLE if !@$outer;
|
||||||
|
my $inner = [ map @$_, $slice->expolygon->offset_ex(- ($hypothetical_perimeter_num-0.5) * scale $layer->perimeters_flow->spacing) ];
|
||||||
|
last CYCLE if !@$inner;
|
||||||
|
$hypothetical_perimeter = diff_ex($outer, $inner);
|
||||||
|
}
|
||||||
|
last CYCLE if !@$hypothetical_perimeter;
|
||||||
|
|
||||||
|
|
||||||
|
my $intersection = intersection_ex([ map @$_, @$upper ], [ map @$_, @$hypothetical_perimeter ]);
|
||||||
|
$intersection = diff_ex([ map @$_, @$intersection ], $ignore) if @$ignore;
|
||||||
|
last CYCLE if !@{ $intersection };
|
||||||
|
Slic3r::debugf " adding one more perimeter at layer %d\n", $layer_id;
|
||||||
|
$slice->additional_inner_perimeters(($slice->additional_inner_perimeters || 0) + 1);
|
||||||
|
$hypothetical_perimeter_num++;
|
||||||
}
|
}
|
||||||
last CYCLE if !@$hypothetical_perimeter;
|
|
||||||
|
|
||||||
|
|
||||||
my $intersection = intersection_ex([ map @$_, @$upper ], [ map @$_, @$hypothetical_perimeter ]);
|
|
||||||
$intersection = diff_ex([ map @$_, @$intersection ], $ignore) if @$ignore;
|
|
||||||
last CYCLE if !@{ $intersection };
|
|
||||||
Slic3r::debugf " adding one more perimeter at layer %d\n", $layer_id;
|
|
||||||
$slice->additional_inner_perimeters(($slice->additional_inner_perimeters || 0) + 1);
|
|
||||||
$hypothetical_perimeter_num++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,6 +205,7 @@ $j
|
|||||||
home X axis [G28 X], disable motors [M84]).
|
home X axis [G28 X], disable motors [M84]).
|
||||||
--layer-gcode Load layer-change G-code from the supplied file (default: nothing).
|
--layer-gcode Load layer-change G-code from the supplied file (default: nothing).
|
||||||
--support-material Generate support material for overhangs
|
--support-material Generate support material for overhangs
|
||||||
|
--extra-perimeters Add more perimeters when needed (default: yes)
|
||||||
--randomize-start Randomize starting point across layers (default: yes)
|
--randomize-start Randomize starting point across layers (default: yes)
|
||||||
|
|
||||||
Retraction options:
|
Retraction options:
|
||||||
|
Loading…
Reference in New Issue
Block a user