# Is there a good way to measure the amount of filament (preferably in grams)

Is there a good way to measure the amount of filament (preferably in grams) that will be used in a print? Pronterface will tell me how many millimeters of filament will be used, but I’d like to get a better idea of the cost of filament used BEFORE I send a file to the printer.

length * (diameter/2)^2 * pi* density of filament?

I.e., volume * density of filament.

You can calculate the density by solving the same formula for a known piece of filament (or get it from a specification somewhere).

The easy way would be to measure the length and weight of a piece of filament, use that to get a cost per mm (based on the amount you paid per length or weight), then multiply the pronterface estimate by your cost per mm. Not terribly accurate, but should be close enough.

Ok, but is there a way to get Pronterface’s estimate without having to send the GCode to the printer? I want to be able to have an estimate before I start the print job.

Pronterface gives you the estimate when you load the gcode, but before you start printing. You could also look at the end of the gcode file for the last extruder position (assuming your printer uses absolute positioning).

Hmm. I’m wondering if there’s a way to write a small program that will take a look at the gcode and give the estimate. I’m really trying to have this be outside of Pronterface so that it is program independent. Even better is if it could be hosted on a server and accessed from anywhere. Even better still is if it has fields for entering filament diameter, price, etc. and comes up with a materials cost estimate, based solely on the gcode.

Either way, I’m surprised no one has created something like it. I don’t know a ton about programming, but I can’t imagine that something like this would be difficult to do. I have some software engineer friends, I’ll see if they have any idea how to do it.

I did this a while ago…

That’s perfect!

@John_Ridley , here’s the thing - not everyone is as willing to do the math on this as we are. I’m looking for a nice interface that tells me what I’m looking for, with a minimal amount of effort.

@John_Schneider I used to run a commercial Objet 3D printer some years ago, the only metric I had from the software was the volume of material consumed per print (it uses liquid resins).From there to the price it was the same trivial multiplication as this.

If you have the price per unit length of material, then having the length should be enough for most people. Otherwise you would have to deal with multiple currencies, different material costs, etc.

Perhaps an option to show the length in ‘price units’ via a setup file?

There’s a CLI program that comes with the pronterface code in Printrun that does most of this: https://github.com/kliment/Printrun/blob/master/gcoder.py

@Edgar_Brown , you’re right, the multiplication after that is trivial, something easily plugged into an equation. I’m still looking to have something with a clean, simple interface where I can upload my .gcode and it will tell me how much material is used. Then there could be a field where I input how much \$/kg the filament I’m using is, and it will tell me how much that cost is.

If you want a lighter interface than pronterface, internally it calls GCoder’s Gcode.filament_length().

You can use gcoder.py directly from the command-line.

gcode viewer at http://gcode.ws does filament weight estimation amongst other things.

Yeah I heard gcode is good too.

http://www.tonergiant.co.uk

Take a look at https://github.com/Spiritdude/GCodeToolbox (very early alpha), provides filament length + volume when using ‘info’ on gcode (command-line tool that is), multiply with material density.

@Alexey_Ustyantsev , thanks, that’s almost exactly what I’m looking for!

GCodeInfo and GCodeSimulator Tools do show the used filament and estimated cost and much more: http://www.thingiverse.com/thing:44286

Be worry of this patent: http://www.wired.com/design/2013/02/3-d-printing-patents/?pid=1987