Fix regression causing default extrusion width to be ignored. #1958

This commit is contained in:
Alessandro Ranellucci 2014-04-25 19:39:27 +02:00
parent 924cb2e558
commit 7ac0095018
6 changed files with 21 additions and 14 deletions

View file

@ -207,6 +207,7 @@ sub make_fill {
$h,
$is_bridge,
$layerm->id == 0,
$layerm->object,
);
my $f = $self->filler($filler);

View file

@ -55,6 +55,7 @@ sub flow {
$bridge // 0,
$self->layer->id == 0,
$width,
$self->object,
);
}

View file

@ -818,21 +818,22 @@ sub write_gcode {
print $fh "; $_\n" foreach split /\R/, $self->config->notes;
print $fh "\n" if $self->config->notes;
my $layer_height = $self->objects->[0]->config->layer_height;
my $first_object = $self->objects->[0];
my $layer_height = $first_object->config->layer_height;
for my $region_id (0..$#{$self->regions}) {
printf $fh "; perimeters extrusion width = %.2fmm\n",
$self->regions->[$region_id]->flow(FLOW_ROLE_PERIMETER, $layer_height)->width;
$self->regions->[$region_id]->flow(FLOW_ROLE_PERIMETER, $layer_height, 0, 0, undef, $first_object)->width;
printf $fh "; infill extrusion width = %.2fmm\n",
$self->regions->[$region_id]->flow(FLOW_ROLE_INFILL, $layer_height)->width;
$self->regions->[$region_id]->flow(FLOW_ROLE_INFILL, $layer_height, 0, 0, undef, $first_object)->width;
printf $fh "; solid infill extrusion width = %.2fmm\n",
$self->regions->[$region_id]->flow(FLOW_ROLE_SOLID_INFILL, $layer_height)->width;
$self->regions->[$region_id]->flow(FLOW_ROLE_SOLID_INFILL, $layer_height, 0, 0, undef, $first_object)->width;
printf $fh "; top infill extrusion width = %.2fmm\n",
$self->regions->[$region_id]->flow(FLOW_ROLE_TOP_SOLID_INFILL, $layer_height)->width;
$self->regions->[$region_id]->flow(FLOW_ROLE_TOP_SOLID_INFILL, $layer_height, 0, 0, undef, $first_object)->width;
printf $fh "; support material extrusion width = %.2fmm\n",
$self->objects->[0]->support_material_flow->width
if $self->has_support_material;
printf $fh "; first layer extrusion width = %.2fmm\n",
$self->regions->[$region_id]->flow(FLOW_ROLE_PERIMETER, $layer_height, 0, 1)->width
$self->regions->[$region_id]->flow(FLOW_ROLE_PERIMETER, $layer_height, 0, 1, undef, $self->objects->[0])->width
if $self->regions->[$region_id]->config->first_layer_extrusion_width;
print $fh "\n";
}

View file

@ -1006,7 +1006,7 @@ sub support_material_flow {
# we use a bogus layer_height because we use the same flow for all
# support material layers
return Slic3r::Flow->new_from_width(
width => $self->config->support_material_extrusion_width,
width => $self->config->support_material_extrusion_width || $self->config->extrusion_width,
role => $role,
nozzle_diameter => $self->print->config->nozzle_diameter->[$extruder-1] // $self->print->config->nozzle_diameter->[0],
layer_height => $self->config->layer_height,

View file

@ -11,7 +11,7 @@ has 'print' => (is => 'ro', required => 1, weak_ref => 1);
has 'config' => (is => 'ro', default => sub { Slic3r::Config::PrintRegion->new});
sub flow {
my ($self, $role, $layer_height, $bridge, $first_layer, $width) = @_;
my ($self, $role, $layer_height, $bridge, $first_layer, $width, $object) = @_;
$bridge //= 0;
$first_layer //= 0;
@ -35,6 +35,10 @@ sub flow {
die "Unknown role $role";
}
}
if ($config_width eq '0') {
use XXX; ZZZ "Here" if !defined $object;
$config_width = $object->config->extrusion_width;
}
# get the configured nozzle_diameter for the extruder associated
# to the flow role requested

View file

@ -318,7 +318,7 @@ class PrintConfigDef
Options["first_layer_extrusion_width"].type = coFloatOrPercent;
Options["first_layer_extrusion_width"].label = "First layer";
Options["first_layer_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for first layer. You can use this to force fatter extrudates for better adhesion. If expressed as percentage (for example 120%) if will be computed over first layer height.";
Options["first_layer_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for first layer. You can use this to force fatter extrudates for better adhesion. If expressed as percentage (for example 120%) it will be computed over first layer height.";
Options["first_layer_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
Options["first_layer_extrusion_width"].cli = "first-layer-extrusion-width=s";
Options["first_layer_extrusion_width"].ratio_over = "first_layer_height";
@ -409,7 +409,7 @@ class PrintConfigDef
Options["infill_extrusion_width"].type = coFloatOrPercent;
Options["infill_extrusion_width"].label = "Infill";
Options["infill_extrusion_width"].category = "Extrusion Width";
Options["infill_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for infill. You may want to use fatter extrudates to speed up the infill and make your parts stronger. If expressed as percentage (for example 90%) if will be computed over layer height.";
Options["infill_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for infill. You may want to use fatter extrudates to speed up the infill and make your parts stronger. If expressed as percentage (for example 90%) it will be computed over layer height.";
Options["infill_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
Options["infill_extrusion_width"].cli = "infill-extrusion-width=s";
@ -534,7 +534,7 @@ class PrintConfigDef
Options["perimeter_extrusion_width"].type = coFloatOrPercent;
Options["perimeter_extrusion_width"].label = "Perimeters";
Options["perimeter_extrusion_width"].category = "Extrusion Width";
Options["perimeter_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for perimeters. You may want to use thinner extrudates to get more accurate surfaces. If expressed as percentage (for example 90%) if will be computed over layer height.";
Options["perimeter_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for perimeters. You may want to use thinner extrudates to get more accurate surfaces. If expressed as percentage (for example 90%) it will be computed over layer height.";
Options["perimeter_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
Options["perimeter_extrusion_width"].cli = "perimeter-extrusion-width=s";
Options["perimeter_extrusion_width"].aliases.push_back("perimeters_extrusion_width");
@ -701,7 +701,7 @@ class PrintConfigDef
Options["solid_infill_extrusion_width"].type = coFloatOrPercent;
Options["solid_infill_extrusion_width"].label = "Solid infill";
Options["solid_infill_extrusion_width"].category = "Extrusion Width";
Options["solid_infill_extrusion_width"].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.";
Options["solid_infill_extrusion_width"].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%) it will be computed over layer height.";
Options["solid_infill_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
Options["solid_infill_extrusion_width"].cli = "solid-infill-extrusion-width=s";
@ -782,7 +782,7 @@ class PrintConfigDef
Options["support_material_extrusion_width"].type = coFloatOrPercent;
Options["support_material_extrusion_width"].label = "Support material";
Options["support_material_extrusion_width"].category = "Extrusion Width";
Options["support_material_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for support material. If expressed as percentage (for example 90%) if will be computed over layer height.";
Options["support_material_extrusion_width"].tooltip = "Set this to a non-zero value to set a manual extrusion width for support material. If expressed as percentage (for example 90%) it will be computed over layer height.";
Options["support_material_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
Options["support_material_extrusion_width"].cli = "support-material-extrusion-width=s";
@ -878,7 +878,7 @@ class PrintConfigDef
Options["top_infill_extrusion_width"].type = coFloatOrPercent;
Options["top_infill_extrusion_width"].label = "Top solid infill";
Options["top_infill_extrusion_width"].category = "Extrusion Width";
Options["top_infill_extrusion_width"].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.";
Options["top_infill_extrusion_width"].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%) it will be computed over layer height.";
Options["top_infill_extrusion_width"].sidetext = "mm or % (leave 0 for default)";
Options["top_infill_extrusion_width"].cli = "top-infill-extrusion-width=s";