<p>Good question as I also ran into some files not remembering for which purpose or which material I printed these. The online G-code visualizers do not display the temperature or the correct filament width, so basically that won't help you (unless you modify the open source programs...). Reading from firmware would not be possible without adding a new feature, as far as I know, this is not implemented in Marlin Firmware or in Prusa firmware (which is based on Marlin).</p>

<p>When using a printer server like OctoPrint, you can store your G-code files in a folder structure that you can define yourself; so basically create a directory structure based on the material type, brand, etc.</p>

<p>However, it is relatively easy to write a small program in Python to read a file and interpret the lines (even if you're not a programmer). There are lots of tutorials and examples to find to open files read the file e.g. line by line and detect strings to identify the settings for G-codes M104/M109 (hot end temperature) and M140/M190 (bed temperature). Usually you slice your models with a specific set of bed and hot end temperature (which you know), so basically you can find out which material was meant to be printed with the G-code file. You could even let the program sort the files for you by moving them into separate folders.</p>

<p>I'll add it to my list of things I'd like to do some rainy day! :)</p>

<p><em>Note that some printers use different, or even custom G-codes to control bed temperature; e.g. when reading Ultimaker 3 G-code files you cannot see the bed temperature!</em></p>

CC BY-SA 4.0
2018-06-04T11:59:12.050Z
You could also add comment line to the generated GCode, usually it begins with ; symbol. The comment can be inserted in slicer as a startcode.
jnovacho
CC BY-SA 4.0
2018-06-04T12:31:29.813Z
@jnovacho Good point you raise, but if you have never done that, you are stuck with the files you have. It is a good idea to insert a comment based on material settings in new files!
0scar
CC BY-SA 4.0
2018-06-04T09:20:49.873Z
2018-06-04T11:25:22.653Z
2018-06-04T11:25:22.653Z
0scar
<p>I have various G-code files stored at SDCard attached to my Prusa i3 MK2S printer. They are either for ABS, PLA or SBS. The more files I had on the SD card, the more I was running into trouble of finding for which material is which G-code. </p>

<p>To tackle the situation I created folders <code>ABS</code>, <code>PLA</code> and <code>SBS</code> and put new files into those directories.</p>

<hr>

<p>Is there any better method of finding, backwards from G-code, which material settings were intended to be used? </p>

<p>If so, is there a way to read temperature settings from G-code by Prusa i3 firmware without printing the actual model?</p>

CC BY-SA 4.0
2018-06-04T20:04:29.160Z
Not an answer, but sort of related and a good idea: [Best Practices - Labeling GCode Files](https://community.ultimaker.com/topic/15154-best-practices-labeling-gcode-files/). Use a filename format such as `{Machine+State}_{FileName}_{YYYYMMDD-TTTT}_{FileID}.gcode`, for example, `UM2+PLA8_NozzleMag_20160911-1520_ym9450.gcode`
Greenonline
<prusa-i3><g-code><microsd><sd>
How to sort G-code on SD card based on material (ABS|PLA|SBS)?
rudolf_franek
# How to sort G-code on SD card based on material (ABS|PLA|SBS)?

(Asked by: username_0 on 2018-06-04)

I have various G-code files stored at SDCard attached to my Prusa i3 MK2S printer. They are either for ABS, PLA or SBS. The more files I had on the SD card, the more I was running into trouble of finding for which material is which G-code.

To tackle the situation I created folders `ABS`, `PLA` and `SBS` and put new files into those directories.

---

Is there any better method of finding, backwards from G-code, which material settings were intended to be used?

If so, is there a way to read temperature settings from G-code by Prusa i3 firmware without printing the actual model?

**Tags:** prusa-i3, g-code, microsd, sd

> **Comments:**
> **username_1**: Not an answer, but sort of related and a good idea: [Best Practices - Labeling GCode Files](https://community.ultimaker.com/topic/15154-best-practices-labeling-gcode-files/). Use a filename format such as `{Machine+State}_{FileName}_{YYYYMMDD-TTTT}_{FileID}.gcode`, for example, `UM2+PLA8_NozzleMag_20160911-1520_ym9450.gcode`  

---

## 1 answers

### Answer by username_2 on 2018-06-04. Score: 3 | Accepted answer

Good question as I also ran into some files not remembering for which purpose or which material I printed these. The online G-code visualizers do not display the temperature or the correct filament width, so basically that won't help you (unless you modify the open source programs...). Reading from firmware would not be possible without adding a new feature, as far as I know, this is not implemented in Marlin Firmware or in Prusa firmware (which is based on Marlin).

When using a printer server like OctoPrint, you can store your G-code files in a folder structure that you can define yourself; so basically create a directory structure based on the material type, brand, etc.

However, it is relatively easy to write a small program in Python to read a file and interpret the lines (even if you're not a programmer). There are lots of tutorials and examples to find to open files read the file e.g. line by line and detect strings to identify the settings for G-codes M104/M109 (hot end temperature) and M140/M190 (bed temperature). Usually you slice your models with a specific set of bed and hot end temperature (which you know), so basically you can find out which material was meant to be printed with the G-code file. You could even let the program sort the files for you by moving them into separate folders.

I'll add it to my list of things I'd like to do some rainy day! :)

*Note that some printers use different, or even custom G-codes to control bed temperature; e.g. when reading Ultimaker 3 G-code files you cannot see the bed temperature!*

> **Comments:**
> **username_3**: You could also add comment line to the generated GCode, usually it begins with ; symbol. The comment can be inserted in slicer as a startcode.  
> **username_2**: @username_3 Good point you raise, but if you have never done that, you are stuck with the files you have. It is a good idea to insert a comment based on material settings in new files!  

---

