New extrusion math

This commit is contained in:
Alessandro Ranellucci 2011-10-01 18:10:33 +02:00
parent ea88cad8e3
commit 55f2247cd9
4 changed files with 13 additions and 10 deletions

View File

@ -26,7 +26,7 @@ use Slic3r::Surface;
use Slic3r::Surface::Collection;
# printer options
our $nozzle_diameter = 0.45;
our $nozzle_diameter = 0.5;
our $print_center = [100,100]; # object will be centered around this point
our $use_relative_e_distances = 0;
our $z_offset = 0;
@ -38,11 +38,12 @@ our $filament_packing_density = 0.85;
# speed options
our $print_feed_rate = 60; # mm/sec
our $travel_feed_rate = 130; # mm/sec
our $bottom_layer_speed_ratio = 0.6;
our $bottom_layer_speed_ratio = 0.3;
# accuracy options
our $resolution = 0.001;
our $layer_height = 0.4;
our $thickness_ratio = 1;
our $flow_width;
# print options
@ -50,10 +51,10 @@ our $perimeter_offsets = 3;
our $solid_layers = 3;
our $fill_density = 0.4; # 1 = 100%
our $fill_angle = 0;
our $temperature = 195;
our $temperature = 200;
# retraction options
our $retract_length = 2; # mm
our $retract_length = 1; # mm
our $retract_restart_extra = 0; # mm
our $retract_speed = 40; # mm/sec

View File

@ -87,10 +87,9 @@ sub extrude {
# calculate how much filament to drive into the extruder
# to get the desired amount of extruded plastic
my $e = $line->a->distance_to($line->b) * $Slic3r::resolution
* $Slic3r::flow_width
* $Slic3r::layer_height
/ (($Slic3r::filament_diameter ** 2) * PI)
/ $Slic3r::filament_packing_density;
* (($Slic3r::nozzle_diameter**2) / ($Slic3r::filament_diameter ** 2))
* $Slic3r::thickness_ratio
* $Slic3r::filament_packing_density;
$gcode .= $self->G1($line->b, undef, $e, $description);
}

View File

@ -165,7 +165,7 @@ sub export_gcode {
# write start commands to file
# TODO: this must be customizable by user
print $fh "G28 ; home all axes\n";
printf $fh "M109 S%d ; wait for temperature to be reached\n", $Slic3r::temperature;
printf $fh "M104 S%d ; wait for temperature to be reached\n", $Slic3r::temperature;
print $fh "G90 ; use absolute coordinates\n";
print $fh "G21 ; set units to millimeters\n";
if ($Slic3r::use_relative_e_distances) {

View File

@ -13,6 +13,8 @@ use Slic3r;
use Time::HiRes qw(gettimeofday tv_interval);
use XXX;
use constant PI => 4 * atan2(1, 1);
my %opt;
GetOptions(
'help' => sub { usage() },
@ -78,7 +80,8 @@ GetOptions(
if $Slic3r::nozzle_diameter < 0;
die "--layer-height can't be greater than --nozzle-diameter\n"
if $Slic3r::layer_height > $Slic3r::nozzle_diameter;
$Slic3r::flow_width = 4 * (($Slic3r::nozzle_diameter/2)**2) / $Slic3r::layer_height;
$Slic3r::flow_width = ($Slic3r::nozzle_diameter**2)
* $Slic3r::thickness_ratio * PI / (4 * $Slic3r::layer_height);
Slic3r::debugf "Flow width = $Slic3r::flow_width\n";
# --perimeters