Skip to content

Commit

Permalink
SUKU preview converter scrtipt added
Browse files Browse the repository at this point in the history
  • Loading branch information
SukuWc committed Jul 3, 2024
1 parent 088715d commit 668b7ad
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/openscad_preview.sh
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"

0 comments on commit 668b7ad

Please sign in to comment.