Skip to content

Instantly share code, notes, and snippets.

@ChadDevOps
Last active June 8, 2021 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChadDevOps/19d5024cf8b5de2c9eda2818fed2e544 to your computer and use it in GitHub Desktop.
Save ChadDevOps/19d5024cf8b5de2c9eda2818fed2e544 to your computer and use it in GitHub Desktop.
Windows batch script to create png from stl
REM Install OpenSCAD (e.g. if using chocolatey run: choco install openscad -y)
REM Run batch script in root folder, this will recursively go into all sub folders.
echo off
call :treeProcess
goto :eof
:treeProcess
for %%f in (*.stl) do (
if not exist "%%~nf.png" (
echo import("%%f"); >"__tmp__%%f_tmp"
echo on
echo Creating "%%~nf.png" from "%%f" at "%CD%"
echo off
c:/PROGRA~1/OpenSCAD/openscad.exe -o "%%~nf.png" --autocenter --viewall --imgsize=1080,1080 "__tmp__%%f_tmp" > nul 2>&1
)
)
del __tmp* > nul 2>&1
for /D %%d in (*) do (
cd "%%d"
call :treeProcess
cd ..
)
exit /b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment