diff --git a/lib/Slic3r.pm b/lib/Slic3r.pm index 9214022f8..1dfaf8859 100644 --- a/lib/Slic3r.pm +++ b/lib/Slic3r.pm @@ -68,6 +68,7 @@ use constant SCALING_FACTOR => 0.000001; use constant RESOLUTION => 0.0125; use constant SCALED_RESOLUTION => RESOLUTION / SCALING_FACTOR; use constant OVERLAP_FACTOR => 1; +use constant BRIDGE_OVERLAP_FACTOR => 0.2; use constant SMALL_PERIMETER_LENGTH => (6.5 / SCALING_FACTOR) * 2 * PI; use constant LOOP_CLIPPING_LENGTH_OVER_SPACING => 0.15; use constant INFILL_OVERLAP_OVER_SPACING => 0.45; diff --git a/lib/Slic3r/ExtrusionPath.pm b/lib/Slic3r/ExtrusionPath.pm index 7e759fc95..c8efc675e 100644 --- a/lib/Slic3r/ExtrusionPath.pm +++ b/lib/Slic3r/ExtrusionPath.pm @@ -20,7 +20,7 @@ has 'polyline' => ( # height is the vertical thickness of the extrusion expressed in mm has 'height' => (is => 'rw'); -has 'flow_spacing' => (is => 'rw'); +has 'flow_spacing' => (is => 'rw', required => 1); has 'role' => (is => 'rw', required => 1); use constant EXTR_ROLE_PERIMETER => 0; @@ -244,6 +244,7 @@ sub detect_arcs { my $arc = Slic3r::ExtrusionPath::Arc->new( polyline => Slic3r::Polyline->new(\@arc_points), role => $self->role, + flow_spacing => $self->flow_spacing, orientation => $orientation, center => $arc_center, radius => $arc_center->distance_to($points[$i]), @@ -253,6 +254,7 @@ sub detect_arcs { push @paths, (ref $self)->new( polyline => Slic3r::Polyline->new(@points[0..$i]), role => $self->role, + flow_spacing => $self->flow_spacing, height => $self->height, ) if $i > 0; @@ -272,6 +274,7 @@ sub detect_arcs { push @paths, (ref $self)->new( polyline => Slic3r::Polyline->new(\@points), role => $self->role, + flow_spacing => $self->flow_spacing, height => $self->height, ) if @points > 1; diff --git a/lib/Slic3r/Flow.pm b/lib/Slic3r/Flow.pm index eca1ff55a..d34d04a91 100644 --- a/lib/Slic3r/Flow.pm +++ b/lib/Slic3r/Flow.pm @@ -99,7 +99,7 @@ sub _build_width { sub _build_spacing { my $self = shift; my $width = $self->width; - return $width + &Slic3r::OVERLAP_FACTOR * ($width * PI / 4 - $width); + return $width - (&Slic3r::BRIDGE_OVERLAP_FACTOR * $width); } 1; diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index a581df4ed..b5482f7a0 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -699,7 +699,7 @@ sub make_brim { # JT_SQUARE ensures no vertex is outside the given offset distance # -0.5 because islands are not represented by their centerlines # TODO: we need the offset inwards/offset outwards logic to avoid overlapping extrusions - push @loops, offset2(\@islands, ($i - 2) * $flow->scaled_spacing, ($i + 1.5) * $flow->scaled_spacing, undef, JT_SQUARE); + push @loops, offset2(\@islands, ($i - 1.5) * $flow->scaled_spacing, +1.0 * $flow->scaled_spacing, undef, JT_SQUARE); } @{$self->brim} = map Slic3r::ExtrusionLoop->pack( diff --git a/lib/Slic3r/TriangleMesh.pm b/lib/Slic3r/TriangleMesh.pm index 99af25526..f093a3fe2 100644 --- a/lib/Slic3r/TriangleMesh.pm +++ b/lib/Slic3r/TriangleMesh.pm @@ -543,6 +543,8 @@ sub get_connected_facets { sub split_mesh { my $self = shift; + $self->analyze; + my @meshes = (); # loop while we have remaining facets diff --git a/t/loops.t b/t/loops.t index d0340b200..2495f7c6c 100644 --- a/t/loops.t +++ b/t/loops.t @@ -40,6 +40,7 @@ use Slic3r::Test; [ [5,5,0], [5,15,10], [5,5,10] ]; my $mesh = Slic3r::TriangleMesh->new(vertices => \@vertices, facets => \@facets); + $mesh->analyze; my @lines = map $mesh->intersect_facet($_, 10), 0..$#facets; my $loops = Slic3r::TriangleMesh::make_loops(\@lines); is scalar(@$loops), 3, 'correct number of loops detected'; diff --git a/t/slice.t b/t/slice.t index 39ae3f71c..cfa78a60c 100644 --- a/t/slice.t +++ b/t/slice.t @@ -111,7 +111,7 @@ sub vertices { sub add_facet { push @{$mesh->facets}, [ [0,0,0], @{vertices(@_)} ]; - $mesh->BUILD; + $mesh->analyze; } sub intersect {