Cache Slic3r::Fill object
This commit is contained in:
parent
312bb285a0
commit
e088d9b3f7
3 changed files with 11 additions and 8 deletions
|
@ -269,10 +269,8 @@ sub make_perimeters {
|
|||
|
||||
# fill gaps
|
||||
if ($Slic3r::Config->gap_fill_speed > 0 && $Slic3r::Config->fill_density > 0 && @gaps) {
|
||||
my $filler = Slic3r::Fill::Rectilinear->new(
|
||||
bounding_box => [ $self->layer->object->print->bounding_box ],
|
||||
layer_id => $self->layer->id,
|
||||
);
|
||||
my $filler = $self->layer->object->print->fill_maker->filler('rectilinear');
|
||||
$filler->layer_id($self->layer->id);
|
||||
|
||||
# we should probably use this code to handle thin walls and remove that logic from
|
||||
# make_surfaces(), but we need to enable dynamic extrusion width before as we can't
|
||||
|
|
|
@ -20,6 +20,7 @@ has 'regions' => (is => 'rw', default => sub {[]});
|
|||
has 'support_material_flow' => (is => 'rw');
|
||||
has 'first_layer_support_material_flow' => (is => 'rw');
|
||||
has 'has_support_material' => (is => 'lazy');
|
||||
has 'fill_maker' => (is => 'lazy');
|
||||
|
||||
# ordered collection of extrusion paths to build skirt loops
|
||||
has 'skirt' => (
|
||||
|
@ -70,6 +71,11 @@ sub _build_has_support_material {
|
|||
|| $self->config->support_material_enforce_layers > 0;
|
||||
}
|
||||
|
||||
sub _build_fill_maker {
|
||||
my $self = shift;
|
||||
return Slic3r::Fill->new(print => $self);
|
||||
}
|
||||
|
||||
sub add_model {
|
||||
my $self = shift;
|
||||
my ($model) = @_;
|
||||
|
@ -389,7 +395,7 @@ sub export_gcode {
|
|||
# this will generate extrusion paths for each layer
|
||||
$status_cb->(80, "Infilling layers");
|
||||
{
|
||||
my $fill_maker = Slic3r::Fill->new('print' => $self);
|
||||
my $fill_maker = $self->fill_maker;
|
||||
Slic3r::parallelize(
|
||||
items => sub {
|
||||
my @items = (); # [obj_idx, layer_id]
|
||||
|
|
|
@ -894,7 +894,6 @@ sub generate_support_material {
|
|||
|
||||
# generate paths for the pattern that we're going to use
|
||||
Slic3r::debugf "Generating patterns\n";
|
||||
my $fill = Slic3r::Fill->new(print => $self->print);
|
||||
my $support_patterns = [];
|
||||
my $support_interface_patterns = [];
|
||||
{
|
||||
|
@ -909,7 +908,7 @@ sub generate_support_material {
|
|||
push @angles, $angles[0] + 90;
|
||||
}
|
||||
|
||||
my $filler = $fill->filler($pattern);
|
||||
my $filler = $self->print->fill_maker->filler($pattern);
|
||||
my $make_pattern = sub {
|
||||
my ($expolygon, $density) = @_;
|
||||
|
||||
|
@ -994,7 +993,7 @@ sub generate_support_material {
|
|||
|
||||
# make a solid base on bottom layer
|
||||
if ($layer_id == 0) {
|
||||
my $filler = $fill->filler('rectilinear');
|
||||
my $filler = $self->print->fill_maker->filler('rectilinear');
|
||||
$filler->angle($Slic3r::Config->support_material_angle + 90);
|
||||
foreach my $expolygon (@$islands) {
|
||||
my @paths = $filler->fill_surface(
|
||||
|
|
Loading…
Add table
Reference in a new issue