New --solid-infill-extrusion-width option

This commit is contained in:
Alessandro Ranellucci 2013-03-17 00:02:31 +01:00
parent c13d9e9fb3
commit 35bd5a3423
8 changed files with 36 additions and 19 deletions

View File

@ -300,6 +300,8 @@ The author of the Silk icon set is Mark James.
Set a different extrusion width for perimeters Set a different extrusion width for perimeters
--infill-extrusion-width --infill-extrusion-width
Set a different extrusion width for infill Set a different extrusion width for infill
--solid-infill-extrusion-width
Set a different extrusion width for solid infill
--top-infill-extrusion-width --top-infill-extrusion-width
Set a different extrusion width for top infill Set a different extrusion width for top infill
--support-material-extrusion-width --support-material-extrusion-width

View File

@ -446,8 +446,16 @@ our $Options = {
type => 'f', type => 'f',
default => 0, default => 0,
}, },
'solid_infill_extrusion_width' => {
label => 'Solid infill',
tooltip => 'Set this to a non-zero value to set a manual extrusion width for infill for solid surfaces. If expressed as percentage (for example 90%) if will be computed over layer height.',
sidetext => 'mm or % (leave 0 for default)',
cli => 'solid-infill-extrusion-width=s',
type => 'f',
default => 0,
},
'top_infill_extrusion_width' => { 'top_infill_extrusion_width' => {
label => 'Top infill', label => 'Top solid infill',
tooltip => 'Set this to a non-zero value to set a manual extrusion width for infill for top surfaces. You may want to use thinner extrudates to fill all narrow regions and get a smoother finish. If expressed as percentage (for example 90%) if will be computed over layer height.', tooltip => 'Set this to a non-zero value to set a manual extrusion width for infill for top surfaces. You may want to use thinner extrudates to fill all narrow regions and get a smoother finish. If expressed as percentage (for example 90%) if will be computed over layer height.',
sidetext => 'mm or % (leave 0 for default)', sidetext => 'mm or % (leave 0 for default)',
cli => 'top-infill-extrusion-width=s', cli => 'top-infill-extrusion-width=s',

View File

@ -100,7 +100,7 @@ sub make_fill {
# add spacing between surfaces # add spacing between surfaces
{ {
my $distance = $layerm->infill_flow->scaled_spacing / 2; my $distance = $layerm->solid_infill_flow->scaled_spacing / 2;
@surfaces = map $_->offset(-$distance), @surfaces; @surfaces = map $_->offset(-$distance), @surfaces;
} }
@ -109,9 +109,12 @@ sub make_fill {
SURFACE: foreach my $surface (@surfaces) { SURFACE: foreach my $surface (@surfaces) {
my $filler = $Slic3r::Config->fill_pattern; my $filler = $Slic3r::Config->fill_pattern;
my $density = $Slic3r::Config->fill_density; my $density = $Slic3r::Config->fill_density;
my $flow_spacing = ($surface->surface_type == S_TYPE_TOP) my $flow = ($surface->surface_type == S_TYPE_TOP)
? $layerm->top_infill_flow->spacing ? $layerm->top_infill_flow
: $layerm->infill_flow->spacing; : $surface->is_solid
? $layerm->solid_infill_flow
: $layerm->infill_flow;
my $flow_spacing = $flow->spacing;
my $is_bridge = $layerm->id > 0 && $surface->is_bridge; my $is_bridge = $layerm->id > 0 && $surface->is_bridge;
my $is_solid = $surface->is_solid; my $is_solid = $surface->is_solid;

View File

@ -511,7 +511,7 @@ sub build {
{ {
title => 'Extrusion width', title => 'Extrusion width',
label_width => 180, label_width => 180,
options => [qw(extrusion_width first_layer_extrusion_width perimeter_extrusion_width infill_extrusion_width top_infill_extrusion_width support_material_extrusion_width)], options => [qw(extrusion_width first_layer_extrusion_width perimeter_extrusion_width infill_extrusion_width solid_infill_extrusion_width top_infill_extrusion_width support_material_extrusion_width)],
}, },
{ {
title => 'Flow', title => 'Flow',

View File

@ -16,6 +16,7 @@ has 'layer' => (
has 'region' => (is => 'ro', required => 1, handles => [qw(extruders)]); has 'region' => (is => 'ro', required => 1, handles => [qw(extruders)]);
has 'perimeter_flow' => (is => 'rw'); has 'perimeter_flow' => (is => 'rw');
has 'infill_flow' => (is => 'rw'); has 'infill_flow' => (is => 'rw');
has 'solid_infill_flow' => (is => 'rw');
has 'top_infill_flow' => (is => 'rw'); has 'top_infill_flow' => (is => 'rw');
has 'infill_area_threshold' => (is => 'lazy'); has 'infill_area_threshold' => (is => 'lazy');
has 'overhang_width' => (is => 'lazy'); has 'overhang_width' => (is => 'lazy');
@ -59,15 +60,15 @@ sub _update_flows {
return if !$self->region; return if !$self->region;
if ($self->id == 0) { if ($self->id == 0) {
$self->perimeter_flow for (qw(perimeter infill solid_infill top_infill)) {
($self->region->first_layer_flows->{perimeter} || $self->region->flows->{perimeter}); my $method = "${_}_flow";
$self->infill_flow $self->$method
($self->region->first_layer_flows->{infill} || $self->region->flows->{infill}); ($self->region->first_layer_flows->{$_} || $self->region->flows->{$_});
$self->top_infill_flow }
($self->region->first_layer_flows->{top_infill} || $self->region->flows->{top_infill});
} else { } else {
$self->perimeter_flow($self->region->flows->{perimeter}); $self->perimeter_flow($self->region->flows->{perimeter});
$self->infill_flow($self->region->flows->{infill}); $self->infill_flow($self->region->flows->{infill});
$self->solid_infill_flow($self->region->flows->{solid_infill});
$self->top_infill_flow($self->region->flows->{top_infill}); $self->top_infill_flow($self->region->flows->{top_infill});
} }
} }
@ -80,7 +81,7 @@ sub _build_overhang_width {
sub _build_infill_area_threshold { sub _build_infill_area_threshold {
my $self = shift; my $self = shift;
return $self->infill_flow->scaled_spacing ** 2; return $self->solid_infill_flow->scaled_spacing ** 2;
} }
# build polylines from lines # build polylines from lines
@ -160,7 +161,7 @@ sub make_perimeters {
my $self = shift; my $self = shift;
my $perimeter_spacing = $self->perimeter_flow->scaled_spacing; my $perimeter_spacing = $self->perimeter_flow->scaled_spacing;
my $infill_spacing = $self->infill_flow->scaled_spacing; my $infill_spacing = $self->solid_infill_flow->scaled_spacing;
my $gap_area_threshold = $self->perimeter_flow->scaled_width ** 2; my $gap_area_threshold = $self->perimeter_flow->scaled_width ** 2;
# this array will hold one arrayref per original surface (island); # this array will hold one arrayref per original surface (island);

View File

@ -201,8 +201,9 @@ sub init_extruders {
my $region = $self->regions->[$region_id]; my $region = $self->regions->[$region_id];
# per-role extruders and flows # per-role extruders and flows
for (qw(perimeter infill top_infill)) { for (qw(perimeter infill solid_infill top_infill)) {
my $extruder_name = $_ eq 'top_infill' ? 'infill' : $_; my $extruder_name = $_;
$extruder_name =~ s/^(?:solid|top)_//;
$region->extruders->{$_} = ($self->regions_count > 1) $region->extruders->{$_} = ($self->regions_count > 1)
? $self->extruders->[$extruder_mapping{$region_id}] ? $self->extruders->[$extruder_mapping{$region_id}]
: $self->extruders->[$self->config->get("${extruder_name}_extruder")-1]; : $self->extruders->[$self->config->get("${extruder_name}_extruder")-1];

View File

@ -581,7 +581,7 @@ sub discover_horizontal_shells {
# make sure the new internal solid is wide enough, as it might get collapsed when # make sure the new internal solid is wide enough, as it might get collapsed when
# spacing is added in Fill.pm # spacing is added in Fill.pm
{ {
my $margin = 3 * $layerm->infill_flow->scaled_width; # require at least this size my $margin = 3 * $layerm->solid_infill_flow->scaled_width; # require at least this size
my $too_narrow = diff_ex( my $too_narrow = diff_ex(
[ map @$_, @$new_internal_solid ], [ map @$_, @$new_internal_solid ],
[ offset([ offset([ map @$_, @$new_internal_solid ], -$margin) ], +$margin) ], [ offset([ offset([ map @$_, @$new_internal_solid ], -$margin) ], +$margin) ],
@ -708,12 +708,12 @@ sub combine_infill {
# so let's remove those areas from all layers # so let's remove those areas from all layers
my @intersection_with_clearance = map $_->offset( my @intersection_with_clearance = map $_->offset(
$layerms[-1]->infill_flow->scaled_width / 2 $layerms[-1]->solid_infill_flow->scaled_width / 2
+ $layerms[-1]->perimeter_flow->scaled_width / 2 + $layerms[-1]->perimeter_flow->scaled_width / 2
# Because fill areas for rectilinear and honeycomb are grown # Because fill areas for rectilinear and honeycomb are grown
# later to overlap perimeters, we need to counteract that too. # later to overlap perimeters, we need to counteract that too.
+ (($type == S_TYPE_INTERNALSOLID || $Slic3r::Config->fill_pattern =~ /(rectilinear|honeycomb)/) + (($type == S_TYPE_INTERNALSOLID || $Slic3r::Config->fill_pattern =~ /(rectilinear|honeycomb)/)
? $layerms[-1]->infill_flow->scaled_width * &Slic3r::PERIMETER_INFILL_OVERLAP_OVER_SPACING ? $layerms[-1]->solid_infill_flow->scaled_width * &Slic3r::PERIMETER_INFILL_OVERLAP_OVER_SPACING
: 0) : 0)
), @$intersection; ), @$intersection;

View File

@ -353,6 +353,8 @@ $j
Set a different extrusion width for perimeters Set a different extrusion width for perimeters
--infill-extrusion-width --infill-extrusion-width
Set a different extrusion width for infill Set a different extrusion width for infill
--solid-infill-extrusion-width
Set a different extrusion width for solid infill
--top-infill-extrusion-width --top-infill-extrusion-width
Set a different extrusion width for top infill Set a different extrusion width for top infill
--support-material-extrusion-width --support-material-extrusion-width