Skip to content

Commit

Permalink
More fixes for bridges. #58
Browse files Browse the repository at this point in the history
  • Loading branch information
alranel committed Dec 4, 2011
1 parent d056535 commit eb64cc4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/Slic3r/GUI/SkeinPanel.pm
Expand Up @@ -158,7 +158,7 @@ sub do_slice {
{
local $SIG{__WARN__} = sub {
my $message = shift;
Wx::MessageDialog->new($self, $message, 'Non-manifold object',
Wx::MessageDialog->new($self, $message, 'Warning',
wxOK | wxICON_WARNING)->ShowModal;
};
$skein->go;
Expand Down
8 changes: 4 additions & 4 deletions lib/Slic3r/Layer.pm
Expand Up @@ -266,14 +266,14 @@ sub process_bridges {
my $bridge_over_hole = 0;
my @edges = (); # edges are POLYLINES
foreach my $supporting_surface (@supporting_surfaces) {
my @surface_edges = $supporting_surface->contour->clip_with_polygon($contour_offset);
my @surface_edges = map $_->clip_with_polygon($contour_offset),
($supporting_surface->contour, @{$supporting_surface->holes});

if (@supporting_surfaces == 1 && @surface_edges == 1
&& @{$supporting_surface->contour->p} == @{$surface_edges[0]->p}) {
$bridge_over_hole = 1;
} else {
@surface_edges = grep { @{$_->points} } @surface_edges;
}
push @edges, @surface_edges;
push @edges, grep { @{$_->points} } @surface_edges;
}
Slic3r::debugf " Bridge is supported on %d edge(s)\n", scalar(@edges);
Slic3r::debugf " and covers a hole\n" if $bridge_over_hole;
Expand Down
5 changes: 2 additions & 3 deletions lib/Slic3r/Perimeter.pm
Expand Up @@ -34,15 +34,14 @@ sub make_perimeter {
])};

foreach my $surface (@surfaces) {
# the outer loop must be offsetted by half extrusion width inwards
my @last_offsets = ($surface->expolygon);
my $distance = scale $Slic3r::flow_width / 2;
my $distance = 0;

# create other offsets
push @perimeters, [];
for (my $loop = 0; $loop < $Slic3r::perimeters; $loop++) {
# offsetting a polygon can result in one or many offset polygons
@last_offsets = map $_->offset_ex(-$distance), @last_offsets;
@last_offsets = map $_->offset_ex(-$distance), @last_offsets if $distance;
push @{ $perimeters[-1] }, [@last_offsets];

# offset distance for inner loops
Expand Down
14 changes: 14 additions & 0 deletions lib/Slic3r/Print.pm
Expand Up @@ -181,6 +181,20 @@ sub detect_surfaces_type {
@$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++) {
my $layer = $self->layers->[$i];
Slic3r::debugf "Detecting solid surfaces for layer %d\n", $layer->id;
Expand Down

0 comments on commit eb64cc4

Please sign in to comment.