More fixes for bridges. #58

This commit is contained in:
Alessandro Ranellucci 2011-12-04 18:37:37 +01:00
parent d056535bd8
commit eb64cc4965
4 changed files with 21 additions and 8 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;