Browse Source

Keep bridge flow unchanged even with the new overlapping spacing

Alessandro Ranellucci 12 years ago
parent
commit
427e3c1720
2 changed files with 17 additions and 2 deletions
  1. 4 2
      lib/Slic3r/Fill.pm
  2. 13 0
      lib/Slic3r/Flow.pm

+ 4 - 2
lib/Slic3r/Fill.pm

@@ -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';
             }
@@ -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(

+ 13 - 0
lib/Slic3r/Flow.pm

@@ -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');
 
@@ -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;