Notifiche
Cancella tutti

gcode file name  

  RSS
maseruki
(@maseruki)
Utenti
gcode file name

Hello.I am using PET as the main filament, be it per meter rather than per gram. So it is necessary for me to put this value in the name of the file, I have managed to get it to indicate it by putting the value {used_filament} in the output file format, leaving {input_filename_base}_{layer_height}mm_{print_time}_{filament_type[ 0]}_{used_filament}m.gcode and it generates this Body1_0.25mm_2h24m_PET_10.2509m.gcode, I manage to remove two decimal places from the number 10.2509, what can I do to remove two decimal places from it, I would like it to look like this Body1_0. 25mm_2h24m_PET_10.25m.gcode

Would it be possible? I know it's a huge nonsense but it bothers me.

Thanks for your attention.

This text has been translated with Google, sorry if I say something nonsense

Best Answer by Neophyl:

There are various ways to do this yes.

First of all, to answer GrandPappy, the possible variables can be found by hovering over a setting in the software.  The tooltips will (where possible) contain them.  In addition to that the Prusa Slicer knowledge base has a list at https://help.prusa3d.com/article/list-of-placeholders_205643 although the software is the primary source as the list can get out of date.

To answer Maseruki, I use similar but for weight rather than length, but the same technique can be applied.

I use "...{int(total_weight)}g..."For more decimals use "...{int((total_weight*10.0))/(10.0)}g..." or replace the "10.0" with any order of magnitude you like. And yes, the amount of brackets look redundant, but they are important.  Just replace total_weight with used_filament.  The same technique can be used to trim/set the number of decimals on any value like that.

btw if you are missing the weight in grams from the slice detail then make sure that the filament profile you are using has the density field correctly filled in.  Cant work out the weight without the density.

Postato : 15/05/2023 11:07 pm
GrandPappy
(@grandpappy)
New Member
RE: gcode file name

Along these lines, is there a list (pdf, html, xml, json) of the available variable names that can be used in naming??

Postato : 16/05/2023 5:20 pm
maseruki hanno apprezzato
Neophyl
(@neophyl)
Illustrious Member
RE: gcode file name

There are various ways to do this yes.

First of all, to answer GrandPappy, the possible variables can be found by hovering over a setting in the software.  The tooltips will (where possible) contain them.  In addition to that the Prusa Slicer knowledge base has a list at https://help.prusa3d.com/article/list-of-placeholders_205643 although the software is the primary source as the list can get out of date.

To answer Maseruki, I use similar but for weight rather than length, but the same technique can be applied.

I use "...{int(total_weight)}g..."For more decimals use "...{int((total_weight*10.0))/(10.0)}g..." or replace the "10.0" with any order of magnitude you like. And yes, the amount of brackets look redundant, but they are important.  Just replace total_weight with used_filament.  The same technique can be used to trim/set the number of decimals on any value like that.

btw if you are missing the weight in grams from the slice detail then make sure that the filament profile you are using has the density field correctly filled in.  Cant work out the weight without the density.

Postato : 16/05/2023 5:57 pm
GrandPappy hanno apprezzato
GrandPappy
(@grandpappy)
New Member
RE: gcode file name

@neophyl I only wish i could like your answer more than once.. Perfect, both for the link and the quick parameter math solution 🙂 solved my problem completely.

Postato : 16/05/2023 7:03 pm
maseruki
(@maseruki)
Utenti
Topic starter answered:
RE: gcode file name

Thank you very much for your answer, it worked excellent for me and it is exactly what I need, I already saw that page before, but it did not specify how to do what I was looking for.Thank you so much

Postato : 17/05/2023 8:57 pm
Neophyl
(@neophyl)
Illustrious Member
RE: gcode file name

No problem 🙂  The parameter math isn't mine, I suck at math lol. 
I originally raised an issue on github requesting the same thing, limiting of the amount of decimals and a kind user answered with the math to do it.  So no software change was required.  I'm just passing it on.

Postato : 18/05/2023 6:33 am
maseruki hanno apprezzato
Condividi: