diff --git a/README.markdown b/README.markdown index f12e44d3b..a37864bf0 100644 --- a/README.markdown +++ b/README.markdown @@ -40,6 +40,7 @@ Slic3r current features are: * retraction; * skirt (with rounded corners); * use relative or absolute extrusion commands; +* high-res perimeters (like the "Skin" plugin for Skeinforge); * center print around bed center point; * multiple solid layers near horizontal external surfaces; * ability to scale, rotate and multiply input object; diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 0faac55b2..3178162bf 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -45,9 +45,10 @@ our $perimeter_feed_rate = 30; # mm/sec our $bottom_layer_speed_ratio = 0.3; # accuracy options -our $resolution = 0.00000001; -our $layer_height = 0.4; -our $thickness_ratio = 1; +our $resolution = 0.00000001; +our $layer_height = 0.4; +our $high_res_perimeters = 0; +our $thickness_ratio = 1; our $flow_width; # print options diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm index b93e11063..dcc544db6 100644 --- a/lib/Slic3r/Config.pm +++ b/lib/Slic3r/Config.pm @@ -59,6 +59,10 @@ our $Options = { label => 'Layer height (mm)', type => 'f', }, + 'high_res_perimeters' => { + label => 'High-res perimeters', + type => 'bool', + }, # print options 'perimeter_offsets' => { diff --git a/lib/Slic3r/Extruder.pm b/lib/Slic3r/Extruder.pm index e740bfb51..bf3f54ffd 100644 --- a/lib/Slic3r/Extruder.pm +++ b/lib/Slic3r/Extruder.pm @@ -4,6 +4,7 @@ use Moo; has 'shift_x' => (is => 'ro', default => sub {0} ); has 'shift_y' => (is => 'ro', default => sub {0} ); has 'z' => (is => 'rw', default => sub {0} ); +has 'flow_ratio' => (is => 'rw', default => sub {1}); has 'extrusion_distance' => (is => 'rw', default => sub {0} ); has 'retracted' => (is => 'rw', default => sub {1} ); # this spits out some plastic at start @@ -90,6 +91,7 @@ sub extrude { my $e = $line->a->distance_to($line->b) * $Slic3r::resolution * (($Slic3r::nozzle_diameter**2) / ($Slic3r::filament_diameter ** 2)) * $Slic3r::thickness_ratio + * $self->flow_ratio * $Slic3r::filament_packing_density; $gcode .= $self->G1($line->b, undef, $e, $description); diff --git a/lib/Slic3r/GUI/SkeinPanel.pm b/lib/Slic3r/GUI/SkeinPanel.pm index 471013f66..8adcc52e7 100644 --- a/lib/Slic3r/GUI/SkeinPanel.pm +++ b/lib/Slic3r/GUI/SkeinPanel.pm @@ -29,7 +29,7 @@ sub new { ), accuracy => Slic3r::GUI::OptionsGroup->new($self, title => 'Accuracy', - options => [qw(layer_height)], + options => [qw(layer_height high_res_perimeters)], ), print => Slic3r::GUI::OptionsGroup->new($self, title => 'Print settings', diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index 1b2691727..8fe42357e 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -211,6 +211,18 @@ sub export_gcode { # write gcode commands layer by layer foreach my $layer (@{ $self->layers }) { + # with the --high-res-perimeters options enabled we extrude perimeters for + # each layer twice at half height + if ($Slic3r::high_res_perimeters && $layer->id > 0) { + # go to half-layer + printf $fh $extruder->move_z($Slic3r::z_offset + $layer->z * $Slic3r::resolution - $Slic3r::layer_height/2); + + # extrude perimeters + $extruder->flow_ratio(0.5); + printf $fh $extruder->extrude_loop($_, 'perimeter') for @{ $layer->perimeters }; + $extruder->flow_ratio(1); + } + # go to layer printf $fh $extruder->move_z($Slic3r::z_offset + $layer->z * $Slic3r::resolution); diff --git a/slic3r.pl b/slic3r.pl index 22f89e9ad..a65605e9e 100755 --- a/slic3r.pl +++ b/slic3r.pl @@ -40,6 +40,7 @@ GetOptions( # accuracy options 'layer-height=f' => \$Slic3r::layer_height, + 'high-res-perimeters' => \$Slic3r::high_res_perimeters, # print options 'perimeters=i' => \$Slic3r::perimeter_offsets, @@ -139,6 +140,9 @@ Usage: slic3r.pl [ OPTIONS ] file.stl Accuracy options: --layer-height Layer height in mm (default: $Slic3r::layer_height) + --high-res-perimeters + Print perimeters at half layer height to get surface accuracy + (default: disabled) Print options: --perimeters Number of perimeters/horizontal skins (range: 1+,