On 1/15/2024 9:54 AM, David Phillip Oster via Discuss wrote:
To fix this, I'm writing a pair of utilities: one extends Finder to
read thumbnails from the .scad file like my ThumbHost3mf
https://github.com/DavidPhillipOster/ThumbHost3mf does for .gcode
and .3mf files and the second utility writes .png thumbnails into the
.scad file similar to the way PrusaSlicer writes .png thumbnails into
.gcode files. (.gcode files are plain text files like .scad files.) by
base64 encoding the thumbnail inside a block comment.
I was wondering about that option. It's kind of ugly to have that kind
of metadata embedded in a human-visible source file, but (if optional)
seems survivable. One could imagine having OpenSCAD itself maintain
that block, and perhaps having it include camera parameters so that
there could be a single "update thumbnail" command that would set the
camera, take a picture, and replace it. (You'd want "new thumbnail
using current camera" and "update thumbnail".)
Another possibility would be to stash the thumbnail in a MacOS resource
fork or Windows alternate data stream, only falling back to including it
in the text on UNIX variants. That would be cleaner in that it wouldn't
clutter the source, but there are a lot of cases where it would get
discarded.
But of course any of that would depend on having somebody who wants to
spend the programming time.
I've written the reader and writer apps, I'll post them within 24 hours to
https://github.com/DavidPhillipOster - I've been having a lot of fun adding
the base64 text block comment to the .scad files and having them show up in
Finder. As far as stashing them in the MacOS resource fork, that's just the
$OACIV - all with the command key held down.
that I've previously described.
That's probably what people should do: it stashes the metadata outside the
file, and automatically clears it when OpenSCAD saves the file if the file
is edited later. And it needs no additional software to support it.
If you are building OpenSCAD from source, it would be easy to add a
checkbox to its settings to enable it to add the Finder custom icon
automatically and programmatically:
See: setIcon For File
https://developer.apple.com/documentation/appkit/nsworkspace/1529882-seticon