Add spacing between adjacent surfaces to avoid mini blobs
This commit is contained in:
parent
e5619ee543
commit
f20209ce01
1 changed files with 31 additions and 1 deletions
|
@ -11,7 +11,7 @@ use Slic3r::Fill::OctagramSpiral;
|
|||
use Slic3r::Fill::PlanePath;
|
||||
use Slic3r::Fill::Rectilinear;
|
||||
use Slic3r::Fill::Rectilinear2;
|
||||
use Slic3r::Geometry qw(shortest_path);
|
||||
use Slic3r::Geometry qw(scale shortest_path);
|
||||
use Slic3r::Geometry::Clipper qw(union_ex diff_ex);
|
||||
|
||||
use XXX;
|
||||
|
@ -79,6 +79,36 @@ sub make_fill {
|
|||
}
|
||||
}
|
||||
|
||||
# add spacing between adjacent surfaces
|
||||
{
|
||||
my $distance = scale $Slic3r::flow_spacing / 2;
|
||||
my @offsets = ();
|
||||
foreach my $surface (@surfaces) {
|
||||
my $expolygon = $surface->expolygon;
|
||||
my $diff = diff_ex(
|
||||
[ $expolygon->offset($distance) ],
|
||||
$expolygon,
|
||||
1,
|
||||
);
|
||||
push @offsets, map @$_, @$diff;
|
||||
}
|
||||
|
||||
my @new_surfaces = ();
|
||||
foreach my $surface (@surfaces) {
|
||||
my $diff = diff_ex(
|
||||
$surface->expolygon,
|
||||
[ @offsets ],
|
||||
);
|
||||
|
||||
push @new_surfaces, map Slic3r::Surface->cast_from_expolygon($_,
|
||||
surface_type => $surface->surface_type,
|
||||
bridge_angle => $surface->bridge_angle,
|
||||
depth_layers => $surface->depth_layers,
|
||||
), @$diff;
|
||||
}
|
||||
@surfaces = @new_surfaces;
|
||||
}
|
||||
|
||||
# organize infill surfaces using a shortest path search
|
||||
@surfaces = @{shortest_path([
|
||||
map [ $_->contour->points->[0], $_ ], @surfaces,
|
||||
|
|
Loading…
Add table
Reference in a new issue