2011-09-25 21:15:45 +00:00
|
|
|
package Slic3r::ExtrusionLoop;
|
|
|
|
use Moo;
|
|
|
|
|
|
|
|
use XXX;
|
|
|
|
|
|
|
|
extends 'Slic3r::Polyline::Closed';
|
|
|
|
|
2011-11-28 18:11:26 +00:00
|
|
|
# perimeter/fill/solid-fill/bridge/skirt
|
2011-12-05 11:15:52 +00:00
|
|
|
has 'role' => (is => 'rw', required => 1);
|
2011-11-28 17:37:53 +00:00
|
|
|
|
2011-09-25 21:15:45 +00:00
|
|
|
sub split_at {
|
|
|
|
my $self = shift;
|
|
|
|
my ($point) = @_;
|
|
|
|
|
2011-10-12 12:54:49 +00:00
|
|
|
$point = Slic3r::Point->new($point);
|
2011-09-25 21:15:45 +00:00
|
|
|
|
|
|
|
# find index of point
|
|
|
|
my $i = -1;
|
|
|
|
for (my $n = 0; $n <= $#{$self->points}; $n++) {
|
|
|
|
if ($point->id eq $self->points->[$n]->id) {
|
|
|
|
$i = $n;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
die "Point not found" if $i == -1;
|
|
|
|
|
|
|
|
my @new_points = ();
|
|
|
|
push @new_points, @{$self->points}[$i .. $#{$self->points}];
|
|
|
|
push @new_points, @{$self->points}[0 .. $i];
|
|
|
|
|
2011-11-28 17:37:53 +00:00
|
|
|
return Slic3r::ExtrusionPath->new(points => [@new_points], role => $self->role);
|
2011-09-25 21:15:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|