You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That causes 3d_printer_object_thumbnails to not be relative to the top level server file. It ends up as .thumbs/Game_tray_thick_tapered_0.2mm_PLA_MK3S_1h22m-400x300.png. It should be games/.thumbs/Game_tray_thick_tapered_0.2mm_PLA_MK3S_1h22m-400x300.png.
That breaks the 3D Printer Thumbnail.
The solution I found, which I think works for nested and unnested files, is to find the path from start until the last '/' in the filename, and prepend that to the 3d_printer_object_thumbnails:
It is easier to read in a multiline template, which I used in the templates section of the developer tools:
{% set path = "foobar/games.gcode" %}
{{ path[0:path.rfind('/')+1] }}
The +1 on the slice is a little tricky/clever/unintuitive. On a path with a slash, that ends up catching the slash as well. On a path without any slash, the rfind returns -1. A slice of path[0:-1] is an empty string. So the result is either concatenating nothing, or concatenating the folders and the following slash.
The text was updated successfully, but these errors were encountered:
Thank you so much for collecting this info together.
I usually use a folder structure for my gcode files. For whatever reason, the files and thumbnails get stacked like this:
That causes
3d_printer_object_thumbnails
to not be relative to the top level server file. It ends up as.thumbs/Game_tray_thick_tapered_0.2mm_PLA_MK3S_1h22m-400x300.png
. It should begames/.thumbs/Game_tray_thick_tapered_0.2mm_PLA_MK3S_1h22m-400x300.png
.That breaks the 3D Printer Thumbnail.
The solution I found, which I think works for nested and unnested files, is to find the path from start until the last '/' in the filename, and prepend that to the 3d_printer_object_thumbnails:
It is easier to read in a multiline template, which I used in the templates section of the developer tools:
The
+1
on the slice is a little tricky/clever/unintuitive. On a path with a slash, that ends up catching the slash as well. On a path without any slash, the rfind returns-1
. A slice ofpath[0:-1]
is an empty string. So the result is either concatenating nothing, or concatenating the folders and the following slash.The text was updated successfully, but these errors were encountered: