Output file name format to include tool numbers used
 
Notifications
Clear all

Output file name format to include tool numbers used  

  RSS
mak3r
(@mak3r)
Active Member
Output file name format to include tool numbers used

I have several MK3s printers and recently got the E3D toolchanger. I'd like to continue using PrusaSlicer with the TC. So far it is working great for this. One thing that I would like to take advantage of is the slicers output filename format configuration. It is very important that I know which tools and which materials are loaded into which tools when I re-use the gcode files. I am not sure how to get the index of the tools which are used. Also, I'm not sure the variable filament_type gives me anything but the first filament. 

Can this be done with variables and/or slicer conditionals?

Something like this but possibly repeating the toolnumber and filament for each that is used.

[input_filename_base]_T[tool_number]_[filament_type][toolnumber].gcode

Best Answer by bobstro:

If you can identify the tools in the output gcode, you can use a postprocessing script to rename the file. I used to use one before Prusa added the print time placeholders.

--
mak3r

Publié : 15/01/2021 7:31 pm
towlerg
(@towlerg)
Noble Member
RE: Output file name format to include tool numbers used

The only part of this that I can add (and maybe not that), I use {filament_settings_id[0]}. I don't have MMU but for reasons lost in the fog of time, I use this format because it worked.

Publié : 15/01/2021 8:18 pm
mak3r
(@mak3r)
Active Member
Topic starter answered:
RE: Output file name format to include tool numbers used

Thanks! That's an interesting one.

It definitely could have some value however I still don't know how to figure out which indicies to use. The toolchanger has 4 hotends/extruders so currently I manually do something like this:

3DBenchy_T2_T0_PLA.gcode 

to indicate that Tool#2 is the first layer extruder and Tool#0 is the second extruder. This is just for 2 colors of course and both having PLA loaded. 

If I switch toolheads in Prusa Slicer to use T0 for first layer and T1 for the second extruder it would look like this.

3DBenchy_T0_T1_PLA.gcode

I'd love to have something that dynamically figures that out but I'm not sure the source code is built for it today. 

It would be great to have the named filament in the filename but again, how do I get the proper index of tools being used? Maybe in the slicer source I can find the full list of available variables. Obviously the slicer knows which of the 4 tools are being used.

--
mak3r

Publié : 15/01/2021 8:46 pm
towlerg
(@towlerg)
Noble Member
RE: Output file name format to include tool numbers used

Do you have the tools set as virtual extruders?

Publié : 15/01/2021 11:38 pm
mak3r
(@mak3r)
Active Member
Topic starter answered:
RE: Output file name format to include tool numbers used

@towlerg

In PrinterSettings, in the section "Capabilities" I set the number of extruders. This works great. It adds a separate "Extruder N" page in the left column. So I can set different nozzle sizes, retraction, etc. per extruder. Is that "Virtual Extruders"? PrusaSlicer v2.3.0 fwiw

 

--
mak3r

Publié : 16/01/2021 2:18 am
towlerg
(@towlerg)
Noble Member
RE: Output file name format to include tool numbers used

Ok, AFAIK the indexed format works for most variables.

Please don't misunderstand, I'm not being rude but I find that restating a problem in the light of new information can be helpful. So whats the problem?

Ce message a été modifié il y a 4 years par towlerg
Publié : 16/01/2021 10:40 am
mak3r
(@mak3r)
Active Member
Topic starter answered:
RE: Output file name format to include tool numbers used

@towlerg

No problem. Let me see if I can clarify.

In Prusa Slicer, it is possible to configure the "Output filename format". This field is found at "Print Settings" -> "Output options". The idea here is that this field can be setup to automatically create a filename based on slicer variables. It's a pretty cool feature. I find that I still have to edit the output filename because I don't know the right variables (and it may involve some conditional gcode) to set.

Fundamentally, I have 4 tools and I would like the output filename to include only the names of the tools that are sliced into the gcode. Sometimes, not all 4 tools are used. 

So the question is how can I setup this "Output filename format" to include only tools used in the print so that I don't have to edit the filenames when saving the gcode? This variable is intended to be preserved across different prints unlike layer height for example which I expect to change according to the print.

 

--
mak3r

Publié : 16/01/2021 3:32 pm
towlerg
(@towlerg)
Noble Member
RE: Output file name format to include tool numbers used

If you use more than one tool I suspect you may be out of luck.

FWIW I use "PS_[input_filename_base]_[print_settings_id]_{filament_settings_id[0]}.gcode"  so if you were using this you'd want to replace [0] with the tool number. There is a placeholder "current_extruder" but it may be the case that at the time the filename is being composed the current tool nuber will be 0 or it may just not be usable for filename. Perhaps a little trial and error.

Publié : 17/01/2021 11:15 am
bobstro
(@bobstro)
Illustrious Member
RE: Output file name format to include tool numbers used

If you can identify the tools in the output gcode, you can use a postprocessing script to rename the file. I used to use one before Prusa added the print time placeholders.

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

Publié : 17/01/2021 4:37 pm
towlerg
(@towlerg)
Noble Member
RE: Output file name format to include tool numbers used

@bobstro

Nice one, I didn't think of that.

Publié : 17/01/2021 8:58 pm
mak3r
(@mak3r)
Active Member
Topic starter answered:
RE: Output file name format to include tool numbers used

@bobstro

Yeah, this may be the way to go. I have been using the feature that sends it directly to the printer so I may have to rethink my process a bit. Thanks.

--
mak3r

Publié : 19/01/2021 8:23 pm
bobstro
(@bobstro)
Illustrious Member
RE: Output file name format to include tool numbers used

Here's the code I used. It's not great code, but it worked well enough. Note that it reads the entire gcode file into memory, so if you're doing very large prints, you may need to re-think the approach.

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

Publié : 19/01/2021 8:55 pm
mak3r
(@mak3r)
Active Member
Topic starter answered:
RE: Output file name format to include tool numbers used
Posted by: @bobstro

Here's the code I used. It's not great code, but it worked well enough. Note that it reads the entire gcode file into memory, so if you're doing very large prints, you may need to re-think the approach.

Thanks. I'll probably write a shell script to the extruders and rename the file.

grep -o -e '^T[0123]' <filename.gcode>  | sort -u

 

--
mak3r

Publié : 20/01/2021 5:57 pm
Partager :