mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 22:54:08 -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
|
@ -27,6 +27,15 @@ sub process_layer {
|
|||
my ($layer, $object_copies) = @_;
|
||||
my $gcode = "";
|
||||
|
||||
# check whether we're going to apply spiralvase logic
|
||||
my $spiralvase = defined $self->spiralvase
|
||||
&& ($layer->id > 0 || $Slic3r::Config->brim_width == 0)
|
||||
&& ($layer->id >= $Slic3r::Config->skirt_height)
|
||||
&& ($layer->id >= $Slic3r::Config->bottom_solid_layers);
|
||||
|
||||
# if we're going to apply spiralvase to this layer, disable loop clipping
|
||||
$self->gcodegen->enable_loop_clipping(!$spiralvase);
|
||||
|
||||
if (!$self->second_layer_things_done && $layer->id == 1) {
|
||||
for my $t (grep $self->extruders->[$_], 0 .. $#{$Slic3r::Config->temperature}) {
|
||||
$gcode .= $self->gcodegen->set_temperature($self->extruders->[$t]->temperature, 0, $t)
|
||||
|
@ -167,10 +176,7 @@ sub process_layer {
|
|||
|
||||
# apply spiral vase post-processing if this layer contains suitable geometry
|
||||
$gcode = $self->spiralvase->process_layer($gcode, $layer)
|
||||
if defined $self->spiralvase
|
||||
&& ($layer->id > 0 || $Slic3r::Config->brim_width == 0)
|
||||
&& ($layer->id >= $Slic3r::Config->skirt_height)
|
||||
&& ($layer->id >= $Slic3r::Config->bottom_solid_layers);
|
||||
if $spiralvase;
|
||||
|
||||
return $gcode;
|
||||
}
|
||||
|
|
|
@ -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