mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 13:17:54 -06:00
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
|
# fill gaps
|
||||||
if ($Slic3r::Config->gap_fill_speed > 0 && $Slic3r::Config->fill_density > 0 && @gaps) {
|
if ($Slic3r::Config->gap_fill_speed > 0 && $Slic3r::Config->fill_density > 0 && @gaps) {
|
||||||
my $filler = Slic3r::Fill::Rectilinear->new(
|
my $filler = $self->layer->object->print->fill_maker->filler('rectilinear');
|
||||||
bounding_box => [ $self->layer->object->print->bounding_box ],
|
$filler->layer_id($self->layer->id);
|
||||||
layer_id => $self->layer->id,
|
|
||||||
);
|
|
||||||
|
|
||||||
# we should probably use this code to handle thin walls and remove that logic from
|
# 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
|
# 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 'support_material_flow' => (is => 'rw');
|
||||||
has 'first_layer_support_material_flow' => (is => 'rw');
|
has 'first_layer_support_material_flow' => (is => 'rw');
|
||||||
has 'has_support_material' => (is => 'lazy');
|
has 'has_support_material' => (is => 'lazy');
|
||||||
|
has 'fill_maker' => (is => 'lazy');
|
||||||
|
|
||||||
# ordered collection of extrusion paths to build skirt loops
|
# ordered collection of extrusion paths to build skirt loops
|
||||||
has 'skirt' => (
|
has 'skirt' => (
|
||||||
|
@ -70,6 +71,11 @@ sub _build_has_support_material {
|
||||||
|| $self->config->support_material_enforce_layers > 0;
|
|| $self->config->support_material_enforce_layers > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _build_fill_maker {
|
||||||
|
my $self = shift;
|
||||||
|
return Slic3r::Fill->new(print => $self);
|
||||||
|
}
|
||||||
|
|
||||||
sub add_model {
|
sub add_model {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($model) = @_;
|
my ($model) = @_;
|
||||||
|
@ -389,7 +395,7 @@ sub export_gcode {
|
||||||
# this will generate extrusion paths for each layer
|
# this will generate extrusion paths for each layer
|
||||||
$status_cb->(80, "Infilling layers");
|
$status_cb->(80, "Infilling layers");
|
||||||
{
|
{
|
||||||
my $fill_maker = Slic3r::Fill->new('print' => $self);
|
my $fill_maker = $self->fill_maker;
|
||||||
Slic3r::parallelize(
|
Slic3r::parallelize(
|
||||||
items => sub {
|
items => sub {
|
||||||
my @items = (); # [obj_idx, layer_id]
|
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
|
# generate paths for the pattern that we're going to use
|
||||||
Slic3r::debugf "Generating patterns\n";
|
Slic3r::debugf "Generating patterns\n";
|
||||||
my $fill = Slic3r::Fill->new(print => $self->print);
|
|
||||||
my $support_patterns = [];
|
my $support_patterns = [];
|
||||||
my $support_interface_patterns = [];
|
my $support_interface_patterns = [];
|
||||||
{
|
{
|
||||||
|
@ -909,7 +908,7 @@ sub generate_support_material {
|
||||||
push @angles, $angles[0] + 90;
|
push @angles, $angles[0] + 90;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $filler = $fill->filler($pattern);
|
my $filler = $self->print->fill_maker->filler($pattern);
|
||||||
my $make_pattern = sub {
|
my $make_pattern = sub {
|
||||||
my ($expolygon, $density) = @_;
|
my ($expolygon, $density) = @_;
|
||||||
|
|
||||||
|
@ -994,7 +993,7 @@ sub generate_support_material {
|
||||||
|
|
||||||
# make a solid base on bottom layer
|
# make a solid base on bottom layer
|
||||||
if ($layer_id == 0) {
|
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);
|
$filler->angle($Slic3r::Config->support_material_angle + 90);
|
||||||
foreach my $expolygon (@$islands) {
|
foreach my $expolygon (@$islands) {
|
||||||
my @paths = $filler->fill_surface(
|
my @paths = $filler->fill_surface(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue