mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-23 22:54:08 -06:00
Output required filament length and volume to command line and to the gcode file itself
This commit is contained in:
parent
627e1b32e2
commit
caf41f07dd
3 changed files with 19 additions and 2 deletions
|
@ -24,6 +24,8 @@ has 'layers' => (
|
|||
default => sub { [] },
|
||||
);
|
||||
|
||||
has 'total_extrusion_length' => (is => 'rw');
|
||||
|
||||
sub new_from_mesh {
|
||||
my $class = shift;
|
||||
my ($mesh) = @_;
|
||||
|
@ -445,8 +447,7 @@ sub export_gcode {
|
|||
printf $fh "; generated by Slic3r $Slic3r::VERSION on %02d-%02d-%02d at %02d:%02d:%02d\n\n",
|
||||
$lt[5] + 1900, $lt[4], $lt[3], $lt[2], $lt[1], $lt[0];
|
||||
|
||||
print $fh "; most important settings used:\n";
|
||||
for (qw(layer_height perimeters fill_density nozzle_diameter filament_diameter
|
||||
for (qw(layer_height perimeters solid_layers fill_density nozzle_diameter filament_diameter
|
||||
perimeter_speed infill_speed travel_speed extrusion_width_ratio scale)) {
|
||||
printf $fh "; %s = %s\n", $_, Slic3r::Config->get($_);
|
||||
}
|
||||
|
@ -490,11 +491,22 @@ sub export_gcode {
|
|||
}
|
||||
}
|
||||
|
||||
# save statistic data
|
||||
$self->total_extrusion_length($extruder->total_extrusion_length);
|
||||
|
||||
# write end commands to file
|
||||
print $fh "$Slic3r::end_gcode\n";
|
||||
|
||||
printf $fh "; filament used = %.1fmm (%.1fcm3)\n",
|
||||
$self->total_extrusion_length, $self->total_extrusion_volume;
|
||||
|
||||
# close our gcode file
|
||||
close $fh;
|
||||
}
|
||||
|
||||
sub total_extrusion_volume {
|
||||
my $self = shift;
|
||||
return $self->total_extrusion_length * ($Slic3r::filament_diameter**2) * PI/4 / 1000;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue