mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
Make sure there are no gaps in spiral vase. Includes regression test. #1251
This commit is contained in:
parent
691c45d57f
commit
91cade7e8f
4 changed files with 52 additions and 10 deletions
|
@ -17,6 +17,7 @@ sub process_layer {
|
|||
my $new_gcode = "";
|
||||
my $layer_height = $layer->height;
|
||||
my $z = unscale($layer->print_z) - $layer_height;
|
||||
my $newlayer = 0;
|
||||
Slic3r::GCode::Reader->new(gcode => $gcode)->parse(sub {
|
||||
my ($reader, $cmd, $args, $info) = @_;
|
||||
|
||||
|
@ -24,11 +25,21 @@ sub process_layer {
|
|||
my $line = $info->{raw};
|
||||
$line =~ s/Z([^ ]+)/Z$z/;
|
||||
$new_gcode .= "$line\n";
|
||||
} elsif ($cmd eq 'G1' && !exists $args->{Z} && $info->{extruding} && $info->{dist_XY}) {
|
||||
$z += $info->{dist_XY} * $layer_height / $total_layer_length;
|
||||
$newlayer = 1;
|
||||
} elsif ($cmd eq 'G1' && !exists $args->{Z} && $info->{dist_XY}) {
|
||||
my $line = $info->{raw};
|
||||
$line =~ s/^G1 /sprintf 'G1 Z%.3f ', $z/e;
|
||||
$new_gcode .= "$line\n";
|
||||
if ($info->{extruding}) {
|
||||
$z += $info->{dist_XY} * $layer_height / $total_layer_length;
|
||||
$line =~ s/^G1 /sprintf 'G1 Z%.3f ', $z/e;
|
||||
$new_gcode .= "$line\n";
|
||||
} elsif ($newlayer) {
|
||||
# remove the first travel move after layer change; extrusion
|
||||
# will just blend to the first loop vertex
|
||||
# TODO: should we adjust (stretch) E for the first loop segment?
|
||||
$newlayer = 0;
|
||||
} else {
|
||||
$new_gcode .= "$line\n";
|
||||
}
|
||||
} else {
|
||||
$new_gcode .= "$info->{raw}\n";
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue