Strange behavior of Extra perimeters and ensure wall thickness
Old behavior is re-enabled when ensure vertical wall thickness is off.
This commit is contained in:
bubnikv 2016-11-09 10:24:45 +01:00
parent e15b5f4587
commit eb0ab38618
3 changed files with 21 additions and 5 deletions

View File

@ -965,7 +965,11 @@ sub discover_horizontal_shells {
# solution so far. Growing the external slices by EXTERNAL_INFILL_MARGIN will put # solution so far. Growing the external slices by EXTERNAL_INFILL_MARGIN will put
# too much solid infill inside nearly-vertical slopes. # too much solid infill inside nearly-vertical slopes.
my $solid = [ my $solid = [
# Surfaces including the area of perimeters. Everything, that is visible from the top / bottom
# (not covered by a layer above / below).
# This does not contain the areas covered by perimeters!
(map $_->p, @{$layerm->slices->filter_by_type($type)}), (map $_->p, @{$layerm->slices->filter_by_type($type)}),
# Infill areas (slices without the perimeters).
(map $_->p, @{$layerm->fill_surfaces->filter_by_type($type)}), (map $_->p, @{$layerm->fill_surfaces->filter_by_type($type)}),
]; ];
next if !@$solid; next if !@$solid;
@ -1011,20 +1015,28 @@ sub discover_horizontal_shells {
# and it's not wanted in a hollow print even if it would make sense when # and it's not wanted in a hollow print even if it would make sense when
# obeying the solid shell count option strictly (DWIM!) # obeying the solid shell count option strictly (DWIM!)
my $margin = $neighbor_layerm->flow(FLOW_ROLE_EXTERNAL_PERIMETER)->scaled_width; my $margin = $neighbor_layerm->flow(FLOW_ROLE_EXTERNAL_PERIMETER)->scaled_width;
my $regularized = offset2($new_internal_solid, -$margin, +$margin, CLIPPER_OFFSET_SCALE, JT_MITER, 5);
my $too_narrow = diff( my $too_narrow = diff(
$new_internal_solid, $new_internal_solid,
offset2($new_internal_solid, -$margin, +$margin, CLIPPER_OFFSET_SCALE, JT_MITER, 5), $regularized,
1, 1,
); );
$new_internal_solid = $solid = diff( # Trim the regularized region by the original region.
$new_internal_solid = $solid = intersection(
$new_internal_solid, $new_internal_solid,
$too_narrow, $regularized,
) if @$too_narrow; ) if @$too_narrow;
} }
# make sure the new internal solid is wide enough, as it might get collapsed # make sure the new internal solid is wide enough, as it might get collapsed
# when spacing is added in Fill.pm # when spacing is added in Fill.pm
if (0) { if ($layerm->region->config->ensure_vertical_shell_thickness) {
# The possible thin sickles of top / bottom surfaces on steeply sloping surfaces touch
# the projections of top / bottom perimeters, therefore they will be sufficiently inflated by
# merging them with the projections of the top / bottom perimeters.
} else {
#FIXME Vojtech: Disable this and you will be sorry.
# https://github.com/prusa3d/Slic3r/issues/26 bottom
my $margin = 3 * $layerm->flow(FLOW_ROLE_SOLID_INFILL)->scaled_width; # require at least this size my $margin = 3 * $layerm->flow(FLOW_ROLE_SOLID_INFILL)->scaled_width; # require at least this size
# we use a higher miterLimit here to handle areas with acute angles # we use a higher miterLimit here to handle areas with acute angles
# in those cases, the default miterLimit would cut the corner and we'd # in those cases, the default miterLimit would cut the corner and we'd

View File

@ -377,6 +377,7 @@ LayerRegion::prepare_fill_surfaces()
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING #ifdef SLIC3R_DEBUG_SLICE_PROCESSING
export_region_slices_to_svg_debug("2_prepare_fill_surfaces"); export_region_slices_to_svg_debug("2_prepare_fill_surfaces");
export_region_fill_surfaces_to_svg_debug("2_prepare_fill_surfaces");
#endif /* SLIC3R_DEBUG_SLICE_PROCESSING */ #endif /* SLIC3R_DEBUG_SLICE_PROCESSING */
} }
@ -426,8 +427,10 @@ void LayerRegion::export_region_fill_surfaces_to_svg(const char *path)
SVG svg(path, bbox); SVG svg(path, bbox);
const float transparency = 0.5f; const float transparency = 0.5f;
for (Surfaces::const_iterator surface = this->fill_surfaces.surfaces.begin(); surface != this->fill_surfaces.surfaces.end(); ++surface) for (Surfaces::const_iterator surface = this->fill_surfaces.surfaces.begin(); surface != this->fill_surfaces.surfaces.end(); ++surface) {
svg.draw(surface->expolygon, surface_type_to_color_name(surface->surface_type), transparency); svg.draw(surface->expolygon, surface_type_to_color_name(surface->surface_type), transparency);
svg.draw_outline(surface->expolygon, "black", "blue", scale_(0.05));
}
export_surface_type_legend_to_svg(svg, legend_pos); export_surface_type_legend_to_svg(svg, legend_pos);
svg.Close(); svg.Close();
} }

View File

@ -370,6 +370,7 @@ PrintObject::discover_vertical_shells()
for (int n = (int)idx_layer - layerm->region()->config.bottom_solid_layers + 1; n < (int)idx_layer + layerm->region()->config.top_solid_layers; ++ n) for (int n = (int)idx_layer - layerm->region()->config.bottom_solid_layers + 1; n < (int)idx_layer + layerm->region()->config.top_solid_layers; ++ n)
if (n >= 0 && n < (int)this->layers.size()) if (n >= 0 && n < (int)this->layers.size())
polygons_append(shell, this->layers[n]->perimeter_expolygons.expolygons); polygons_append(shell, this->layers[n]->perimeter_expolygons.expolygons);
//FIXME Add the top / bottom layerm->slices to the mix!
#ifdef SLIC3R_DEBUG_SLICE_PROCESSING #ifdef SLIC3R_DEBUG_SLICE_PROCESSING
{ {
static size_t idx = 0; static size_t idx = 0;