mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-08 06:24:01 -06:00
Merge branch 'test-dual-retraction'
This commit is contained in:
commit
8cd8e8b209
4 changed files with 63 additions and 21 deletions
|
@ -14,6 +14,7 @@ has 'id' => (is => 'rw', required => 1);
|
|||
has $_ => (is => 'ro', required => 1) for @{&OPTIONS};
|
||||
|
||||
has 'retracted' => (is => 'rw', default => sub {0} );
|
||||
has 'restart_extra' => (is => 'rw', default => sub {0} );
|
||||
has 'e_per_mm3' => (is => 'lazy');
|
||||
has 'retract_speed_mm_min' => (is => 'lazy');
|
||||
has '_mm3_per_mm_cache' => (is => 'ro', default => sub {{}});
|
||||
|
|
|
@ -184,7 +184,7 @@ sub extrude_path {
|
|||
if !points_coincide($self->last_pos, $path->points->[0]);
|
||||
|
||||
# compensate retraction
|
||||
$gcode .= $self->unretract if $self->extruder->retracted;
|
||||
$gcode .= $self->unretract;
|
||||
|
||||
my $area; # mm^3 of extrudate per mm of tool movement
|
||||
if ($path->role == EXTR_ROLE_BRIDGE) {
|
||||
|
@ -279,7 +279,8 @@ sub retract {
|
|||
$gcode .= $self->G1(@$lift);
|
||||
}
|
||||
}
|
||||
$self->extruder->retracted($self->extruder->retracted + $length + $restart_extra);
|
||||
$self->extruder->retracted($self->extruder->retracted + $length);
|
||||
$self->extruder->restart_extra($restart_extra);
|
||||
$self->lifted($self->extruder->retract_lift) if $lift;
|
||||
|
||||
# reset extrusion distance during retracts
|
||||
|
@ -300,9 +301,13 @@ sub unretract {
|
|||
$self->lifted(0);
|
||||
}
|
||||
|
||||
$self->speed('retract');
|
||||
$gcode .= $self->G0(undef, undef, $self->extruder->retracted, "compensate retraction");
|
||||
$self->extruder->retracted(0);
|
||||
my $to_unretract = $self->extruder->retracted + $self->extruder->restart_extra;
|
||||
if ($to_unretract) {
|
||||
$self->speed('retract');
|
||||
$gcode .= $self->G0(undef, undef, $to_unretract, "compensate retraction");
|
||||
$self->extruder->retracted(0);
|
||||
$self->extruder->restart_extra(0);
|
||||
}
|
||||
|
||||
return $gcode;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,10 @@ package Slic3r::Test;
|
|||
use strict;
|
||||
use warnings;
|
||||
|
||||
require Exporter;
|
||||
our @ISA = qw(Exporter);
|
||||
our @EXPORT_OK = qw(_eq);
|
||||
|
||||
use IO::Scalar;
|
||||
use Slic3r::Geometry qw(epsilon);
|
||||
|
||||
|
@ -30,6 +34,7 @@ sub init_print {
|
|||
|
||||
my $config = Slic3r::Config->new_from_defaults;
|
||||
$config->apply($params{config}) if $params{config};
|
||||
$config->set('gcode_comments', 1) if $ENV{SLIC3R_TESTS_GCODE};
|
||||
|
||||
my $print = Slic3r::Print->new(config => $config);
|
||||
$print->add_model($model);
|
||||
|
@ -48,7 +53,7 @@ sub gcode {
|
|||
return $gcode;
|
||||
}
|
||||
|
||||
sub compare {
|
||||
sub _eq {
|
||||
my ($a, $b) = @_;
|
||||
return abs($a - $b) < epsilon;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue