From 08047c11eb0a57f3c1c5b520c4024ca30a9e1468 Mon Sep 17 00:00:00 2001 From: Alessandro Ranellucci Date: Fri, 13 Jun 2014 20:18:34 +0200 Subject: [PATCH] Minor fixes to make_skirt and make_brim --- lib/Slic3r/Print.pm | 23 +++++++++++++++-------- lib/Slic3r/Print/Object.pm | 8 +++++--- lib/Slic3r/Print/Simple.pm | 3 --- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index f2b1332d0..43048bd69 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -409,16 +409,17 @@ sub export_gcode { my $self = shift; my %params = @_; - my $status_cb = $self->status_cb // sub {}; + # prerequisites + $self->process; # output everything to a G-code file my $output_file = $self->expanded_output_filepath($params{output_file}); - $status_cb->(90, "Exporting G-code" . ($output_file ? " to $output_file" : "")); + $self->status_cb->(90, "Exporting G-code" . ($output_file ? " to $output_file" : "")); $self->write_gcode($params{output_fh} || $output_file); # run post-processing scripts if (@{$self->config->post_process}) { - $status_cb->(95, "Running post-processing scripts"); + $self->status_cb->(95, "Running post-processing scripts"); $self->config->setenv; for (@{$self->config->post_process}) { Slic3r::debugf " '%s' '%s'\n", $_, $output_file; @@ -528,14 +529,17 @@ sub make_skirt { return if $self->step_done(STEP_SKIRT); $self->set_step_started(STEP_SKIRT); - $self->status_cb->(88, "Generating skirt/brim"); # since this method must be idempotent, we clear skirt paths *before* # checking whether we need to generate them $self->skirt->clear; - return unless $self->config->skirts > 0 - || ($self->config->ooze_prevention && @{$self->extruders} > 1); + if ($self->config->skirts == 0 + && (!$self->config->ooze_prevention || @{$self->extruders} == 1)) { + $self->set_step_done(STEP_SKIRT); + return; + } + $self->status_cb->(88, "Generating skirt"); # First off we need to decide how tall the skirt must be. # The skirt_height option from config is expressed in layers, but our @@ -655,13 +659,16 @@ sub make_brim { return if $self->step_done(STEP_BRIM); $self->set_step_started(STEP_BRIM); - $self->status_cb->(88, "Generating skirt/brim"); # since this method must be idempotent, we clear brim paths *before* # checking whether we need to generate them $self->brim->clear; - return unless $self->config->brim_width > 0; + if ($self->config->brim_width == 0) { + $self->set_step_done(STEP_BRIM); + return; + } + $self->status_cb->(88, "Generating brim"); # brim is only printed on first layer and uses support material extruder my $first_layer_height = $self->objects->[0]->config->get_abs_value('first_layer_height'); diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index 878544706..f43b0d440 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -582,12 +582,14 @@ sub generate_support_material { return if $self->step_done(STEP_SUPPORTMATERIAL); $self->set_step_started(STEP_SUPPORTMATERIAL); - $self->print->status_cb->(85, "Generating support material"); $self->clear_support_layers; - return unless ($self->config->support_material || $self->config->raft_layers > 0) - && scalar(@{$self->layers}) >= 2; + if ((!$self->config->support_material && $self->config->raft_layers == 0) || scalar(@{$self->layers}) < 2) { + $self->set_step_done(STEP_SUPPORTMATERIAL); + return; + } + $self->print->status_cb->(85, "Generating support material"); my $first_layer_flow = Slic3r::Flow->new_from_width( width => ($self->config->first_layer_extrusion_width || $self->config->support_material_extrusion_width), diff --git a/lib/Slic3r/Print/Simple.pm b/lib/Slic3r/Print/Simple.pm index 109145e0a..27ca4126d 100644 --- a/lib/Slic3r/Print/Simple.pm +++ b/lib/Slic3r/Print/Simple.pm @@ -88,10 +88,7 @@ sub export_gcode { my ($self) = @_; $self->_before_export; - - $self->_print->process; $self->_print->export_gcode(output_file => $self->output_file); - $self->_after_export; }