Bugfix: after recent changes, objects had slight dimension errors. #56

This commit is contained in:
Alessandro Ranellucci 2011-12-05 18:48:48 +01:00
parent 3d0cde2fce
commit 2ba513bdb2
3 changed files with 13 additions and 17 deletions

View File

@ -3,7 +3,7 @@ package Slic3r;
use strict; use strict;
use warnings; use warnings;
our $VERSION = "0.5.5b"; our $VERSION = "0.5.6-beta";
our $debug = 0; our $debug = 0;
sub debugf { sub debugf {

View File

@ -122,6 +122,18 @@ sub make_surfaces {
@$expolygons; @$expolygons;
} }
# the contours must be offsetted by half extrusion width inwards
{
my $distance = scale $Slic3r::flow_width / 2;
my @surfaces = @{$self->slices};
@{$self->slices} = ();
foreach my $surface (@surfaces) {
push @{$self->slices}, map Slic3r::Surface->cast_from_expolygon
($_, surface_type => 'internal'),
$surface->expolygon->offset_ex(-$distance);
}
}
#use Slic3r::SVG; #use Slic3r::SVG;
#Slic3r::SVG::output(undef, "surfaces.svg", #Slic3r::SVG::output(undef, "surfaces.svg",
# polygons => [ map $_->contour->p, @{$self->surfaces} ], # polygons => [ map $_->contour->p, @{$self->surfaces} ],

View File

@ -10,13 +10,11 @@ use XXX;
has 'x_length' => ( has 'x_length' => (
is => 'ro', is => 'ro',
required => 1, required => 1,
coerce => sub { sprintf '%.0f', $_[0] },
); );
has 'y_length' => ( has 'y_length' => (
is => 'ro', is => 'ro',
required => 1, required => 1,
coerce => sub { sprintf '%.0f', $_[0] },
); );
has 'layers' => ( has 'layers' => (
@ -181,20 +179,6 @@ sub detect_surfaces_type {
@$expolygons; @$expolygons;
}; };
# the contours must be offsetted by half extrusion width inwards
{
my $distance = scale $Slic3r::flow_width / 2;
foreach my $layer (@{$self->layers}) {
my @surfaces = @{$layer->slices};
@{$layer->slices} = ();
foreach my $surface (@surfaces) {
push @{$layer->slices}, map Slic3r::Surface->cast_from_expolygon
($_, surface_type => 'internal'),
$surface->expolygon->offset_ex(-$distance);
}
}
}
for (my $i = 0; $i < $self->layer_count; $i++) { for (my $i = 0; $i < $self->layer_count; $i++) {
my $layer = $self->layers->[$i]; my $layer = $self->layers->[$i];
Slic3r::debugf "Detecting solid surfaces for layer %d\n", $layer->id; Slic3r::debugf "Detecting solid surfaces for layer %d\n", $layer->id;