-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SUKU preview converter scrtipt added
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
cd ./temp || exit | ||
|
||
# Iterate through all STL files in the temp folder | ||
for stl_file in *.stl; do | ||
# Temporary OpenSCAD script file | ||
tmp_script="__tmp__$stl_file" | ||
|
||
# Extract the file name without extension | ||
filename_no_ext="${stl_file%.*}" | ||
|
||
# Generate OpenSCAD script | ||
echo "import(\"$stl_file\");" > "$tmp_script" | ||
|
||
cat "$tmp_script" | ||
|
||
# Generate PNG preview using OpenSCAD | ||
# xvfb-run -a openscad -o "$filename_no_ext.png" --colorscheme=Tomorrow --imgsize=3200,2400 "$tmp_script" | ||
|
||
xvfb-run -a openscad -o "$filename_no_ext.png" --camera=1,-2,1.5,0,0,0 --viewall --colorscheme=Tomorrow --imgsize=3200,2400 "$tmp_script" | ||
xvfb-run -a openscad -o $filename_no_ext"_reverse.png" --camera=-1,2,-1.5,0,0,0 --viewall --colorscheme=Tomorrow --imgsize=3200,2400 "$tmp_script" | ||
|
||
# Remove the temporary OpenSCAD script | ||
rm "$tmp_script" | ||
done | ||
|
||
echo "PNG previews generated successfully in ./temp" |