diff options
author | Henrik Brix Andersen <henrik@brixandersen.dk> | 2012-07-09 23:03:09 +0400 |
---|---|---|
committer | Henrik Brix Andersen <henrik@brixandersen.dk> | 2012-07-09 23:03:09 +0400 |
commit | b0138ab5eba84c4dd7c07dfe15bdf221ef0d79f3 (patch) | |
tree | 33fbac6926853f7de9f7855a4df27ca78b46d616 /utils | |
parent | c144afe52b04b372a3d024fa83400f5affd839d6 (diff) |
Add example post-processing script for calculating filament weight. #273
Diffstat (limited to 'utils')
-rwxr-xr-x | utils/post-processing/filament-weight.pl | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/utils/post-processing/filament-weight.pl b/utils/post-processing/filament-weight.pl new file mode 100755 index 000000000..c564b4d80 --- /dev/null +++ b/utils/post-processing/filament-weight.pl @@ -0,0 +1,21 @@ +#!/usr/bin/perl -i +# +# Post-processing script for adding weight of required filament to +# G-code output. + +use strict; +use warnings; + +# example densities, adjust according to filament specifications +use constant PLA => 1.25; # g/cm3 +use constant ABS => 1.05; # g/cm3 + +while (<>) { + if (/^(;\s+filament\s+used\s+=\s.*\((\d+(?:\.\d+)?)cm3)\)/) { + my $pla = $2 * PLA; + my $abs = $2 * ABS; + printf "%s or %.2fg PLA/%.2fg ABS)\n", $1, $pla, $abs; + } else { + print; + } +} |