CONNECTION_INSERT/EDIT: Attributnamen wie die Bloecke aus sps_skel

Die Befehle schrieben ID/FROM_ID/TO_ID und lasen den Markernamen aus TRO_ID -
Attribute, die CONNECTION_ARROW und die TRO-Marker von tro_annotate nicht
haben (ssg-attrib-set-on ueberspringt sie still). Jetzt UID/FROM_UID/TO_UID
und Markername aus ID; alte Namen werden mitgelesen und mitgeschrieben.
Rueckweg nach sps_skel: tro_annotate --read-tros (edit_connections).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 14:32:11 +01:00
parent 56c926cc07
commit 767e47980b
3 changed files with 50 additions and 16 deletions
+40 -14
View File
@@ -8,13 +8,22 @@
;; TRO11 ----------> TRO14
;; ID 0062 ID 0065
;;
;; Attribute des Verbindungsblocks:
;; ID unsichtbar - eindeutige interne Nummer (ID-Raum von SSG_LIB)
;; FROM_ID unsichtbar - interne ID der Quelle
;; TO_ID unsichtbar - interne ID des Ziels
;; FROM_TRO sichtbar - sprechender Name der Quelle
;; TO_TRO sichtbar - sprechender Name des Ziels
;; KIND unsichtbar - flow | colocated
;; Attribute des Verbindungsblocks (wie sps_skel lib/tro_annotate.py sie
;; anlegt):
;; UID unsichtbar - eindeutige interne Nummer (ID-Raum von SSG_LIB)
;; FROM_UID unsichtbar - interne Nummer (UID) des Quell-Markers
;; TO_UID unsichtbar - interne Nummer (UID) des Ziel-Markers
;; FROM_TRO unsichtbar - sprechender Name der Quelle (Attribut ID des Markers)
;; TO_TRO unsichtbar - sprechender Name des Ziels
;; KIND unsichtbar - flow | weiche
;; Aeltere Bloecke trugen ID/FROM_ID/TO_ID - gelesen wird beides, geschrieben
;; wird in beide Namen (ssg-attrib-set-on ueberspringt fehlende Attribute).
;;
;; Zurueck nach sps_skel: tro_annotate --read-tros liest die Verbindungsbloecke
;; mit; ein Ende wird erst ueber den Namen (FROM_TRO/TO_TRO), sonst ueber die
;; UID einem Marker zugeordnet. Hinzugefuegte und geloeschte Bloecke werden zu
;; [<csv>.edit_connections] in cfg/tro_overrides.ini. Eine Verbindung loescht
;; man mit ihrem Block (Pfeil-Geometrie allein zaehlt nicht).
;;
;; Warum interne IDs: der sprechende Name darf sich aendern (TRO_EDIT), die
;; interne ID nicht. Ein DXF-Export kann die Beziehung damit eindeutig
@@ -45,10 +54,20 @@
(if wert wert "")
)
;; Erstes nicht leeres Attribut aus einer Liste von Tags (neu vor alt)
(defun con-attrib-1 (ent tags / wert)
(setq wert "")
(foreach tag tags
(if (= wert "") (setq wert (con-attrib ent tag)))
)
wert
)
;; ------------------------------------------------------------
;; Einen TRO-Marker waehlen; liefert (ename interne-ID sprechender-Name)
;; oder nil bei Abbruch bzw. falschem Block.
;; oder nil bei Abbruch bzw. falschem Block. Marker von sps_skel tragen die
;; interne Nummer in UID und den Namen in ID (aeltere: ID und TRO_ID).
;; ------------------------------------------------------------
(defun con-pick-tro (prompt-key / sel ent bname)
(setq sel (entsel (ssg-text prompt-key)))
@@ -59,7 +78,9 @@
bname (cdr (assoc 2 (entget ent))))
(if (not (wcmatch bname "TRO_*"))
(progn (alert (ssg-textf "con-kein-tro" (list bname))) nil)
(list ent (con-attrib ent "ID") (con-attrib ent "TRO_ID"))
(if (/= (con-attrib ent "UID") "")
(list ent (con-attrib ent "UID") (con-attrib ent "ID"))
(list ent (con-attrib ent "ID") (con-attrib-1 ent '("TRO_ID" "ID"))))
)
)
)
@@ -130,7 +151,10 @@
;; Eindeutige interne ID im ID-Raum von SSG_LIB
(setq neue-id (ssg-id-format (1+ (ssg-id-max))))
(ssg-attrib-set-on ent-neu
(list (cons "ID" neue-id)
(list (cons "UID" neue-id)
(cons "ID" neue-id)
(cons "FROM_UID" (cadr von))
(cons "TO_UID" (cadr nach))
(cons "FROM_ID" (cadr von))
(cons "TO_ID" (cadr nach))
(cons "FROM_TRO" (caddr von))
@@ -183,8 +207,8 @@
)
)
(setq alt-from-id (con-attrib ent "FROM_ID")
alt-to-id (con-attrib ent "TO_ID")
(setq alt-from-id (con-attrib-1 ent '("FROM_UID" "FROM_ID"))
alt-to-id (con-attrib-1 ent '("TO_UID" "TO_ID"))
alt-from (con-attrib ent "FROM_TRO")
alt-to (con-attrib ent "TO_TRO")
alt-kind (con-attrib ent "KIND"))
@@ -199,7 +223,7 @@
)
)
(set_tile "blockname" (ssg-textf "con-block" (list bname (con-attrib ent "ID"))))
(set_tile "blockname" (ssg-textf "con-block" (list bname (con-attrib-1 ent '("UID" "ID")))))
(set_tile "from_id" alt-from-id)
(set_tile "from_tro" alt-from)
(set_tile "to_id" alt-to-id)
@@ -233,7 +257,9 @@
(alert (ssg-text "con-gleiche-id"))
(progn
(ssg-attrib-set-on ent
(list (cons "FROM_ID" neu-from-id)
(list (cons "FROM_UID" neu-from-id)
(cons "TO_UID" neu-to-id)
(cons "FROM_ID" neu-from-id)
(cons "TO_ID" neu-to-id)
(cons "FROM_TRO" neu-from)
(cons "TO_TRO" neu-to)