Gefällestrecke in Sivas und csv Exports eingebaut

This commit is contained in:
2026-07-02 13:19:30 +02:00
parent 3dd6e091e0
commit 05a7000d33
2 changed files with 103 additions and 12 deletions
+70 -12
View File
@@ -64,6 +64,11 @@ def get_hoehe_mm(block):
return v
def get_id(block):
"""Liest das eindeutige ID-Attribut eines Blocks (von ssg-id-check-all vergeben)."""
return block.get("attribs", {}).get("ID", "")
def format_hoehe_m(hoehe_mm_str):
"""Konvertiert mm-String nach m mit deutschem Dezimaltrennzeichen."""
try:
@@ -129,12 +134,14 @@ def process_blocks(blocks, lookup):
items - Liste der CSV-Zeilen als Dicts
counters - Zaehler fuer ILS-Automation-Summierungszeile
"""
# Gruppen: sivasnr_str -> {anzahl, hoehe_mm}
# Gruppen: sivasnr_str -> {anzahl, hoehe_mm, ids}
bogen_groups = {} # sivasnr -> dict
weiche_groups = {} # sivasnr -> dict
# Gerade: artinr_str -> {anzahl, laenge_mm_total, hoehe_mm}
# Gerade: artinr_str -> {anzahl, laenge_mm_total, hoehe_mm, ids}
gerade_groups = {}
kreisel_list = [] # Liste von blocks
eckrad_ids = [] # IDs aller Eckrad-Bloecke
strecke_ids = [] # IDs aller Strecke-Module (VF_*, GF_*, Vario/Staustrecke)
counters = {
"anzahl_boegen": 0,
@@ -181,14 +188,16 @@ def process_blocks(blocks, lookup):
if typ == "bogen":
if sivasnr not in bogen_groups:
bogen_groups[sivasnr] = {"anzahl": 0, "hoehe_mm": hoehe}
bogen_groups[sivasnr] = {"anzahl": 0, "hoehe_mm": hoehe, "ids": []}
bogen_groups[sivasnr]["anzahl"] += 1
bogen_groups[sivasnr]["ids"].append(get_id(block))
counters["anzahl_boegen"] += 1
elif typ == "weiche":
if sivasnr not in weiche_groups:
weiche_groups[sivasnr] = {"anzahl": 0, "hoehe_mm": hoehe}
weiche_groups[sivasnr] = {"anzahl": 0, "hoehe_mm": hoehe, "ids": []}
weiche_groups[sivasnr]["anzahl"] += 1
weiche_groups[sivasnr]["ids"].append(get_id(block))
subtyp = classify_weiche(eintrag)
if subtyp == "einzelweiche":
counters["anzahl_einzelweichen"] += 1
@@ -217,10 +226,12 @@ def process_blocks(blocks, lookup):
pass
if key not in gerade_groups:
gerade_groups[key] = {
"anzahl": 0, "laenge_mm": 0.0, "hoehe_mm": hoehe, "artinr": artinr
"anzahl": 0, "laenge_mm": 0.0, "hoehe_mm": hoehe,
"artinr": artinr, "ids": [],
}
gerade_groups[key]["anzahl"] += 1
gerade_groups[key]["laenge_mm"] += laenge
gerade_groups[key]["ids"].append(get_id(block))
counters["gesamtlaenge_ap110"] += laenge
continue
@@ -247,12 +258,57 @@ def process_blocks(blocks, lookup):
# --- ILS Eckrad ---
if bname.startswith("ECKRAD_"):
counters["anzahl_eckraeder"] += 1
eckrad_ids.append(get_id(block))
continue
# --- ILS Strecke-Module (Vario/Staustrecke) ---
# --- VarioFoerderer Compound-Block (VF_N) ---
if bname.startswith("VF_"):
attribs = block.get("attribs", {})
counters["anzahl_variofoerderer"] += 1
strecke_ids.append(get_id(block))
try:
counters["laengen_variofoerderer"] += float(attribs.get("L_VF_m", "0") or "0")
except (ValueError, TypeError):
pass
try:
counters["anzahl_separatoren"] += int(attribs.get("ANZAHL_SEPARATOR", "0") or "0")
except (ValueError, TypeError):
pass
try:
counters["anzahl_scanner"] += int(attribs.get("ANZAHL_SCANNER", "0") or "0")
except (ValueError, TypeError):
pass
if counters["anzahl_streckengruppen"] == 0:
counters["anzahl_streckengruppen"] = 1
continue
# --- Gefaellestrecke Compound-Block (GF_N) ---
if bname.startswith("GF_"):
attribs = block.get("attribs", {})
counters["anzahl_variofoerderer"] += 1
counters["anzahl_gefaellestrecken"] += 1
strecke_ids.append(get_id(block))
try:
counters["laengen_gefaellestrecken"] += float(attribs.get("L_GF_m", "0") or "0")
except (ValueError, TypeError):
pass
try:
counters["anzahl_separatoren"] += int(attribs.get("ANZAHL_SEPARATOR", "0") or "0")
except (ValueError, TypeError):
pass
try:
counters["anzahl_scanner"] += int(attribs.get("ANZAHL_SCANNER", "0") or "0")
except (ValueError, TypeError):
pass
if counters["anzahl_streckengruppen"] == 0:
counters["anzahl_streckengruppen"] = 1
continue
# --- ILS Strecke-Module (Vario/Staustrecke, einzelne Komponenten in Modelspace) ---
for sb in STRECKE_BLOCKS:
if sb in bname:
counters["anzahl_variofoerderer"] += 1
strecke_ids.append(get_id(block))
break
# --- Zeilen aufbauen ---
@@ -269,7 +325,7 @@ def process_blocks(blocks, lookup):
"anzahl": g["anzahl"],
"laenge_mm": "",
"hoehe_m": format_hoehe_m(g["hoehe_mm"]),
"details": {},
"details": {"IDs": g["ids"]},
})
nr += 1
@@ -283,7 +339,7 @@ def process_blocks(blocks, lookup):
"anzahl": g["anzahl"],
"laenge_mm": "",
"hoehe_m": format_hoehe_m(g["hoehe_mm"]),
"details": {},
"details": {"IDs": g["ids"]},
})
nr += 1
@@ -297,12 +353,14 @@ def process_blocks(blocks, lookup):
"anzahl": g["anzahl"],
"laenge_mm": int(g["laenge_mm"]),
"hoehe_m": format_hoehe_m(g["hoehe_mm"]),
"details": {},
"details": {"IDs": g["ids"]},
})
nr += 1
for block in kreisel_list:
sivasnr, teileart = ILS_SIVASNR["kreisel"]
details = build_kreisel_details(block)
details["ID"] = get_id(block)
items.append({
"nr": nr,
"teileart": teileart,
@@ -312,7 +370,7 @@ def process_blocks(blocks, lookup):
"anzahl": 1,
"laenge_mm": "",
"hoehe_m": "",
"details": build_kreisel_details(block),
"details": details,
})
nr += 1
@@ -327,7 +385,7 @@ def process_blocks(blocks, lookup):
"anzahl": counters["anzahl_eckraeder"],
"laenge_mm": "",
"hoehe_m": "",
"details": {},
"details": {"IDs": eckrad_ids},
})
nr += 1
@@ -342,7 +400,7 @@ def process_blocks(blocks, lookup):
"anzahl": counters["anzahl_variofoerderer"],
"laenge_mm": "",
"hoehe_m": "",
"details": {},
"details": {"IDs": strecke_ids},
})
nr += 1