From 5a07137def14d0728bf48cce21eb86054a9603d2 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Wed, 5 Oct 2011 21:25:17 +0200 Subject: [PATCH] Fixes to retraction and skirt --- lib/Slic3r.pm | 4 ++-- lib/Slic3r/Extruder.pm | 3 +-- lib/Slic3r/Geometry.pm | 2 +- lib/Slic3r/Perimeter.pm | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index ab5457f68..9b629ed98 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -29,14 +29,14 @@ use Slic3r::Surface; use Slic3r::Surface::Collection; # printer options -our $nozzle_diameter = 0.55; +our $nozzle_diameter = 0.5; our $print_center = [100,100]; # object will be centered around this point our $use_relative_e_distances = 0; our $z_offset = 0; # filament options our $filament_diameter = 3; # mm -our $filament_packing_density = 0.85; +our $filament_packing_density = 1; # speed options our $print_feed_rate = 60; # mm/sec diff --git a/lib/Slic3r/Extruder.pm b/lib/Slic3r/Extruder.pm index b155d6e6e..3c8cd2bb3 100644 --- a/lib/Slic3r/Extruder.pm +++ b/lib/Slic3r/Extruder.pm @@ -76,7 +76,7 @@ sub extrude { } # retract - if (Slic3r::Geometry::distance_between_points($self->last_pos, $path->points->[0]->p) + if (Slic3r::Geometry::distance_between_points($self->last_pos, $path->points->[0]->p) * $Slic3r::resolution >= $Slic3r::retract_before_travel) { $gcode .= $self->retract; } @@ -105,7 +105,6 @@ sub extrude { sub retract { my $self = shift; return "" unless $Slic3r::retract_length > 0 - && $self->extrusion_distance > 0 && !$self->retracted; $self->retracted(1); diff --git a/lib/Slic3r/Geometry.pm b/lib/Slic3r/Geometry.pm index 8b4794460..51a1c203d 100644 --- a/lib/Slic3r/Geometry.pm +++ b/lib/Slic3r/Geometry.pm @@ -57,7 +57,7 @@ sub points_coincide { sub distance_between_points { my ($p1, $p2) = @_; - return sqrt(($p1->[X] - $p2->[X])**2 + ($p1->[Y] - $p2->[Y])**2); + return sqrt((($p1->[X] - $p2->[X])**2) + ($p1->[Y] - $p2->[Y])**2); } sub point_in_polygon { diff --git a/lib/Slic3r/Perimeter.pm b/lib/Slic3r/Perimeter.pm index 9bde8f01a..a67b1cb64 100644 --- a/lib/Slic3r/Perimeter.pm +++ b/lib/Slic3r/Perimeter.pm @@ -84,7 +84,7 @@ sub make_perimeter { # draw outlines from outside to inside 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_points], $distance, $Slic3r::resolution * 100000, JT_ROUND); + my $outline = offset([$convex_hull_points], $distance, $Slic3r::resolution * 100, JT_ROUND); push @{ $layer->skirts }, Slic3r::ExtrusionLoop->cast([ @{$outline->[0]} ]); } }