35 lines
1.1 KiB
Bash
35 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
# ================================================================
|
|
# SPS_SKEL - TROs aus der annotierten Zeichnung nach JSON lesen
|
|
# ================================================================
|
|
# Aufruf:
|
|
# bash bin/tro_extract.sh
|
|
# bash bin/tro_extract.sh --dxf export_annotated.dxf
|
|
# bash bin/tro_extract.sh --dxf export_annotated.dxf --out tros.json
|
|
#
|
|
# Die Zeichnung wird in $SKEL_RESULTS gesucht, die JSON-Datei wird
|
|
# ebenfalls dort abgelegt.
|
|
#
|
|
# Gegenrichtung zu: bin/tro_annotate.sh (JSON <- Zeichnung)
|
|
# ================================================================
|
|
|
|
set -eu
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# Umgebung setzen (SKEL_DATA, SKEL_RESULTS, SKEL_LIB, PYTHONPATH ...)
|
|
# shellcheck source=/dev/null
|
|
. "$SCRIPT_DIR/setenv.sh" >/dev/null
|
|
|
|
# Virtuelle Umgebung nutzen, falls vorhanden (pydantic wird benoetigt)
|
|
if [ -f "$SPS_SKEL/.venv/bin/activate" ]; then
|
|
# shellcheck source=/dev/null
|
|
. "$SPS_SKEL/.venv/bin/activate"
|
|
fi
|
|
|
|
# Python-Interpreter bestimmen
|
|
PY="python3"
|
|
command -v python3 >/dev/null 2>&1 || PY="python"
|
|
|
|
exec "$PY" "$SKEL_LIB/tro_extract.py" "$@"
|