Output file name format to include tool numbers used
 

Output file name format to include tool numbers used  

  RSS
mak3r
(@mak3r)
Active Member

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...
Posted : 15/01/2021 7:31 pm
towlerg
(@towlerg)
Prominent Member

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.

Posted : 15/01/2021 8:18 pm
mak3r
(@mak3r)
Active Member

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...
Posted : 15/01/2021 8:46 pm
towlerg
(@towlerg)
Prominent Member

Do you have the tools set as virtual extruders?

Posted : 15/01/2021 11:38 pm
mak3r
(@mak3r)
Active Member

@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...
Posted : 16/01/2021 2:18 am
towlerg
(@towlerg)
Prominent Member

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?

This post was modified 1 month ago by towlerg
Posted : 16/01/2021 10:40 am
mak3r
(@mak3r)
Active Member

@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...
Posted : 16/01/2021 3:32 pm
towlerg
(@towlerg)
Prominent Member

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.

Posted : 17/01/2021 11:15 am
bobstro
(@bobstro)
Illustrious Member

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...
Posted : 17/01/2021 4:37 pm
towlerg
(@towlerg)
Prominent Member

@bobstro

Nice one, I didn't think of that.

Posted : 17/01/2021 8:58 pm
mak3r
(@mak3r)
Active Member

@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...
Posted : 19/01/2021 8:23 pm
bobstro
(@bobstro)
Illustrious Member

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...
Posted : 19/01/2021 8:55 pm
mak3r
(@mak3r)
Active Member
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...
Posted : 20/01/2021 5:57 pm
Share:

Please Login or Register