added total cost/weight to Extruder statistics, mocked up addendum to status bar change.

This commit is contained in:
Joseph Lenox 2017-01-16 01:00:05 -06:00 committed by bubnikv
parent 3846d9e734
commit 203a965b3d
5 changed files with 30 additions and 6 deletions

View file

@ -321,8 +321,8 @@ sub export {
$self->print->clear_filament_stats;
$self->print->total_used_filament(0);
$self->print->total_extruded_volume(0);
my $total_filament_weight = 0.0;
my $total_filament_cost = 0.0;
$self->print->total_weight(0);
$self->print->total_cost(0);
foreach my $extruder (@{$gcodegen->writer->extruders}) {
my $used_filament = $extruder->used_filament;
my $extruded_volume = $extruder->extruded_volume;
@ -333,11 +333,11 @@ sub export {
printf $fh "; filament used = %.1fmm (%.1fcm3)\n",
$used_filament, $extruded_volume/1000;
if ($filament_weight > 0) {
$total_filament_weight += $filament_weight;
$self->print->total_weight($self->print->total_weight + $filament_weight);
printf $fh "; filament used = %.1fg\n",
$filament_weight;
if ($filament_cost > 0) {
$total_filament_cost += $filament_cost;
$self->print->total_cost($self->print->total_cost + $filament_cost);
printf $fh "; filament cost = %.1f\n",
$filament_cost;
}
@ -347,7 +347,7 @@ sub export {
$self->print->total_extruded_volume($self->print->total_extruded_volume + $extruded_volume);
}
printf $fh "; total filament cost = %.1f\n",
$total_filament_cost;
$self->print->total_cost;
# append full config
print $fh "\n";