Customization of the Gcode file name - question about placeholder variables
 
Benachrichtigungen
Alles löschen

Customization of the Gcode file name - question about placeholder variables  

  RSS
spiff72
(@spiff72)
Trusted Member
Customization of the Gcode file name - question about placeholder variables

Hello all,

I have a question about customizing the Gcode filename based on the initial_tool used in the print.  My first attempt used the following (with the "default" format shown first:

Default:

{input_filename_base}_{layer_height}mm_{filament_type[0]}_{printer_model}_{print_time}.gcode

My customized version:

{input_filename_base}_{layer_height}mm_{filament_type[initial_tool]}-SLOT{initial_tool}_{print_time}.gcode

The above fails when I try to export the Gcode file, stating "Not a variable name" and with the carat pointing at the first letter of 'initial' after the filament_type.  I would like to use the initial tool of the print job rather than a hard-coded reference to the material loaded in slot 1 (tool 0) to determine filament type and the slot location.

As an example of what I want, for a print with PETG loaded in the 5th position (tool4), I want the filename to be:

filename_.15mm_PETG-SLOT5_print_time.gcode

I now realize that the "slot" number and "tool" number would be off by 1 (since the tool number starts at zero), but perhaps I could do a +1 to that value to convert?  Otherwise I would probably rewrite the above and say "TOOL" instead of "SLOT" (not idea, but I could live with that).

I successfully used the initial_tool variable in my startup Gcode to do a check of the first_layer_temperature to check whether my enclosure temperature should be 30C or 40C with the following (which works perfectly):

{if first_layer_temperature[initial_tool] > 225}
ENC O2 W0 S40 ; set enclosure temp to 40 degrees C (for non-PLA materials)
{else}
ENC O2 W0 S30 ; set enclosure temp to 30 degrees C (for PLA materials)
{endif}

I poked around in Github to find "initial_tool" as defined in the code, and it is an integer.  This led me to believe that my code above for the filename template should work, but I am obviously missing something.

Veröffentlicht : 30/01/2021 12:34 am
Lize
 Lize
(@lize)
Estimable Member
RE: Customization of the Gcode file name - question about placeholder variables

From a programming perspective rather than experience with the Prusa filenames, I'd expect to need curly braces to indicate to use the value of initial_tool as the index rather then trying to use the character string:

filament_type[{initial_tool}]

I'm guessing in the GCODE it automatically uses the value from integer variables but this behaviour hasn't been programmed into the slicer name coding.

All speculation on my part but would be worth a try.

Good luck.

 

Diese r Beitrag wurde geändert Vor 4 years von Lize
Veröffentlicht : 30/01/2021 1:53 am
spiff72
(@spiff72)
Trusted Member
Themenstarter answered:
RE: Customization of the Gcode file name - question about placeholder variables

@lize

Thanks for the response!  Unfortunately, I just tried that - no luck.  

Failed processing of the output_filename_format template.
Parsing error at line 1. Expecting an expression.
{input_filename_base}_{layer_height}mm_{filament_type[{initial_tool}]}-SLOT[{initial_tool}]_{print_time}.gcode
^

Veröffentlicht : 30/01/2021 2:36 am
Lize
 Lize
(@lize)
Estimable Member
RE: Customization of the Gcode file name - question about placeholder variables

Shame, was worth a try.

Hopefully someone else will be able to help you.

Veröffentlicht : 30/01/2021 2:38 am
Lize
 Lize
(@lize)
Estimable Member
RE: Customization of the Gcode file name - question about placeholder variables

Have a read here:

https://forum.prusa3d.com/forum/prusaslicer/output-file-name-format-to-include-tool-numbers-used/

Veröffentlicht : 30/01/2021 3:03 am
spiff72
(@spiff72)
Trusted Member
Themenstarter answered:
RE: Customization of the Gcode file name - question about placeholder variables

@lize

Interesting - that is something I will have to dig into a bit more deeply later.  My python skills aren't great, and as an added wrinkle, I upload my files directly to octoprint from PS.

Thanks!

Veröffentlicht : 30/01/2021 3:11 am
Lize gefällt das
bobstro
(@bobstro)
Illustrious Member
RE: Customization of the Gcode file name - question about placeholder variables
Posted by: @spiff72

[...] Interesting - that is something I will have to dig into a bit more deeply later.  My python skills aren't great, and as an added wrinkle, I upload my files directly to octoprint from PS.

You could work up a script to be called from OctoPrint on the RPi side, but it will require some coding.

 

My notes and disclaimers on 3D printing

and miscellaneous other tech projects
He is intelligent, but not experienced. His pattern indicates two dimensional thinking. -- Spock in Star Trek: The Wrath of Khan

Veröffentlicht : 30/01/2021 4:04 am
Teilen: