Lots of changes and refactoring after testing with hollow objects

This commit is contained in:
Alessandro Ranellucci 2011-09-18 19:28:12 +02:00
parent 26b05ab155
commit 18c7aef1a7
15 changed files with 716 additions and 494 deletions

View file

@ -7,14 +7,12 @@ use constant Y => 1;
has 'x_length' => (
is => 'ro',
#isa => 'Slic3r::Line::Length',
required => 1,
coerce => sub { sprintf '%.0f', $_[0] },
);
has 'y_length' => (
is => 'ro',
#isa => 'Slic3r::Line::Length',
required => 1,
coerce => sub { sprintf '%.0f', $_[0] },
);
@ -31,6 +29,11 @@ sub layer_count {
return scalar @{ $self->layers };
}
sub max_length {
my $self = shift;
return ($self->x_length > $self->y_length) ? $self->x_length : $self->y_length;
}
sub layer {
my $self = shift;
my ($layer_id) = @_;
@ -152,7 +155,7 @@ sub export_gcode {
}
# go to first point while compensating retraction
$G1->($path->lines->[0]->a, $z, 0, "move to first $description point");
$G1->($path->points->[0], $z, 0, "move to first $description point");
# compensate retraction
if ($retracted) {
@ -161,7 +164,7 @@ sub export_gcode {
}
# extrude while going to next points
foreach my $line (@{ $path->lines }) {
foreach my $line ($path->lines) {
# calculate how much filament to drive into the extruder
# to get the desired amount of extruded plastic
my $e = $line->a->distance_to($line->b) * $Slic3r::resolution