Use honeycomb pattern for support material
This commit is contained in:
parent
54e1d934a7
commit
91d1b21c40
@ -16,6 +16,7 @@ use Slic3r::Geometry::Clipper qw(union_ex diff_ex);
|
|||||||
|
|
||||||
|
|
||||||
has 'print' => (is => 'ro', required => 1);
|
has 'print' => (is => 'ro', required => 1);
|
||||||
|
has 'max_print_dimension' => (is => 'rw');
|
||||||
has 'fillers' => (is => 'rw', default => sub { {} });
|
has 'fillers' => (is => 'rw', default => sub { {} });
|
||||||
|
|
||||||
our %FillTypes = (
|
our %FillTypes = (
|
||||||
@ -31,12 +32,22 @@ our %FillTypes = (
|
|||||||
|
|
||||||
sub BUILD {
|
sub BUILD {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
$self->fillers->{$_} ||= $FillTypes{$_}->new(print => $self->print)
|
|
||||||
for ('rectilinear', $Slic3r::fill_pattern, $Slic3r::solid_fill_pattern);
|
|
||||||
|
|
||||||
my $print_size = $self->print->size;
|
my $print_size = $self->print->size;
|
||||||
my $max_print_dimension = ($print_size->[X] > $print_size->[Y] ? $print_size->[X] : $print_size->[Y]) * sqrt(2);
|
my $max_print_dimension = ($print_size->[X] > $print_size->[Y] ? $print_size->[X] : $print_size->[Y]) * sqrt(2);
|
||||||
$_->max_print_dimension($max_print_dimension) for values %{$self->fillers};
|
$self->max_print_dimension($max_print_dimension);
|
||||||
|
|
||||||
|
$self->filler($_) for ('rectilinear', $Slic3r::fill_pattern, $Slic3r::solid_fill_pattern);
|
||||||
|
}
|
||||||
|
|
||||||
|
sub filler {
|
||||||
|
my $self = shift;
|
||||||
|
my ($filler) = @_;
|
||||||
|
if (!$self->fillers->{$filler}) {
|
||||||
|
$self->fillers->{$filler} = $FillTypes{$filler}->new(print => $self->print);
|
||||||
|
$self->fillers->{$filler}->max_print_dimension($self->max_print_dimension);
|
||||||
|
}
|
||||||
|
return $self->fillers->{$filler};
|
||||||
}
|
}
|
||||||
|
|
||||||
sub make_fill {
|
sub make_fill {
|
||||||
|
@ -443,13 +443,14 @@ sub generate_support_material {
|
|||||||
@{union_ex([ map @$_, @unsupported_expolygons ])};
|
@{union_ex([ map @$_, @unsupported_expolygons ])};
|
||||||
|
|
||||||
my $fill = Slic3r::Fill->new(print => $params{print});
|
my $fill = Slic3r::Fill->new(print => $params{print});
|
||||||
foreach my $angle (0, 90) {
|
foreach my $layer (map $self->layers->[$_], 0,1,2) { # ugly hack
|
||||||
|
$fill->filler('honeycomb')->layer($layer);
|
||||||
my @patterns = ();
|
my @patterns = ();
|
||||||
foreach my $expolygon (@support_material_areas) {
|
foreach my $expolygon (@support_material_areas) {
|
||||||
my @paths = $fill->fillers->{rectilinear}->fill_surface(
|
my @paths = $fill->filler('honeycomb')->fill_surface(
|
||||||
Slic3r::Surface->new(
|
Slic3r::Surface->new(
|
||||||
expolygon => $expolygon,
|
expolygon => $expolygon,
|
||||||
bridge_angle => $Slic3r::fill_angle + 45 + $angle,
|
#bridge_angle => $Slic3r::fill_angle + 45 + $angle,
|
||||||
),
|
),
|
||||||
density => 0.20,
|
density => 0.20,
|
||||||
flow_spacing => $Slic3r::flow_spacing,
|
flow_spacing => $Slic3r::flow_spacing,
|
||||||
@ -483,7 +484,7 @@ sub generate_support_material {
|
|||||||
foreach my $expolygon (@$expolygons) {
|
foreach my $expolygon (@$expolygons) {
|
||||||
push @paths, map $_->clip_with_expolygon($expolygon),
|
push @paths, map $_->clip_with_expolygon($expolygon),
|
||||||
map $_->clip_with_polygon($expolygon->bounding_box_polygon),
|
map $_->clip_with_polygon($expolygon->bounding_box_polygon),
|
||||||
@{$support_patterns->[ $layer_id % 2 ]};
|
@{$support_patterns->[ $layer_id % @$support_patterns ]};
|
||||||
};
|
};
|
||||||
return @paths;
|
return @paths;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user