Add TRO annotation tool writing an annotated copy of the drawing
Takes the original DXF, the CSV export and the derived TROs and writes a copy of the drawing with the TRO information overlaid. The original is never touched. Per TRO a block marker with attributes, not loose geometry: one block definition per type (TRO_SYM_<type>), inserted at the plant coordinate, carrying TRO_ID, TRO_TYPE, FB_BLOCK visibly and ITEMS, CONFIDENCE, SEPARATORS as hidden data. That makes the result queryable and editable inside BricsCAD, and a corrected TRO_ID can later feed back into the generator. Layers follow the colour groups of tro_catalog (TRO_MARKER_sep, _vario, _store, ...) with the group colour as true colour and entities BYLAYER, so the layer manager filters by TRO type. Flow arrows and the legend get their own layers. Re-runs are idempotent through XDATA, not layer names: every generated entity is tagged with the SPS_SKEL_TRO appid and a re-run deletes exactly those. Deleting by layer would also destroy anything a user had put on the same layer. Switches follow the other tools; --check reports the registration and what would be drawn without writing, --flow adds the TRO-level arrows, --fb shows the function block, --offset and --re-register override the stored transform. DWG is rejected with a clear message since ezdxf cannot read it. Verified against the real 23.8 MB drawing: 9 markers on the correct layers with readable attributes, 15 flow arrows, and a re-run replaces its own 46 entities instead of duplicating them. Adds ezdxf to requirements and stores the verified Mubea transform in cfg/. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
@echo off
|
||||
REM ================================================================
|
||||
REM SPS_SKEL - TROs in die BricsCAD-Zeichnung einblenden
|
||||
REM ================================================================
|
||||
REM Aufruf:
|
||||
REM bin\tro_annotate.bat --file mubea.csv --dxf 500573_60_1.dxf --check
|
||||
REM bin\tro_annotate.bat --file mubea.csv --dxf 500573_60_1.dxf --flow --fb --legend
|
||||
REM
|
||||
REM Die CSV-Datei und die Zeichnung werden in %SKEL_DATA% gesucht (oder als
|
||||
REM vollstaendiger Pfad angegeben). Das beschriftete DXF liegt in
|
||||
REM %SKEL_RESULTS%, der gepruefte Lagebezug in %SKEL_CFG%.
|
||||
REM
|
||||
REM Die Originalzeichnung wird nie veraendert. DWG wird nicht unterstuetzt.
|
||||
REM ================================================================
|
||||
|
||||
setlocal
|
||||
|
||||
REM Umgebung setzen (SKEL_DATA, SKEL_RESULTS, SKEL_CFG, SKEL_LIB, PYTHONPATH ...)
|
||||
call "%~dp0setenv.bat" >nul
|
||||
|
||||
REM Virtuelle Umgebung nutzen (ezdxf und pydantic werden benoetigt)
|
||||
if exist "%SPS_SKEL%\.venv\Scripts\activate.bat" (
|
||||
call "%SPS_SKEL%\.venv\Scripts\activate.bat"
|
||||
)
|
||||
|
||||
REM Python-Interpreter bestimmen (py-Launcher bevorzugt, sonst python)
|
||||
set "PY=py"
|
||||
py --version >nul 2>&1 || set "PY=python"
|
||||
|
||||
"%PY%" "%SKEL_LIB%\tro_annotate.py" %*
|
||||
set "RC=%ERRORLEVEL%"
|
||||
|
||||
endlocal & exit /b %RC%
|
||||
@@ -0,0 +1,34 @@
|
||||
#!/usr/bin/env bash
|
||||
# ================================================================
|
||||
# SPS_SKEL - TROs in die BricsCAD-Zeichnung einblenden
|
||||
# ================================================================
|
||||
# Aufruf:
|
||||
# bash bin/tro_annotate.sh --file mubea.csv --dxf 500573_60_1.dxf --check
|
||||
# bash bin/tro_annotate.sh --file mubea.csv --dxf 500573_60_1.dxf --flow --fb --legend
|
||||
#
|
||||
# Die CSV-Datei und die Zeichnung werden in $SKEL_DATA gesucht (oder als
|
||||
# vollstaendiger Pfad angegeben). Das beschriftete DXF liegt in $SKEL_RESULTS,
|
||||
# der gepruefte Lagebezug in $SKEL_CFG.
|
||||
#
|
||||
# Die Originalzeichnung wird nie veraendert. DWG wird nicht unterstuetzt.
|
||||
# ================================================================
|
||||
|
||||
set -eu
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
# Umgebung setzen (SKEL_DATA, SKEL_RESULTS, SKEL_CFG, SKEL_LIB, PYTHONPATH ...)
|
||||
# shellcheck source=/dev/null
|
||||
. "$SCRIPT_DIR/setenv.sh" >/dev/null
|
||||
|
||||
# Virtuelle Umgebung nutzen (ezdxf und pydantic werden 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_annotate.py" "$@"
|
||||
Reference in New Issue
Block a user