Skip to content

Commit

Permalink
New --bridge-feed-rate option. slic3r#68
Browse files Browse the repository at this point in the history
  • Loading branch information
alranel committed Nov 28, 2011
1 parent 7b50e1b commit 975387d
Show file tree
Hide file tree
Showing 12 changed files with 47 additions and 17 deletions.
15 changes: 11 additions & 4 deletions README.markdown
Expand Up @@ -94,19 +94,23 @@ The author is Alessandro Ranellucci (me).
(+/-, default: 0)
--gcode-arcs Use G2/G3 commands for native arcs (experimental, not supported
by all firmwares)
--g0 Use G0 commands for retraction (experimenta, not supported by all
firmwares)
Filament options:
--filament-diameter Diameter in mm of your raw filament (default: 3)
--filament-packing-density
Ratio of the extruded volume over volume pushed
into the extruder (default: 1)
--temperature Extrusion temperature (default: 200)
--extrusion-multiplier
Change this to alter the amount of plastic extruded. There should be
very little need to change this value, which is only useful to
compensate for filament packing (default: 1)
--temperature Extrusion temperature, set 0 to disable (default: 200)
Speed options:
--print-feed-rate Speed of print moves in mm/sec (default: 60)
--travel-feed-rate Speed of non-print moves in mm/sec (default: 130)
--perimeter-feed-rate
Speed of print moves for perimeters in mm/sec (default: 60)
--bridge-feed-rate Speed of bridge print moves in mm/sec (default: 60)
--bottom-layer-speed-ratio
Factor to increase/decrease speeds on bottom
layer by (default: 0.3)
Expand All @@ -118,6 +122,9 @@ The author is Alessandro Ranellucci (me).
layer with (> 0, default: 1)
--infill-every-layers
Infill every N layers (default: 1)
--extrusion-width-ratio
Calculate the extrusion width as the layer height multiplied by
this value (> 0, default: calculated automatically)
Print options:
--perimeters Number of perimeters/horizontal skins (range: 1+,
Expand Down
1 change: 1 addition & 0 deletions lib/Slic3r.pm
Expand Up @@ -50,6 +50,7 @@ our $temperature = 200;
our $print_feed_rate = 60; # mm/sec
our $travel_feed_rate = 130; # mm/sec
our $perimeter_feed_rate = 30; # mm/sec
our $bridge_feed_rate = 60; # mm/sec
our $bottom_layer_speed_ratio = 0.3;

# accuracy options
Expand Down
7 changes: 7 additions & 0 deletions lib/Slic3r/Config.pm
Expand Up @@ -59,6 +59,10 @@ our $Options = {
label => 'Perimeter feed rate (mm/s)',
type => 'f',
},
'bridge_feed_rate' => {
label => 'Bridge feed rate (mm/s)',
type => 'f',
},
'bottom_layer_speed_ratio' => {
label => 'Bottom layer ratio',
type => 'f',
Expand Down Expand Up @@ -351,6 +355,9 @@ sub validate {
# --skirt-height
die "Invalid value for --skirt-height\n"
if $Slic3r::skirt_height < 1;

# legacy with existing config files
$Slic3r::bridge_feed_rate ||= $Slic3r::print_feed_rate;
}

1;
5 changes: 4 additions & 1 deletion lib/Slic3r/ExtrusionLoop.pm
Expand Up @@ -5,6 +5,9 @@ use XXX;

extends 'Slic3r::Polyline::Closed';

# perimeter/fill/bridge/skirt
has 'role' => (is => 'ro', required => 1);

sub split_at {
my $self = shift;
my ($point) = @_;
Expand All @@ -25,7 +28,7 @@ sub split_at {
push @new_points, @{$self->points}[$i .. $#{$self->points}];
push @new_points, @{$self->points}[0 .. $i];

return Slic3r::ExtrusionPath->new(points => [@new_points]);
return Slic3r::ExtrusionPath->new(points => [@new_points], role => $self->role);
}

1;
11 changes: 10 additions & 1 deletion lib/Slic3r/ExtrusionPath.pm
Expand Up @@ -7,6 +7,9 @@ extends 'Slic3r::Polyline';
# expressed in layers
has 'depth_layers' => (is => 'ro', default => sub {1});

# perimeter/fill/bridge/skirt
has 'role' => (is => 'ro', required => 1);

use Slic3r::Geometry qw(PI X Y epsilon deg2rad rotate_points);
use XXX;

Expand Down Expand Up @@ -67,7 +70,12 @@ sub split_at_acute_angles {
push @p, $p3;
}
}
push @paths, (ref $self)->cast([@p]) if @p > 1;
push @paths, (ref $self)->cast(
[@p],
role => $self->role,
depth_layers => $self->depth_layers,
) if @p > 1;

return @paths;
}

Expand Down Expand Up @@ -152,6 +160,7 @@ sub detect_arcs {

my $arc = Slic3r::ExtrusionPath::Arc->new(
points => [@arc_points],
role => $self->role,
orientation => $orientation,
center => $arc_center,
radius => $arc_center->distance_to($points[$i]),
Expand Down
3 changes: 2 additions & 1 deletion lib/Slic3r/Fill.pm
Expand Up @@ -80,10 +80,10 @@ sub make_fill {
my $filler = $Slic3r::fill_pattern;
my $density = $Slic3r::fill_density;
my $flow_width = $Slic3r::flow_width;
my $is_bridge = $layer->id > 0 && $surface->surface_type eq 'bottom';

# force 100% density and rectilinear fill for external surfaces
if ($surface->surface_type ne 'internal') {
my $is_bridge = $layer->id > 0 && $surface->surface_type eq 'bottom';
$density = 1;
$filler = $is_bridge ? 'rectilinear' : $Slic3r::solid_fill_pattern;
$flow_width = $Slic3r::nozzle_diameter if $is_bridge;
Expand All @@ -102,6 +102,7 @@ sub make_fill {
paths => [
map Slic3r::ExtrusionPath->cast(
[ @$_ ],
role => ($is_bridge ? 'bridge' : 'fill'),
depth_layers => $surface->depth_layers,
), @paths,
],
Expand Down
2 changes: 1 addition & 1 deletion lib/Slic3r/Fill/Concentric.pm
Expand Up @@ -35,7 +35,7 @@ sub fill_surface {
# make paths
my @paths = ();
my $cur_pos = Slic3r::Point->new(0,0);
foreach my $loop (map Slic3r::ExtrusionLoop->cast($_), @loops) {
foreach my $loop (map Slic3r::ExtrusionLoop->cast($_, role => 'fill'), @loops) {
# find the point of the loop that is closest to the current extruder position
$cur_pos = $loop->nearest_point_to($cur_pos);

Expand Down
2 changes: 1 addition & 1 deletion lib/Slic3r/GUI/SkeinPanel.pm
Expand Up @@ -25,7 +25,7 @@ sub new {
},
speed => {
title => 'Speed',
options => [qw(print_feed_rate travel_feed_rate perimeter_feed_rate bottom_layer_speed_ratio)],
options => [qw(travel_feed_rate print_feed_rate perimeter_feed_rate bridge_feed_rate bottom_layer_speed_ratio)],
},
accuracy => {
title => 'Accuracy',
Expand Down
4 changes: 2 additions & 2 deletions lib/Slic3r/Perimeter.pm
Expand Up @@ -64,12 +64,12 @@ sub make_perimeter {
foreach my $island (@perimeters) {
# do holes starting from innermost one
foreach my $hole (map $_->holes, map @$_, @$island) {
push @{ $layer->perimeters }, Slic3r::ExtrusionLoop->cast($hole);
push @{ $layer->perimeters }, Slic3r::ExtrusionLoop->cast($hole, role => 'perimeter');
}

# do contours starting from innermost one
foreach my $contour (map $_->contour, map @$_, reverse @$island) {
push @{ $layer->perimeters }, Slic3r::ExtrusionLoop->cast($contour);
push @{ $layer->perimeters }, Slic3r::ExtrusionLoop->cast($contour, role => 'perimeter');
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Slic3r/Print.pm
Expand Up @@ -273,7 +273,7 @@ sub extrude_skirt {
for (my $i = $Slic3r::skirts - 1; $i >= 0; $i--) {
my $distance = ($Slic3r::skirt_distance + ($Slic3r::flow_width * $i)) / $Slic3r::resolution;
my $outline = offset([$convex_hull], $distance, $Slic3r::resolution * 100, JT_ROUND);
push @skirts, Slic3r::ExtrusionLoop->cast([ @{$outline->[0]} ]);
push @skirts, Slic3r::ExtrusionLoop->cast([ @{$outline->[0]} ], role => 'skirt');
}

# apply skirts to all layers
Expand Down
8 changes: 5 additions & 3 deletions slic3r.pl
Expand Up @@ -42,6 +42,7 @@ BEGIN
'print-feed-rate=i' => \$Slic3r::print_feed_rate,
'travel-feed-rate=i' => \$Slic3r::travel_feed_rate,
'perimeter-feed-rate=i' => \$Slic3r::perimeter_feed_rate,
'bridge-feed-rate=i' => \$Slic3r::bridge_feed_rate,
'bottom-layer-speed-ratio=f' => \$Slic3r::bottom_layer_speed_ratio,

# accuracy options
Expand Down Expand Up @@ -147,16 +148,17 @@ sub usage {
Filament options:
--filament-diameter Diameter in mm of your raw filament (default: $Slic3r::filament_diameter)
--extrusion-multiplier
Change this to alter the amount of plastic extruded. There should be very little
need to change this value, which is only useful to compensate for
filament packing (default: $Slic3r::extrusion_multiplier)
Change this to alter the amount of plastic extruded. There should be
very little need to change this value, which is only useful to
compensate for filament packing (default: $Slic3r::extrusion_multiplier)
--temperature Extrusion temperature, set 0 to disable (default: $Slic3r::temperature)
Speed options:
--print-feed-rate Speed of print moves in mm/sec (default: $Slic3r::print_feed_rate)
--travel-feed-rate Speed of non-print moves in mm/sec (default: $Slic3r::travel_feed_rate)
--perimeter-feed-rate
Speed of print moves for perimeters in mm/sec (default: $Slic3r::print_feed_rate)
--bridge-feed-rate Speed of bridge print moves in mm/sec (default: $Slic3r::bridge_feed_rate)
--bottom-layer-speed-ratio
Factor to increase/decrease speeds on bottom
layer by (default: $Slic3r::bottom_layer_speed_ratio)
Expand Down
4 changes: 2 additions & 2 deletions t/arcs.t
Expand Up @@ -18,7 +18,7 @@ use Slic3r;
[306517.1,219034.23], [286979.42,248012.49], [258001.16,267550.17], [222515.14,274714.47],
[187029.11,267550.17], [158050.85,248012.49], [138513.17,219034.23], [131348.87,183548.2],
[86948.77,175149.09], [119825.35,100585],
]);
], role => 'fill');

my $collection = Slic3r::ExtrusionPath::Collection->new(paths => [$path]);
$collection->detect_arcs(30);
Expand All @@ -36,7 +36,7 @@ use Slic3r;
[13.8268343236509,19.2387953251129], [14.5399049973955,18.9100652418837],
[15.2249856471595,18.5264016435409], [15.8778525229247,18.0901699437495],
[16.4944804833018,17.6040596560003],
]);
], role => 'fill');
my $collection = Slic3r::ExtrusionPath::Collection->new(paths => [$path]);
$collection->detect_arcs(10, 1);

Expand Down

0 comments on commit 975387d

Please sign in to comment.