Skip to content

Commit

Permalink
Keep bridge flow unchanged even with the new overlapping spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
alranel committed Nov 18, 2012
1 parent 8d557be commit 427e3c1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/Slic3r/Fill.pm
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ sub make_fill {
$filler = $Slic3r::Config->solid_fill_pattern;
if ($is_bridge) {
$filler = 'rectilinear';
my $width = sqrt($Slic3r::Config->bridge_flow_ratio * ($layer->infill_flow->nozzle_diameter**2));
$flow_spacing = $width + &Slic3r::OVERLAP_FACTOR * ($width * PI / 4 - $width); # this should be moved to Flow.pm
$flow_spacing = $layer->infill_flow->bridge_spacing;
} elsif ($surface->surface_type == S_TYPE_INTERNALSOLID) {
$filler = 'rectilinear';
}
Expand All @@ -157,6 +156,9 @@ sub make_fill {
}
my $params = shift @paths;

# ugly hack(tm) to get the right amount of flow (GCode.pm should be fixed)
$params->{flow_spacing} = $layer->infill_flow->bridge_width if $is_bridge;

# save into layer
next unless @paths;
push @fills, Slic3r::ExtrusionPath::Collection->new(
Expand Down
13 changes: 13 additions & 0 deletions lib/Slic3r/Flow.pm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ has 'layer_height' => (is => 'ro', default => sub { $Slic3r::Config->layer_

has 'width' => (is => 'rwp', builder => 1);
has 'spacing' => (is => 'lazy');
has 'bridge_width' => (is => 'lazy');
has 'bridge_spacing' => (is => 'lazy');
has 'scaled_width' => (is => 'lazy');
has 'scaled_spacing' => (is => 'lazy');

Expand Down Expand Up @@ -67,6 +69,17 @@ sub clone {
);
}

sub _build_bridge_width {
my $self = shift;
return sqrt($Slic3r::Config->bridge_flow_ratio * ($self->nozzle_diameter**2));
}

sub _build_bridge_spacing {
my $self = shift;
my $width = $self->bridge_width;
return $width + &Slic3r::OVERLAP_FACTOR * ($width * PI / 4 - $width);
}

sub _build_scaled_width {
my $self = shift;
return scale $self->width;
Expand Down

0 comments on commit 427e3c1

Please sign in to comment.