diff --git a/lib/Slic3r/GUI/MainFrame.pm b/lib/Slic3r/GUI/MainFrame.pm index 5df8e16e4..5db68cd3b 100644 --- a/lib/Slic3r/GUI/MainFrame.pm +++ b/lib/Slic3r/GUI/MainFrame.pm @@ -476,7 +476,7 @@ sub quick_slice { # show processbar dialog $progress_dialog = Wx::ProgressDialog->new(L('Slicing…'), L("Processing ").$input_file_basename."…", - 100, $self, 0); + 100, $self, 4); $progress_dialog->Pulse; { diff --git a/lib/Slic3r/Print.pm b/lib/Slic3r/Print.pm index fc28a192e..e980e759f 100644 --- a/lib/Slic3r/Print.pm +++ b/lib/Slic3r/Print.pm @@ -113,10 +113,18 @@ sub export_png { my $self = shift; my %params = @_; - $_->slice for @{$self->objects}; + my @sobjects = @{$self->objects}; + my $objnum = scalar @sobjects; + for(my $oi = 0; $oi < $objnum; $oi++) + { + $sobjects[$oi]->slice; + $self->status_cb->(($oi + 1)*100/$objnum - 1, "Slicing..."); + } my $fh = $params{output_file}; + $self->status_cb->(90, "Exporting zipped archive..."); $self->print_to_png($fh); + $self->status_cb->(100, "Done."); } # Export SVG slices for the offline SLA printing. @@ -125,7 +133,13 @@ sub export_svg { my $self = shift; my %params = @_; - $_->slice for @{$self->objects}; + my @sobjects = @{$self->objects}; + my $objnum = scalar @sobjects; + for(my $oi = 0; $oi < $objnum; $oi++) + { + $sobjects[$oi]->slice; + $self->status_cb->(($oi + 1)*100/$objnum - 1, "Slicing..."); + } my $fh = $params{output_fh}; if (!$fh) { diff --git a/lib/Slic3r/Print/Object.pm b/lib/Slic3r/Print/Object.pm index e275fdde5..088c0a168 100644 --- a/lib/Slic3r/Print/Object.pm +++ b/lib/Slic3r/Print/Object.pm @@ -35,7 +35,7 @@ sub slice { return if $self->step_done(STEP_SLICE); $self->set_step_started(STEP_SLICE); - $self->print->status_cb->(10, "Processing triangulated mesh"); + # $self->print->status_cb->(10, "Processing triangulated mesh"); $self->_slice; diff --git a/xs/src/libslic3r/Print.cpp b/xs/src/libslic3r/Print.cpp index b76554724..9c879fb34 100644 --- a/xs/src/libslic3r/Print.cpp +++ b/xs/src/libslic3r/Print.cpp @@ -1254,6 +1254,7 @@ std::string Print::output_filepath(const std::string &path) void Print::set_status(int percent, const std::string &message) { printf("Print::status %d => %s\n", percent, message.c_str()); + std::cout.flush(); } /* @@ -1463,9 +1464,13 @@ void Print::print_to(std::string dirpath, FilePrinter printer(std::forward(args)...); printer.layers(layers.size()); // Allocate space for all the layers + set_status(0, "Rasterizing and compressing sliced layers"); + + int st_prev = 0; + // Method that prints one layer - auto process_layer = [this, &layers, &printer, print_bb, dir, cx, cy] - (unsigned layer_id) + auto process_layer = [this, &layers, &printer, &st_prev, + print_bb, dir, cx, cy] (unsigned layer_id) { Layer& l = *(layers[layer_id]); @@ -1504,7 +1509,11 @@ void Print::print_to(std::string dirpath, printer.finishLayer(layer_id); // Finish the layer for later saving it. - std::cout << "Layer " << layer_id << " processed." << std::endl; + auto st = static_cast(layer_id*100.0/layers.size()); + if(st > st_prev) { + set_status(st, "processed"); + st_prev = st; + } // printer.saveLayer(layer_id, dir); We could save the layer immediately }; @@ -1518,7 +1527,9 @@ void Print::print_to(std::string dirpath, // for(unsigned l = 0; l < layers.size(); ++l) process_layer(l); // Save the print into the file system. + set_status(0, "Writing layers to disk"); printer.save(dir); + set_status(100, "Done."); } void Print::print_to_png(std::string dirpath, long width_px, long height_px,