2011-09-26 09:42:08 +00:00
|
|
|
package Slic3r::Extruder;
|
2014-04-07 23:42:29 +00:00
|
|
|
use strict;
|
|
|
|
use warnings;
|
2011-09-26 09:42:08 +00:00
|
|
|
|
2013-12-30 17:28:41 +00:00
|
|
|
require Exporter;
|
|
|
|
our @ISA = qw(Exporter);
|
|
|
|
our @EXPORT_OK = qw(EXTRUDER_ROLE_PERIMETER EXTRUDER_ROLE_INFILL EXTRUDER_ROLE_SUPPORT_MATERIAL
|
|
|
|
EXTRUDER_ROLE_SUPPORT_MATERIAL_INTERFACE);
|
|
|
|
our %EXPORT_TAGS = (roles => \@EXPORT_OK);
|
|
|
|
|
2013-03-17 01:22:50 +00:00
|
|
|
use Slic3r::Geometry qw(PI scale);
|
2011-12-07 18:33:59 +00:00
|
|
|
|
2014-04-07 23:42:29 +00:00
|
|
|
# has 'e_per_mm3' => (is => 'lazy');
|
|
|
|
# has 'retract_speed_mm_min' => (is => 'lazy');
|
2011-09-26 09:42:08 +00:00
|
|
|
|
2013-12-30 17:28:41 +00:00
|
|
|
use constant EXTRUDER_ROLE_PERIMETER => 1;
|
|
|
|
use constant EXTRUDER_ROLE_INFILL => 2;
|
|
|
|
use constant EXTRUDER_ROLE_SUPPORT_MATERIAL => 3;
|
|
|
|
use constant EXTRUDER_ROLE_SUPPORT_MATERIAL_INTERFACE => 4;
|
2013-02-27 09:43:50 +00:00
|
|
|
|
2014-04-26 21:28:32 +00:00
|
|
|
|
2014-04-07 23:42:29 +00:00
|
|
|
sub e_per_mm3 {
|
2012-05-20 18:07:39 +00:00
|
|
|
my $self = shift;
|
2012-07-03 16:05:31 +00:00
|
|
|
return $self->extrusion_multiplier * (4 / (($self->filament_diameter ** 2) * PI));
|
2012-05-20 18:07:39 +00:00
|
|
|
}
|
|
|
|
|
2014-04-07 23:42:29 +00:00
|
|
|
sub retract_speed_mm_min {
|
2012-08-07 19:08:56 +00:00
|
|
|
my $self = shift;
|
|
|
|
return $self->retract_speed * 60;
|
|
|
|
}
|
|
|
|
|
2013-12-24 10:29:31 +00:00
|
|
|
sub scaled_wipe_distance {
|
2013-12-24 11:03:30 +00:00
|
|
|
my ($self, $travel_speed) = @_;
|
2013-10-13 15:04:47 +00:00
|
|
|
|
|
|
|
# how far do we move in XY at travel_speed for the time needed to consume
|
|
|
|
# retract_length at retract_speed?
|
2013-06-03 20:49:47 +00:00
|
|
|
# reduce feedrate a bit; travel speed is often too high to move on existing material
|
|
|
|
# too fast = ripping of existing material; too slow = short wipe path, thus more blob
|
2013-12-24 10:29:31 +00:00
|
|
|
return scale($self->retract_length / $self->retract_speed * $travel_speed * 0.8);
|
2013-03-17 01:22:50 +00:00
|
|
|
}
|
|
|
|
|
2013-08-28 18:13:18 +00:00
|
|
|
sub extruded_volume {
|
2014-01-11 13:42:31 +00:00
|
|
|
my ($self, $E) = @_;
|
|
|
|
return $E * ($self->filament_diameter**2) * PI/4;
|
2013-08-28 18:13:18 +00:00
|
|
|
}
|
|
|
|
|
2012-10-29 10:17:57 +00:00
|
|
|
sub e_per_mm {
|
2014-01-03 17:27:46 +00:00
|
|
|
my ($self, $mm3_per_mm) = @_;
|
|
|
|
return $mm3_per_mm * $self->e_per_mm3;
|
2012-10-29 10:17:57 +00:00
|
|
|
}
|
|
|
|
|
2011-09-26 09:42:08 +00:00
|
|
|
1;
|