Last active
June 8, 2021 14:21
-
-
Save ChadDevOps/19d5024cf8b5de2c9eda2818fed2e544 to your computer and use it in GitHub Desktop.
Windows batch script to create png from stl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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