3d-printing/scripts/generate-stl.sh
Felipe M. e843c23de1
Add gridfinity-box-label model and shared decoration library
Introduces a new flat, chamfered label sized for Gridfinity storage box
lids, sharing the same Text/Symbol API as gridfinity-bin-label so both
labels draw from one icon catalogue. Symbol shapes, alignment math, and
text/symbol primitives now live in lib/label-decorations.scad and are
consumed by both labels via `use`. label_text gained \n-driven multi-line
support with a configurable line-spacing factor. STL/preview scripts
skip lib/ since it has no top-level geometry.
2026-05-05 22:25:01 +02:00

27 lines
792 B
Shell
Executable file

#!/usr/bin/env bash
set -euo pipefail
REPO_DIR="$(cd "$(dirname "$0")/.." && pwd)"
if ! command -v openscad &>/dev/null; then
echo "Error: openscad not found in PATH" >&2
exit 1
fi
count=0
skipped=0
while IFS= read -r -d '' scad_file; do
dir="$(dirname "$scad_file")"
name="$(basename "$scad_file" .scad)"
output="${dir}/${name}.stl"
if [[ -f "$output" && "$output" -nt "$scad_file" ]]; then
echo "Skipping ${scad_file} (STL is up to date)"
skipped=$((skipped + 1))
continue
fi
echo "Rendering ${scad_file} -> ${output}"
openscad --render -o "$output" "$scad_file"
count=$((count + 1))
done < <(find "$REPO_DIR" -name '*.scad' -not -path "$REPO_DIR/lib/*" -print0)
echo "Generated ${count} STL file(s), skipped ${skipped}."