Fix honeycomb infill overlap with perimeters
This commit is contained in:
parent
537fca47c5
commit
04c0caad0b
@ -67,7 +67,7 @@ use constant SCALED_RESOLUTION => RESOLUTION / SCALING_FACTOR;
|
|||||||
use constant OVERLAP_FACTOR => 1;
|
use constant OVERLAP_FACTOR => 1;
|
||||||
use constant SMALL_PERIMETER_LENGTH => (6.5 / SCALING_FACTOR) * 2 * PI;
|
use constant SMALL_PERIMETER_LENGTH => (6.5 / SCALING_FACTOR) * 2 * PI;
|
||||||
use constant LOOP_CLIPPING_LENGTH_OVER_SPACING => 0.15;
|
use constant LOOP_CLIPPING_LENGTH_OVER_SPACING => 0.15;
|
||||||
use constant PERIMETER_INFILL_OVERLAP_OVER_SPACING => 0.45;
|
use constant INFILL_OVERLAP_OVER_SPACING => 0.45;
|
||||||
|
|
||||||
our $Config;
|
our $Config;
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ sub make_fill {
|
|||||||
# add spacing between surfaces
|
# add spacing between surfaces
|
||||||
{
|
{
|
||||||
my $distance = $layerm->solid_infill_flow->scaled_spacing / 2;
|
my $distance = $layerm->solid_infill_flow->scaled_spacing / 2;
|
||||||
@surfaces = map $_->offset(-$distance), @surfaces;
|
@surfaces = map $_->offset(-$distance * &Slic3r::INFILL_OVERLAP_OVER_SPACING), @surfaces;
|
||||||
}
|
}
|
||||||
|
|
||||||
my @fills = ();
|
my @fills = ();
|
||||||
|
@ -22,7 +22,6 @@ sub fill_surface {
|
|||||||
# infill math
|
# infill math
|
||||||
my $min_spacing = scale $params{flow_spacing};
|
my $min_spacing = scale $params{flow_spacing};
|
||||||
my $distance = $min_spacing / $params{density};
|
my $distance = $min_spacing / $params{density};
|
||||||
my $overlap_distance = scale $params{flow_spacing} * &Slic3r::PERIMETER_INFILL_OVERLAP_OVER_SPACING;
|
|
||||||
|
|
||||||
my $cache_id = sprintf "d%s_s%s_a%s",
|
my $cache_id = sprintf "d%s_s%s_a%s",
|
||||||
$params{density}, $params{flow_spacing}, $rotate_vector->[0][0];
|
$params{density}, $params{flow_spacing}, $rotate_vector->[0][0];
|
||||||
@ -84,7 +83,7 @@ sub fill_surface {
|
|||||||
# path is more straight
|
# path is more straight
|
||||||
my @paths = map Slic3r::Polyline->new(@$_), map @$_, @{intersection_ex(
|
my @paths = map Slic3r::Polyline->new(@$_), map @$_, @{intersection_ex(
|
||||||
$self->cache->{$cache_id},
|
$self->cache->{$cache_id},
|
||||||
[ map @$_, $expolygon->offset_ex($overlap_distance) ],
|
$expolygon,
|
||||||
)};
|
)};
|
||||||
|
|
||||||
return { flow_spacing => $params{flow_spacing} },
|
return { flow_spacing => $params{flow_spacing} },
|
||||||
|
@ -31,8 +31,6 @@ sub fill_surface {
|
|||||||
$flow_spacing = unscale $distance_between_lines;
|
$flow_spacing = unscale $distance_between_lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $overlap_distance = scale $params{flow_spacing} * &Slic3r::PERIMETER_INFILL_OVERLAP_OVER_SPACING;
|
|
||||||
|
|
||||||
my $x = $bounding_box->[X1];
|
my $x = $bounding_box->[X1];
|
||||||
my $is_line_pattern = $self->isa('Slic3r::Fill::Line');
|
my $is_line_pattern = $self->isa('Slic3r::Fill::Line');
|
||||||
my @vertical_lines = ();
|
my @vertical_lines = ();
|
||||||
@ -52,10 +50,6 @@ sub fill_surface {
|
|||||||
+($expolygon->offset_ex(scaled_epsilon))[0], # TODO: we should use all the resulting expolygons and clip the linestrings to a multipolygon object
|
+($expolygon->offset_ex(scaled_epsilon))[0], # TODO: we should use all the resulting expolygons and clip the linestrings to a multipolygon object
|
||||||
[ @vertical_lines ],
|
[ @vertical_lines ],
|
||||||
) };
|
) };
|
||||||
for (@paths) {
|
|
||||||
$_->[0][Y] += $overlap_distance;
|
|
||||||
$_->[-1][Y] -= $overlap_distance;
|
|
||||||
}
|
|
||||||
|
|
||||||
# connect lines
|
# connect lines
|
||||||
unless ($params{dont_connect}) {
|
unless ($params{dont_connect}) {
|
||||||
|
@ -707,15 +707,16 @@ sub combine_infill {
|
|||||||
# $intersection now contains the regions that can be combined across the full amount of layers
|
# $intersection now contains the regions that can be combined across the full amount of layers
|
||||||
# so let's remove those areas from all layers
|
# so let's remove those areas from all layers
|
||||||
|
|
||||||
my @intersection_with_clearance = map $_->offset(
|
my @intersection_with_clearance = map $_->offset(
|
||||||
$layerms[-1]->solid_infill_flow->scaled_width / 2
|
$layerms[-1]->solid_infill_flow->scaled_width / 2
|
||||||
+ $layerms[-1]->perimeter_flow->scaled_width / 2
|
+ $layerms[-1]->perimeter_flow->scaled_width / 2
|
||||||
# Because fill areas for rectilinear and honeycomb are grown
|
# Because fill areas for rectilinear and honeycomb are grown
|
||||||
# later to overlap perimeters, we need to counteract that too.
|
# later to overlap perimeters, we need to counteract that too.
|
||||||
+ (($type == S_TYPE_INTERNALSOLID || $Slic3r::Config->fill_pattern =~ /(rectilinear|honeycomb)/)
|
+ (($type == S_TYPE_INTERNALSOLID || $Slic3r::Config->fill_pattern =~ /(rectilinear|honeycomb)/)
|
||||||
? $layerms[-1]->solid_infill_flow->scaled_width * &Slic3r::PERIMETER_INFILL_OVERLAP_OVER_SPACING
|
? $layerms[-1]->solid_infill_flow->scaled_width * &Slic3r::INFILL_OVERLAP_OVER_SPACING
|
||||||
: 0)
|
: 0)
|
||||||
), @$intersection;
|
), @$intersection;
|
||||||
|
|
||||||
|
|
||||||
foreach my $layerm (@layerms) {
|
foreach my $layerm (@layerms) {
|
||||||
my @this_type = grep $_->surface_type == $type, @{$layerm->fill_surfaces};
|
my @this_type = grep $_->surface_type == $type, @{$layerm->fill_surfaces};
|
||||||
|
Loading…
Reference in New Issue
Block a user