Filament Length/Weight/Volume Estimator for 4d G-Code
Description
This is a quick perl script to scan through a gcode file and figure out how much filament will be required.
It reads all of the "E" moves and adds them up each time they get reset to 0.
This will only work with absolute moves, not relative moves.
I did a 5 hour print and weighed it. The script said it should way 48.167 g. My kitchen scale said it weight 50 g.
Pretty good!
It reads all of the "E" moves and adds them up each time they get reset to 0.
This will only work with absolute moves, not relative moves.
I did a 5 hour print and weighed it. The script said it should way 48.167 g. My kitchen scale said it weight 50 g.
Pretty good!
Instructions
After downloading this script you may have to make it executable (chmod gou+x filament_length.pl)
To use it just pipe the gcode file through the perl script:
cat mygcodefile.gcode | ./filament_length.pl
(replace the ./ with whatever the path is to the script)
or, you can specify the file on the command line like this:
./filament_length.pl -f filename.gcode
you can also specify the density (in g/cc) and size of the filament (in mm)
./filament_length.pl -d 1.25 -s 2.75 -f filename.gcode
You can include or omit any of the command switches you like, it reads from stdin if you omit the filename and a density of 1.05 and diameter of 1.75 if you omit them.
The density of ABS is around 1.05 g/cc, PLA should be around 1.25 g/cc
It will produce a report like the following:
Cross sectional area of filament: 0.0240527984375 cm^2
macbookpro:~ jag$ ./filament_length.pl -d 1.25 -f ~/Dropbox/repg files/Dreidel03.gcode
Filament diameter is 1.75 mm
Filament density is 1.25 g/cc
Cross sectional area of filament: 0.0240527984375 cm^2
Total filament: 738.936 cm
Volume: 17.773 cc
Weight: 22.217 g
To use it just pipe the gcode file through the perl script:
cat mygcodefile.gcode | ./filament_length.pl
(replace the ./ with whatever the path is to the script)
or, you can specify the file on the command line like this:
./filament_length.pl -f filename.gcode
you can also specify the density (in g/cc) and size of the filament (in mm)
./filament_length.pl -d 1.25 -s 2.75 -f filename.gcode
You can include or omit any of the command switches you like, it reads from stdin if you omit the filename and a density of 1.05 and diameter of 1.75 if you omit them.
The density of ABS is around 1.05 g/cc, PLA should be around 1.25 g/cc
It will produce a report like the following:
Cross sectional area of filament: 0.0240527984375 cm^2
macbookpro:~ jag$ ./filament_length.pl -d 1.25 -f ~/Dropbox/repg files/Dreidel03.gcode
Filament diameter is 1.75 mm
Filament density is 1.25 g/cc
Cross sectional area of filament: 0.0240527984375 cm^2
Total filament: 738.936 cm
Volume: 17.773 cc
Weight: 22.217 g
You must be logged in to post a comment.
License
Filament Length/Weight/Volume Estimator for 4d G-Code by jag is licensed under the Public Domain license.

can this be used with gcode from any source, or Dimension printers' gcode only?
By dimension, I meant the dimension plugin to skein forge. I should probably change it to 4d gcode. It just has to be gcode that specifies X,Y,Z
&
amp; E in the G1 moves instead of setting the RPM for the extruder and doing moves with just X, Y and Z.