export_csv: VF_n/GF_n-Einzelelemente (Boegen, Streckenelemente, Umlenk-/Motorstation) als Proxy-Zeilen exportieren

Bisher tauchten nur der Wrapper selbst, verpackte Separatoren und AS/ES-
Kettenenden als eigene CSV-Zeilen auf - die uebrigen Kettenbausteine
(Boegen, gerade Foerderer-/Gefaellestrecken-Segmente, Umlenk-/Motorstation)
blieben nur in der Wrapper-Blockdefinition verpackt. csv:element-proxies-
erzeugen (analog zu csv:sep-proxies-erzeugen) fuegt fuer jeden Fund eine
temporaere Kopie ein, K1/K2 kommen aus dem EIGENEN KS_EIN/KS_AUS jedes
Elements (nicht dem Gesamt-AS/ES der Kette) und bleiben leer, wo keines
existiert (z.B. das nie tatsaechlich eingefuegte Vario_Kurve_*).

Zusaetzlicher Fix: csv:get-k-kos-strings ignorierte bisher die Skalierung
des Top-Level-Inserts - fuer Staustrecke_SP_1000_mm (das per Laenge nicht-
uniform skaliert wird) waere K2 damit falsch gewesen, unabhaengig von der
tatsaechlich gebauten Segmentlaenge.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Michael Stangl
2026-09-24 13:08:35 +02:00
co-authored by Claude Sonnet 5
parent 4f1a0e0b5b
commit f751a90076
8 changed files with 445 additions and 18 deletions
+88
View File
@@ -253,6 +253,25 @@ def build_sensor_merkmale(block):
}
def build_element_merkmale(block):
"""Merkmale-Dict fuer eine ausgepackte VF_n/GF_n-Sub-Komponente (Bogen/
Streckenelement/Umlenkstation/Motorstation) - siehe csv:element-proxies-
erzeugen (export.lsp) und pattern_nested_bogen/_streckenelement/
_umlenkstation/_motorstation in cfg/export.cfg.
ARTINR/LAYER kommen direkt aus den ATTDEFs der ausgepackten Original-
Blockdefinition (ssg-attrib-read auf der temporaeren Kopie) - dieselbe
Quelle wie bei Separator/Scanner (build_sensor_merkmale), aber OHNE
"Zuordnung"-Feld: diese Elemente sind keine einem Carrier zugeordneten
Sensoren, sondern die Geometrie des Carriers selbst."""
attribs = block.get("attribs", {})
return {
"ARTINR": attribs.get("ARTINR", ""),
"Höhe": get_hoehe(block),
"Drehung": get_drehung(block),
}
def build_btmt_merkmale(block):
"""Merkmale-Dict fuer eine eigenstaendige BTMT-Beladung/SC_Entladung-Station
(siehe pattern_btmt_beladung/pattern_btmt_entladung in cfg/export.cfg).
@@ -916,6 +935,10 @@ def process_blocks(blocks, lookup, dbg=None):
vf_count = 0
gf_count = 0
strecke_modul_count = 0
strecke_bogen_count = 0
streckenelement_count = 0
umlenkstation_count = 0
motorstation_count = 0
separator_count = 0
scanner_count = 0
btmt_beladung_count = 0
@@ -1130,6 +1153,71 @@ def process_blocks(blocks, lookup, dbg=None):
})
continue
# Ausgepackte VF_n/GF_n-Sub-Komponenten (Boegen, gerade Foerderer-/
# Gefaellestrecken-Segmente, Umlenk-/Motorstation) - temporaere Kopien,
# siehe csv:element-proxies-erzeugen (export.lsp). MUESSEN vor
# pattern_strecke_module geprueft werden: dessen Muster ("Vario*,
# Staustrecke*, ...") wuerde diese Bloecke sonst zuerst abfangen und
# als generische "ILS 2.0 Strecke - Modul"-Zeile ohne K1/K2 ausgeben.
# k1/k2 brauchen hier keine Sonderbehandlung - bbox_columns() liest
# sie bereits generisch aus dem "k1"/"k2"-Feld des JSON-Rows
# (csv:get-k-kos-strings), genau wie bei jedem anderen Block.
if matches_any(bname, BLOCKPATTERNS.get("pattern_nested_bogen", [])):
elem_nr += 1
strecke_bogen_count += 1
items.append({
"nr": elem_nr,
"teileart": "ILS 2.0 Bogen",
"teileid": block.get("attribs", {}).get("ID") or format_sensor_id("BOG", strecke_bogen_count),
"bezeichnung": f"Bogen :{strecke_bogen_count}",
"planquadrat": planquadrat_column(block, planquadrat_cfg),
"merkmale": build_element_merkmale(block),
**bbox_columns(block),
})
continue
if matches_any(bname, BLOCKPATTERNS.get("pattern_nested_streckenelement", [])):
elem_nr += 1
streckenelement_count += 1
items.append({
"nr": elem_nr,
"teileart": "ILS 2.0 Streckenelement",
"teileid": block.get("attribs", {}).get("ID") or format_sensor_id("STR", streckenelement_count),
"bezeichnung": f"Streckenelement :{streckenelement_count}",
"planquadrat": planquadrat_column(block, planquadrat_cfg),
"merkmale": build_element_merkmale(block),
**bbox_columns(block),
})
continue
if matches_any(bname, BLOCKPATTERNS.get("pattern_nested_umlenkstation", [])):
elem_nr += 1
umlenkstation_count += 1
items.append({
"nr": elem_nr,
"teileart": "ILS 2.0 Umlenkstation",
"teileid": block.get("attribs", {}).get("ID") or format_sensor_id("UML", umlenkstation_count),
"bezeichnung": f"Umlenkstation :{umlenkstation_count}",
"planquadrat": planquadrat_column(block, planquadrat_cfg),
"merkmale": build_element_merkmale(block),
**bbox_columns(block),
})
continue
if matches_any(bname, BLOCKPATTERNS.get("pattern_nested_motorstation", [])):
elem_nr += 1
motorstation_count += 1
items.append({
"nr": elem_nr,
"teileart": "ILS 2.0 Motorstation",
"teileid": block.get("attribs", {}).get("ID") or format_sensor_id("MOT", motorstation_count),
"bezeichnung": f"Motorstation :{motorstation_count}",
"planquadrat": planquadrat_column(block, planquadrat_cfg),
"merkmale": build_element_merkmale(block),
**bbox_columns(block),
})
continue
# ILS Strecke-Module (Vario/Staustrecke-Einzelkomponenten)
if matches_any(bname, BLOCKPATTERNS.get("pattern_strecke_module", [])):
elem_nr += 1