Fix for incomplete extrusion on solid surfaces

This commit is contained in:
Alessandro Ranellucci 2014-04-05 10:54:24 +02:00
parent d2a6194960
commit d6d6a51e0d
5 changed files with 26 additions and 13 deletions

View File

@ -182,11 +182,9 @@ sub make_fill {
next if $surface->surface_type == S_TYPE_INTERNALVOID; next if $surface->surface_type == S_TYPE_INTERNALVOID;
my $filler = $layerm->config->fill_pattern; my $filler = $layerm->config->fill_pattern;
my $density = $fill_density; my $density = $fill_density;
my $flow = ($surface->surface_type == S_TYPE_TOP) my $role = ($surface->surface_type == S_TYPE_TOP) ? FLOW_ROLE_TOP_SOLID_INFILL
? $layerm->flow(FLOW_ROLE_TOP_SOLID_INFILL) : $surface->is_solid ? FLOW_ROLE_SOLID_INFILL
: $surface->is_solid : FLOW_ROLE_INFILL;
? $solid_infill_flow
: $infill_flow;
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;
@ -196,7 +194,6 @@ sub make_fill {
$filler = $layerm->config->solid_fill_pattern; $filler = $layerm->config->solid_fill_pattern;
if ($is_bridge) { if ($is_bridge) {
$filler = 'rectilinear'; $filler = 'rectilinear';
$flow = $layerm->flow(FLOW_ROLE_SOLID_INFILL, 1);
} elsif ($surface->surface_type == S_TYPE_INTERNALSOLID) { } elsif ($surface->surface_type == S_TYPE_INTERNALSOLID) {
$filler = 'rectilinear'; $filler = 'rectilinear';
} }
@ -204,19 +201,26 @@ sub make_fill {
next SURFACE unless $density > 0; next SURFACE unless $density > 0;
} }
my $h = $surface->thickness == -1 ? $layerm->height : $surface->thickness;
my $flow = $layerm->region->flow(
$role,
$h,
$is_bridge,
$layerm->id == 0,
);
my $f = $self->filler($filler); my $f = $self->filler($filler);
$f->layer_id($layerm->id); $f->layer_id($layerm->id);
$f->angle($layerm->config->fill_angle); $f->angle($layerm->config->fill_angle);
my ($params, @polylines) = $f->fill_surface( my ($params, @polylines) = $f->fill_surface(
$surface, $surface,
density => $density/100, density => $density/100,
flow => $flow, flow => $flow,
layer_height => $h,
); );
next unless @polylines; next unless @polylines;
my $h = $surface->thickness; my $mm3_per_mm = $flow->mm3_per_mm($h);
$h = $layerm->height if $h == -1;
my $mm3_per_mm = $params->{flow}->mm3_per_mm($h);
# save into layer # save into layer
push @fills, my $collection = Slic3r::ExtrusionPath::Collection->new; push @fills, my $collection = Slic3r::ExtrusionPath::Collection->new;

View File

@ -33,7 +33,7 @@ sub fill_surface {
$flow = Slic3r::Flow->new_from_spacing( $flow = Slic3r::Flow->new_from_spacing(
spacing => unscale($line_spacing), spacing => unscale($line_spacing),
nozzle_diameter => $flow->nozzle_diameter, nozzle_diameter => $flow->nozzle_diameter,
layer_height => $surface->thickness, layer_height => ($params{layer_height} or die "No layer_height supplied to fill_surface()"),
bridge => $flow->bridge, bridge => $flow->bridge,
); );
} else { } else {

View File

@ -552,6 +552,7 @@ sub generate_toolpaths {
Slic3r::Surface->new(expolygon => $expolygon, surface_type => S_TYPE_INTERNAL), Slic3r::Surface->new(expolygon => $expolygon, surface_type => S_TYPE_INTERNAL),
density => $interface_density, density => $interface_density,
flow => $interface_flow, flow => $interface_flow,
layer_height => $layer->height,
complete => 1, complete => 1,
); );
my $mm3_per_mm = $params->{flow}->mm3_per_mm($layer->height); my $mm3_per_mm = $params->{flow}->mm3_per_mm($layer->height);
@ -602,6 +603,7 @@ sub generate_toolpaths {
Slic3r::Surface->new(expolygon => $expolygon, surface_type => S_TYPE_INTERNAL), Slic3r::Surface->new(expolygon => $expolygon, surface_type => S_TYPE_INTERNAL),
density => $density, density => $density,
flow => $base_flow, flow => $base_flow,
layer_height => $layer->height,
complete => 1, complete => 1,
); );
my $mm3_per_mm = $params->{flow}->mm3_per_mm($layer->height); my $mm3_per_mm = $params->{flow}->mm3_per_mm($layer->height);

View File

@ -51,7 +51,7 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
); );
foreach my $angle (0, 45) { foreach my $angle (0, 45) {
$surface->expolygon->rotate(Slic3r::Geometry::deg2rad($angle), [0,0]); $surface->expolygon->rotate(Slic3r::Geometry::deg2rad($angle), [0,0]);
my ($params, @paths) = $filler->fill_surface($surface, flow => $flow, density => 0.4); my ($params, @paths) = $filler->fill_surface($surface, flow => $flow, layer_height => 0.4, density => 0.4);
is scalar @paths, 1, 'one continuous path'; is scalar @paths, 1, 'one continuous path';
} }
} }
@ -76,6 +76,7 @@ sub scale_points (@) { map [scale $_->[X], scale $_->[Y]], @_ }
my ($params, @paths) = $filler->fill_surface( my ($params, @paths) = $filler->fill_surface(
$surface, $surface,
flow => $flow, flow => $flow,
layer_height => 0.4,
density => $density // 1, density => $density // 1,
); );

View File

@ -5,6 +5,9 @@ namespace Slic3r {
Flow Flow
Flow::new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent &width, float nozzle_diameter, float height, float bridge_flow_ratio) { Flow::new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent &width, float nozzle_diameter, float height, float bridge_flow_ratio) {
// we need layer height unless it's a bridge
if (height <= 0 && bridge_flow_ratio == 0) CONFESS("Invalid flow height supplied to new_from_config_width()");
float w; float w;
if (!width.percent && width.value == 0) { if (!width.percent && width.value == 0) {
w = Flow::_width(role, nozzle_diameter, height, bridge_flow_ratio); w = Flow::_width(role, nozzle_diameter, height, bridge_flow_ratio);
@ -19,6 +22,9 @@ Flow::new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent &wid
Flow Flow
Flow::new_from_spacing(float spacing, float nozzle_diameter, float height, bool bridge) { Flow::new_from_spacing(float spacing, float nozzle_diameter, float height, bool bridge) {
// we need layer height unless it's a bridge
if (height <= 0 && !bridge) CONFESS("Invalid flow height supplied to new_from_spacing()");
float w = Flow::_width_from_spacing(spacing, nozzle_diameter, height, bridge); float w = Flow::_width_from_spacing(spacing, nozzle_diameter, height, bridge);
Flow flow(w, spacing, nozzle_diameter); Flow flow(w, spacing, nozzle_diameter);
flow.bridge = bridge; flow.bridge = bridge;