Minor fixes to make_skirt and make_brim

This commit is contained in:
Alessandro Ranellucci 2014-06-13 20:18:34 +02:00
parent 4d76d05bbb
commit 08047c11eb
3 changed files with 20 additions and 14 deletions

View file

@ -409,16 +409,17 @@ sub export_gcode {
my $self = shift; my $self = shift;
my %params = @_; my %params = @_;
my $status_cb = $self->status_cb // sub {}; # prerequisites
$self->process;
# output everything to a G-code file # output everything to a G-code file
my $output_file = $self->expanded_output_filepath($params{output_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); $self->write_gcode($params{output_fh} || $output_file);
# run post-processing scripts # run post-processing scripts
if (@{$self->config->post_process}) { if (@{$self->config->post_process}) {
$status_cb->(95, "Running post-processing scripts"); $self->status_cb->(95, "Running post-processing scripts");
$self->config->setenv; $self->config->setenv;
for (@{$self->config->post_process}) { for (@{$self->config->post_process}) {
Slic3r::debugf " '%s' '%s'\n", $_, $output_file; Slic3r::debugf " '%s' '%s'\n", $_, $output_file;
@ -528,14 +529,17 @@ sub make_skirt {
return if $self->step_done(STEP_SKIRT); return if $self->step_done(STEP_SKIRT);
$self->set_step_started(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* # since this method must be idempotent, we clear skirt paths *before*
# checking whether we need to generate them # checking whether we need to generate them
$self->skirt->clear; $self->skirt->clear;
return unless $self->config->skirts > 0 if ($self->config->skirts == 0
|| ($self->config->ooze_prevention && @{$self->extruders} > 1); && (!$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. # First off we need to decide how tall the skirt must be.
# The skirt_height option from config is expressed in layers, but our # 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); return if $self->step_done(STEP_BRIM);
$self->set_step_started(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* # since this method must be idempotent, we clear brim paths *before*
# checking whether we need to generate them # checking whether we need to generate them
$self->brim->clear; $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 # 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'); my $first_layer_height = $self->objects->[0]->config->get_abs_value('first_layer_height');

View file

@ -582,12 +582,14 @@ sub generate_support_material {
return if $self->step_done(STEP_SUPPORTMATERIAL); return if $self->step_done(STEP_SUPPORTMATERIAL);
$self->set_step_started(STEP_SUPPORTMATERIAL); $self->set_step_started(STEP_SUPPORTMATERIAL);
$self->print->status_cb->(85, "Generating support material");
$self->clear_support_layers; $self->clear_support_layers;
return unless ($self->config->support_material || $self->config->raft_layers > 0) if ((!$self->config->support_material && $self->config->raft_layers == 0) || scalar(@{$self->layers}) < 2) {
&& 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( my $first_layer_flow = Slic3r::Flow->new_from_width(
width => ($self->config->first_layer_extrusion_width || $self->config->support_material_extrusion_width), width => ($self->config->first_layer_extrusion_width || $self->config->support_material_extrusion_width),

View file

@ -88,10 +88,7 @@ sub export_gcode {
my ($self) = @_; my ($self) = @_;
$self->_before_export; $self->_before_export;
$self->_print->process;
$self->_print->export_gcode(output_file => $self->output_file); $self->_print->export_gcode(output_file => $self->output_file);
$self->_after_export; $self->_after_export;
} }