#!/usr/bin/env bash # SPDX-License-Identifier: Apache-2.0 # @author Arnaud Morin # # Build every export from the model into build/. # # ./build.sh STEP + STL + DXF + the assembly PNGs # ./build.sh --no-png skip the renders, which are most of the runtime # set -euo pipefail cd "$(dirname "$0")" if ! command -v uv >/dev/null 2>&1; then echo "build.sh: uv not found." >&2 echo " install it: curl -LsSf https://astral.sh/uv/install.sh | sh" >&2 exit 1 fi # Creates .venv from pyproject.toml the first time; a no-op on every run after # that. --inexact so it installs what the model needs without pruning anything # else you keep in there, an ipython or a cq-editor say. uv sync --inexact # --no-sync below: uv run would otherwise re-sync per invocation, and it has no # --inexact of its own, so it would undo the line above and prune those extras. run() { uv run --no-sync python "$@"; } # Each part asserts it came out as one solid at import time, so a part that # broke stops the build here rather than quietly exporting a bad STL. for part in plate arm motor_base spar camera_mount standoff lollipop fc; do run "$part.py" done run frame.py "$@"