mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-07 14:04:11 -06:00
Bugfix: M73 was exceeding 100% when multiple objects were printed together. #1912
This commit is contained in:
parent
342513a4de
commit
64853d5661
3 changed files with 49 additions and 16 deletions
|
@ -82,6 +82,7 @@ sub change_layer {
|
|||
|
||||
my $gcode = "";
|
||||
if ($self->config->gcode_flavor =~ /^(?:makerware|sailfish)$/) {
|
||||
# TODO: cap this to 99% and add an explicit M73 P100 in the end G-code
|
||||
$gcode .= sprintf "M73 P%s%s\n",
|
||||
int(99 * ($self->_layer_index / ($self->layer_count - 1))),
|
||||
($self->config->gcode_comments ? ' ; update progress' : '');
|
||||
|
|
|
@ -3,7 +3,7 @@ use Moo;
|
|||
|
||||
use File::Basename qw(basename fileparse);
|
||||
use File::Spec;
|
||||
use List::Util qw(min max first);
|
||||
use List::Util qw(min max first sum);
|
||||
use Slic3r::ExtrusionPath ':roles';
|
||||
use Slic3r::Flow ':roles';
|
||||
use Slic3r::Geometry qw(X Y Z X1 Y1 X2 Y2 MIN MAX PI scale unscale move_points chained_path
|
||||
|
@ -855,10 +855,20 @@ sub write_gcode {
|
|||
# prepare the helper object for replacing placeholders in custom G-code and output filename
|
||||
$self->placeholder_parser->update_timestamp;
|
||||
|
||||
# estimate the total number of layer changes
|
||||
# TODO: only do this when M73 is enabled
|
||||
my $layer_count;
|
||||
if ($self->config->complete_objects) {
|
||||
$layer_count = sum(map { $_->layer_count * @{$_->copies} } @{$self->objects});
|
||||
} else {
|
||||
# if sequential printing is not enable, all copies of the same object share the same layer change command(s)
|
||||
$layer_count = sum(map { $_->layer_count } @{$self->objects});
|
||||
}
|
||||
|
||||
# set up our helper object
|
||||
my $gcodegen = Slic3r::GCode->new(
|
||||
placeholder_parser => $self->placeholder_parser,
|
||||
layer_count => $self->layer_count,
|
||||
layer_count => $layer_count,
|
||||
);
|
||||
$gcodegen->config->apply_print_config($self->config);
|
||||
$gcodegen->set_extruders($self->extruders, $self->config);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue