I've got more half-finished  projects than lost left socks and I've found it pretty

I’ve got more half-finished openscad projects than lost left socks and I’ve found it pretty hard to locate specific projects after some time. Opening each individual scad-file just to check feels cumbersome, and writing notes and readmes ain’t exactly my thing unless working on something serious.

I put together a very simple script to generate thumbnail images recursively from .scad files. Very basic, very simple but helps me alot.

Windows and Linux/Unix/etc versions in the comments.

@echo off
::For windows

set binfile=“C:\Program Files\OpenSCAD\openscad.exe”
set viewporttranslate=0.00,0.00,0.00
set viewportrotation=55.00,0.00,25.00
set viewdist=400
set options=–imgsize=1024,768 --projection=ortho

echo %~dp0

for /R %%i in (*.scad) do (
if not exist “%%i_out.png” (
echo %%i
%binfile% -o “%%i_out.png” “%%i”
%binfile% -o “%%i_out.png” %options% --camera=%viewporttranslate%,%viewportrotation%,%viewdist% “%%i”
)
)
pause
exit

#!/bin/bash

For Linux/Unix/etc

binfile="/usr/local/openscad/openscad-latest/openscad"
viewporttranslate=0.00,0.00,0.00
viewportrotation=55.00,0.00,25.00
viewdist=400
options="–imgsize=1024,768 --projection=ortho"

pwd

for i in find . -name "*.scad"
do
if [ ! -f “${i}_out.png” ]
then
echo $i
“${binfile}” -o “${i}_out.png” $options --camera=${viewporttranslate},${viewportrotation},${viewdist} “$i”
fi
done

Place the script at the top of the folder tree you wish to generate thumbnails for. Note that to speed up the run it will not regenerate/overwrite previously generated thumbnails. Delete the thumbs you wish to regenerate before running the script.

Have you considered building a file browser using that script and a little C# or Java magic?

Might even be able to make it into a shell extension to give the files themselves thumbnails in Explorer.

@Daniel_ShadowDrakken nope, but I’m sure it can be improved upon by anyone who want more from it. I threw it together last night and it solved my immediate problem on both platforms I work on (Win 8.1 and Ubuntu 12.04).

By changing view to Icons or Thumbnails in pretty much any standard file manager which support png files I find it works well enough for the effort invested :slight_smile:

Windows version bug fixed. Forgot to set the options variable. Worked anyway…

This solves one of my problems (for Win7 and Ubuntu 12.04). Thank you!
I’m waiting for someone with a big brain to solve my other problem: A visual explorer for STL files. I have a large collection of STLs, and many have similar or no-descriptive names. I would love a way to visually sort through them all!

@Carlton_Dodd http://stackoverflow.com/questions/12064996/how-to-generate-thumbnails-from-stl-files

There’s also https://support.formlabs.com/entries/41070008-STL-File-Thumbnail-Preview-In-Windows-

@Daniel_ShadowDrakken Had to run to my other computer and try that. Even upgraded Netfabb Basic. Still no preview icons. :frowning:
Thanks for the links. I’ll keep looking.

Yeah, it sounded pretty hit and miss in the thread too… like Netfabb supports it, but is buggy about it from the sounds.

@Carlton_Dodd know it doesn’t help a whole loss but I store my sw files with the same names and you can view the part via icons for sw and they’ll be side by side.

@D_Rob
Yeah, I assume you’re talking about thumbnail images (not familiar with ‘saw’ files). That would work. I was just looking for a more ‘elegant’ solution.

@Carlton_Dodd fixed my post. Damnable autocorrect. SW as in solid works lol.

@Carlton_Dodd @Daniel_ShadowDrakken
I had the same question. In interactive mode you can import .stl into OpenScad (and output to whatever), but this doesn’t help for a directory full of .stl’s. Doesn’t look like CLI can handle .stl as input file.