|
@@ -19,6 +19,7 @@ has 'extruders' => (is => 'rw', default => sub {[]});
|
|
|
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');
|
|
|
|
|
|
# ordered collection of extrusion paths to build skirt loops
|
|
|
has 'skirt' => (
|
|
@@ -62,6 +63,13 @@ sub _trigger_config {
|
|
|
$self->config->set('extrusion_axis', '') if $self->config->gcode_flavor eq 'no-extrusion';
|
|
|
}
|
|
|
|
|
|
+sub _build_has_support_material {
|
|
|
+ my $self = shift;
|
|
|
+ return $self->config->support_material
|
|
|
+ || $self->config->raft_layers > 0
|
|
|
+ || $self->config->support_material_enforce_layers > 0;
|
|
|
+}
|
|
|
+
|
|
|
sub add_model {
|
|
|
my $self = shift;
|
|
|
my ($model) = @_;
|
|
@@ -216,7 +224,7 @@ sub init_extruders {
|
|
|
}
|
|
|
|
|
|
# calculate support material flow
|
|
|
- if ($self->config->support_material || $self->config->raft_layers > 0) {
|
|
|
+ if ($self->has_support_material) {
|
|
|
my $extruder = $self->extruders->[$self->config->support_material_extruder-1];
|
|
|
$self->support_material_flow($extruder->make_flow(
|
|
|
width => $self->config->support_material_extrusion_width || $self->config->extrusion_width,
|
|
@@ -413,7 +421,7 @@ sub export_gcode {
|
|
|
}
|
|
|
|
|
|
# generate support material
|
|
|
- if ($Slic3r::Config->support_material || $Slic3r::Config->raft_layers > 0) {
|
|
|
+ if ($self->has_support_material) {
|
|
|
$status_cb->(85, "Generating support material");
|
|
|
$_->generate_support_material for @{$self->objects};
|
|
|
}
|
|
@@ -510,7 +518,7 @@ EOF
|
|
|
}
|
|
|
}
|
|
|
# generate support material
|
|
|
- if (($Slic3r::Config->support_material || $self->config->raft_layers > 0) && $layer_id > 0) {
|
|
|
+ if ($self->has_support_material && $layer_id > 0) {
|
|
|
my (@supported_slices, @unsupported_slices) = ();
|
|
|
foreach my $expolygon (@current_layer_slices) {
|
|
|
my $intersection = intersection_ex(
|
|
@@ -801,7 +809,7 @@ sub write_gcode {
|
|
|
|
|
|
# extrude support material before other things because it might use a lower Z
|
|
|
# and also because we avoid travelling on other things when printing it
|
|
|
- if ($Slic3r::Config->support_material || $self->config->raft_layers > 0) {
|
|
|
+ if ($self->has_support_material) {
|
|
|
$gcode .= $gcodegen->move_z($layer->support_material_contact_z)
|
|
|
if ($layer->support_contact_fills && @{ $layer->support_contact_fills->paths });
|
|
|
$gcode .= $gcodegen->set_extruder($self->extruders->[$Slic3r::Config->support_material_extruder-1]);
|