~ubuntu-branches/ubuntu/utopic/slic3r/utopic

« back to all changes in this revision

Viewing changes to lib/Slic3r/Extruder.pm

  • Committer: Package Import Robot
  • Author(s): Chow Loong Jin
  • Date: 2014-06-17 01:27:26 UTC
  • Revision ID: package-import@ubuntu.com-20140617012726-2wrs4zdo251nr4vg
Tags: upstream-1.1.4+dfsg
ImportĀ upstreamĀ versionĀ 1.1.4+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package Slic3r::Extruder;
 
2
use strict;
 
3
use warnings;
 
4
 
 
5
require Exporter;
 
6
our @ISA = qw(Exporter);
 
7
our @EXPORT_OK   = qw(EXTRUDER_ROLE_PERIMETER EXTRUDER_ROLE_INFILL EXTRUDER_ROLE_SUPPORT_MATERIAL
 
8
                    EXTRUDER_ROLE_SUPPORT_MATERIAL_INTERFACE);
 
9
our %EXPORT_TAGS = (roles => \@EXPORT_OK);
 
10
 
 
11
use Slic3r::Geometry qw(PI scale);
 
12
 
 
13
# has 'e_per_mm3'                 => (is => 'lazy');
 
14
# has 'retract_speed_mm_min'      => (is => 'lazy');
 
15
 
 
16
use constant EXTRUDER_ROLE_PERIMETER                    => 1;
 
17
use constant EXTRUDER_ROLE_INFILL                       => 2;
 
18
use constant EXTRUDER_ROLE_SUPPORT_MATERIAL             => 3;
 
19
use constant EXTRUDER_ROLE_SUPPORT_MATERIAL_INTERFACE   => 4;
 
20
 
 
21
 
 
22
sub e_per_mm3 {
 
23
    my $self = shift;
 
24
    return $self->extrusion_multiplier * (4 / (($self->filament_diameter ** 2) * PI));
 
25
}
 
26
 
 
27
sub retract_speed_mm_min {
 
28
    my $self = shift;
 
29
    return $self->retract_speed * 60;
 
30
}
 
31
 
 
32
sub scaled_wipe_distance {
 
33
    my ($self, $travel_speed) = @_;
 
34
    
 
35
    # how far do we move in XY at travel_speed for the time needed to consume
 
36
    # retract_length at retract_speed?
 
37
    # reduce feedrate a bit; travel speed is often too high to move on existing material
 
38
    # too fast = ripping of existing material; too slow = short wipe path, thus more blob
 
39
    return scale($self->retract_length / $self->retract_speed * $travel_speed * 0.8);
 
40
}
 
41
 
 
42
sub extruded_volume {
 
43
    my ($self, $E) = @_;
 
44
    return $E * ($self->filament_diameter**2) * PI/4;
 
45
}
 
46
 
 
47
sub e_per_mm {
 
48
    my ($self, $mm3_per_mm) = @_;
 
49
    return $mm3_per_mm * $self->e_per_mm3;
 
50
}
 
51
 
 
52
1;