concentric - new superfast infill pattern
This commit is contained in:
parent
f3b689d4e0
commit
0ab1fd4c19
1
MANIFEST
1
MANIFEST
@ -10,6 +10,7 @@ lib/Slic3r/ExtrusionPath/Collection.pm
|
|||||||
lib/Slic3r/Fill.pm
|
lib/Slic3r/Fill.pm
|
||||||
lib/Slic3r/Fill/ArchimedeanChords.pm
|
lib/Slic3r/Fill/ArchimedeanChords.pm
|
||||||
lib/Slic3r/Fill/Base.pm
|
lib/Slic3r/Fill/Base.pm
|
||||||
|
lib/Slic3r/Fill/Concentric.pm
|
||||||
lib/Slic3r/Fill/Flowsnake.pm
|
lib/Slic3r/Fill/Flowsnake.pm
|
||||||
lib/Slic3r/Fill/HilbertCurve.pm
|
lib/Slic3r/Fill/HilbertCurve.pm
|
||||||
lib/Slic3r/Fill/Line.pm
|
lib/Slic3r/Fill/Line.pm
|
||||||
|
@ -95,12 +95,12 @@ our $Options = {
|
|||||||
'fill_pattern' => {
|
'fill_pattern' => {
|
||||||
label => 'Fill pattern',
|
label => 'Fill pattern',
|
||||||
type => 'select',
|
type => 'select',
|
||||||
values => [qw(rectilinear line hilbertcurve archimedeanchords octagramspiral)],
|
values => [qw(rectilinear line concentric hilbertcurve archimedeanchords octagramspiral)],
|
||||||
},
|
},
|
||||||
'solid_fill_pattern' => {
|
'solid_fill_pattern' => {
|
||||||
label => 'Solid fill pattern',
|
label => 'Solid fill pattern',
|
||||||
type => 'select',
|
type => 'select',
|
||||||
values => [qw(rectilinear hilbertcurve archimedeanchords octagramspiral)],
|
values => [qw(rectilinear concentric hilbertcurve archimedeanchords octagramspiral)],
|
||||||
},
|
},
|
||||||
'fill_density' => {
|
'fill_density' => {
|
||||||
label => 'Fill density',
|
label => 'Fill density',
|
||||||
|
@ -3,6 +3,7 @@ use Moo;
|
|||||||
|
|
||||||
use Slic3r::Fill::ArchimedeanChords;
|
use Slic3r::Fill::ArchimedeanChords;
|
||||||
use Slic3r::Fill::Base;
|
use Slic3r::Fill::Base;
|
||||||
|
use Slic3r::Fill::Concentric;
|
||||||
use Slic3r::Fill::Flowsnake;
|
use Slic3r::Fill::Flowsnake;
|
||||||
use Slic3r::Fill::HilbertCurve;
|
use Slic3r::Fill::HilbertCurve;
|
||||||
use Slic3r::Fill::Line;
|
use Slic3r::Fill::Line;
|
||||||
@ -26,6 +27,7 @@ our %FillTypes = (
|
|||||||
octagramspiral => 'Slic3r::Fill::OctagramSpiral',
|
octagramspiral => 'Slic3r::Fill::OctagramSpiral',
|
||||||
hilbertcurve => 'Slic3r::Fill::HilbertCurve',
|
hilbertcurve => 'Slic3r::Fill::HilbertCurve',
|
||||||
line => 'Slic3r::Fill::Line',
|
line => 'Slic3r::Fill::Line',
|
||||||
|
concentric => 'Slic3r::Fill::Concentric',
|
||||||
);
|
);
|
||||||
|
|
||||||
sub BUILD {
|
sub BUILD {
|
||||||
|
54
lib/Slic3r/Fill/Concentric.pm
Normal file
54
lib/Slic3r/Fill/Concentric.pm
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package Slic3r::Fill::Concentric;
|
||||||
|
use Moo;
|
||||||
|
|
||||||
|
extends 'Slic3r::Fill::Base';
|
||||||
|
|
||||||
|
use XXX;
|
||||||
|
|
||||||
|
sub fill_surface {
|
||||||
|
my $self = shift;
|
||||||
|
my ($surface, %params) = @_;
|
||||||
|
|
||||||
|
# no rotation is supported for this infill pattern
|
||||||
|
|
||||||
|
my $flow_width_res = $params{flow_width} / $Slic3r::resolution;
|
||||||
|
my $distance = $flow_width_res / $params{density};
|
||||||
|
|
||||||
|
my @contour_loops = ();
|
||||||
|
my @hole_loops = ();
|
||||||
|
my @last_offsets = ($surface->expolygon->offset_ex($distance));
|
||||||
|
while (@last_offsets) {
|
||||||
|
my @new_offsets = ();
|
||||||
|
foreach my $expolygon (@last_offsets) {
|
||||||
|
my @offsets = $expolygon->offset_ex(-$distance);
|
||||||
|
foreach my $offset (@offsets) {
|
||||||
|
push @new_offsets, $offset;
|
||||||
|
push @contour_loops, $offset->contour;
|
||||||
|
push @hole_loops, $offset->holes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@last_offsets = @new_offsets;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @loops = (@contour_loops, reverse @hole_loops);
|
||||||
|
|
||||||
|
# make paths
|
||||||
|
my @paths = ();
|
||||||
|
my $cur_pos = Slic3r::Point->new(0,0);
|
||||||
|
foreach my $loop (map Slic3r::ExtrusionLoop->cast($_), @loops) {
|
||||||
|
# find the point of the loop that is closest to the current extruder position
|
||||||
|
$cur_pos = $loop->nearest_point_to($cur_pos);
|
||||||
|
|
||||||
|
# split the loop at the starting point and make a path
|
||||||
|
my $path = $loop->split_at($cur_pos);
|
||||||
|
|
||||||
|
# clip the path to avoid the extruder to get exactly on the first point of the loop
|
||||||
|
$path->clip_end($Slic3r::flow_width / $Slic3r::resolution);
|
||||||
|
|
||||||
|
push @paths, $path->p;
|
||||||
|
}
|
||||||
|
|
||||||
|
return @paths;
|
||||||
|
}
|
||||||
|
|
||||||
|
1;
|
Loading…
Reference in New Issue
Block a user