New extrusion math
This commit is contained in:
parent
ea88cad8e3
commit
55f2247cd9
@ -26,7 +26,7 @@ use Slic3r::Surface;
|
|||||||
use Slic3r::Surface::Collection;
|
use Slic3r::Surface::Collection;
|
||||||
|
|
||||||
# printer options
|
# 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 $print_center = [100,100]; # object will be centered around this point
|
||||||
our $use_relative_e_distances = 0;
|
our $use_relative_e_distances = 0;
|
||||||
our $z_offset = 0;
|
our $z_offset = 0;
|
||||||
@ -38,11 +38,12 @@ our $filament_packing_density = 0.85;
|
|||||||
# speed options
|
# speed options
|
||||||
our $print_feed_rate = 60; # mm/sec
|
our $print_feed_rate = 60; # mm/sec
|
||||||
our $travel_feed_rate = 130; # 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
|
# accuracy options
|
||||||
our $resolution = 0.001;
|
our $resolution = 0.001;
|
||||||
our $layer_height = 0.4;
|
our $layer_height = 0.4;
|
||||||
|
our $thickness_ratio = 1;
|
||||||
our $flow_width;
|
our $flow_width;
|
||||||
|
|
||||||
# print options
|
# print options
|
||||||
@ -50,10 +51,10 @@ our $perimeter_offsets = 3;
|
|||||||
our $solid_layers = 3;
|
our $solid_layers = 3;
|
||||||
our $fill_density = 0.4; # 1 = 100%
|
our $fill_density = 0.4; # 1 = 100%
|
||||||
our $fill_angle = 0;
|
our $fill_angle = 0;
|
||||||
our $temperature = 195;
|
our $temperature = 200;
|
||||||
|
|
||||||
# retraction options
|
# retraction options
|
||||||
our $retract_length = 2; # mm
|
our $retract_length = 1; # mm
|
||||||
our $retract_restart_extra = 0; # mm
|
our $retract_restart_extra = 0; # mm
|
||||||
our $retract_speed = 40; # mm/sec
|
our $retract_speed = 40; # mm/sec
|
||||||
|
|
||||||
|
@ -87,10 +87,9 @@ sub extrude {
|
|||||||
# calculate how much filament to drive into the extruder
|
# calculate how much filament to drive into the extruder
|
||||||
# to get the desired amount of extruded plastic
|
# to get the desired amount of extruded plastic
|
||||||
my $e = $line->a->distance_to($line->b) * $Slic3r::resolution
|
my $e = $line->a->distance_to($line->b) * $Slic3r::resolution
|
||||||
* $Slic3r::flow_width
|
* (($Slic3r::nozzle_diameter**2) / ($Slic3r::filament_diameter ** 2))
|
||||||
* $Slic3r::layer_height
|
* $Slic3r::thickness_ratio
|
||||||
/ (($Slic3r::filament_diameter ** 2) * PI)
|
* $Slic3r::filament_packing_density;
|
||||||
/ $Slic3r::filament_packing_density;
|
|
||||||
|
|
||||||
$gcode .= $self->G1($line->b, undef, $e, $description);
|
$gcode .= $self->G1($line->b, undef, $e, $description);
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ sub export_gcode {
|
|||||||
# write start commands to file
|
# write start commands to file
|
||||||
# TODO: this must be customizable by user
|
# TODO: this must be customizable by user
|
||||||
print $fh "G28 ; home all axes\n";
|
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 "G90 ; use absolute coordinates\n";
|
||||||
print $fh "G21 ; set units to millimeters\n";
|
print $fh "G21 ; set units to millimeters\n";
|
||||||
if ($Slic3r::use_relative_e_distances) {
|
if ($Slic3r::use_relative_e_distances) {
|
||||||
|
@ -13,6 +13,8 @@ use Slic3r;
|
|||||||
use Time::HiRes qw(gettimeofday tv_interval);
|
use Time::HiRes qw(gettimeofday tv_interval);
|
||||||
use XXX;
|
use XXX;
|
||||||
|
|
||||||
|
use constant PI => 4 * atan2(1, 1);
|
||||||
|
|
||||||
my %opt;
|
my %opt;
|
||||||
GetOptions(
|
GetOptions(
|
||||||
'help' => sub { usage() },
|
'help' => sub { usage() },
|
||||||
@ -78,7 +80,8 @@ GetOptions(
|
|||||||
if $Slic3r::nozzle_diameter < 0;
|
if $Slic3r::nozzle_diameter < 0;
|
||||||
die "--layer-height can't be greater than --nozzle-diameter\n"
|
die "--layer-height can't be greater than --nozzle-diameter\n"
|
||||||
if $Slic3r::layer_height > $Slic3r::nozzle_diameter;
|
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";
|
Slic3r::debugf "Flow width = $Slic3r::flow_width\n";
|
||||||
|
|
||||||
# --perimeters
|
# --perimeters
|
||||||
|
Loading…
Reference in New Issue
Block a user