Macro to calculate remaining filament on a spool
-
@o_lampe
Something like this (needs refinement) would give you the answers you seek; CalculateFilamentRunoutTime.g ; Calculate thn aproximate time filament will run out M291 S6 P"Enter weight of filament (excluding spool) in grams" F10 H1000 L1 var spoolWeight = input M291 S6 P"Enter filament density" F1.04 H2 L0.8 var filamentDensity = input M291 S7 P"Enter filename to simulate" F"cube.gcode" var fullName = directories.gCodes ^ input var filamentUsed = 0 var filamentRunout = false echo var.fullName var startTime = state.time var durationInSecs = 0 if !fileexists(var.fullName) abort "File not found : " ^ var.fullName else echo "Simulating " ^ var.fullName M37 P{var.fullName} S2 F1 while state.status ="simulating" set var.filamentUsed = move.extruders[0].position * (3.1416 * pow(1.75/2,2)/1000) * var.filamentDensity if var.filamentUsed > var.spoolWeight set var.durationInSecs = job.duration echo "Filament exceeded at aprox " ^ {floor(var.durationInSecs /60)} ^ " minutes after start" G4 S1 M25 set var.filamentRunout = true echo "If started now, print would run out of filament at aprox " ^ state.time + var.durationInSecs G4 S2 while state.status="pausing" G4 S1 M0 M37 S0 G4 P500 if var.filamentRunout = false echo "Simulation finished without filament runout"
-
@OwenD WOW , you absolutely nailed it. This macro can run on any old Duet2 powered by USB cable. The spool changing times are relative but universal for nn follow up prints
-
This reminds me of a video I did a couple of years ago where I described basically how you can get a pretty close estimate of how much filament is on a reel using nothing more than a ruler (and a spread sheet which I uploaded to my google drive for anyone to use). I still use this method and the results are pretty dam close.
Like most of my videos, it's had a whopping 600 or so views (I really don't know why I bother) but here is a link if anyone wants a quick and simple way to tell how much filament is on any randomly selected reel using nothing more than a ruler https://www.youtube.com/watch?v=1QIZ67XyJBE&t=73s
-
@deckingman
Definitely a valid method.
Did you calculate the center line of the helix?
YouTube views are more based on the "entertainment" value of the content than on the usefulness of the content.
I have a bunch of tutorials on some software I wrote which are as boring as bat shit even to people that are interested@o_lampe
I have an idea for an extension to actually notify you at the correct time.
I call it T-Frag
(testicular filament runout alarm generator)
All it requires is a large capacitor, some alligator clips and a relay.
I'm looking for beta testers! -
@OwenD said in Macro to calculate remaining filament on a spool:
@deckingman
Definitely a valid method.
Did you calculate the center line of the helix? ...........Yes, I use the centre line if the filament thread to calculate the circumference. I also make allowance for the fact that, after the first layer on a reel, subsequent layers sit between the " valley" of the underlying layer, rather than on the topmost peak of the previous filament thread. I'm not claiming that this method is the ultimate in accuracy, but it's close enough to answer the question "is there enough filament left on this reel to print what I want". The biggest cause of inaccuracy is after a reel has been used, the uppermost layer or two won't be as tightly wound as the underlying layers so I just take 2 or 3 metres off the calculated result. Now that I know the dimensions of all my filament reels, I only have to take one measurement to tell how much filament is left.
-
@deckingman I think there is no need to use filament length and diameter. Prusa Slicer tells us how much the part will weight.
Just calculate the volume of the filament on the spool ( hollow cylinder: outer diameter, inner diameter, spool-width).
Multiplying that by the right fill-grade factor and density would give you the real weight left on the spool. -
@OwenD said in Macro to calculate remaining filament on a spool:
(testicular filament runout alarm generator)
All it requires is a large capacitorI have a sound sleep, it would take a car battery to wake me up
-
@o_lampe said in Macro to calculate remaining filament on a spool:
@deckingman I think there is no need to use filament length and diameter. Prusa Slicer tells us how much the part will weight.
Just calculate the volume of the filament on the spool ( hollow cylinder: outer diameter, inner diameter, spool-width).
Multiplying that by the right fill-grade factor and density would give you the real weight left on the spool.That's another way of doing it but calculating the "fill grade factor" could be tricky. Also, you'd need to know the weight of an empty reel which is also tricky if you don't happen to have any scales to weigh one. You'd also need to look up the density of the filament. Rulers I have, scales I don't, which is why I wanted to use another method.
-
@deckingman said in Macro to calculate remaining filament on a spool:
Also, you'd need to know the weight of an empty reel which is also tricky if you don't happen to have any scales to weigh one.
If you don't have an empty spool then you could weigh the full spool when you open it and subtract the declared weight of filament.
-
@dc42 said in Macro to calculate remaining filament on a spool:
@deckingman said in Macro to calculate remaining filament on a spool:
Also, you'd need to know the weight of an empty reel which is also tricky if you don't happen to have any scales to weigh one.
If you don't have an empty spool then you could weigh the full spool when you open it and subtract the declared weight of filament.
As above - rulers (and empty spools) I have - scales I do not currently have.
-
@deckingman The $8 Amazon Basics kitchen scale I ordered years ago has been one of the more useful tools I've gotten.
-
@Phaedrux That's fascinating information I'm sure.
I'm starting to doubt my sanity but I'm pretty sure it's the rest of the world that's crazy.
I put out a post detailing a method I use to determine how much filament is left on a reel using nothing but a ruler. I state that this method works reliably and well for me. I post a link to a YouTube video I made which in turn links to spreadsheet that contains the necessary calculations for anyone who might be interested.
Ignoring all that, someone suggests that I should weigh the filament.
Then, still ignoring the fact that I have a relaliable method using a ruler, someone else suggests how I could determine the weight of an empty reel using scales.
Now, still ignoring the fact that I use a ruler, I have a suggestion as to where I could buy some suitable scales in order to make a measurement that I don't need.
-
@deckingman Just sharing Ian. No need to take it personally.
-
@dc42 said in Macro to calculate remaining filament on a spool:
@deckingman said in Macro to calculate remaining filament on a spool:
Also, you'd need to know the weight of an empty reel which is also tricky if you don't happen to have any scales to weigh one.
If you don't have an empty spool then you could weigh the full spool when you open it and subtract the declared weight of filament.
That's also a good way to figure out a value for (fill-rate + density). The initial filament volume on the spool is the starting point.
We don't need to know the real density or the real fill-rate, only the sum of it.
From there it's relative. -
@Phaedrux said in Macro to calculate remaining filament on a spool:
@deckingman Just sharing Ian. No need to take it personally.
No offence taken - I'm much too long in the tooth for that. Just pointing out the ridiculousness of the situation. It's like giving someone directions of how to get from A to B and then someone else saying one could get to B by starting at C instead of A. Then more people suggesting ways to get to C. While it may all be factually correct, it's rather pointless is one is already at A.