Update der Attribute Höhe und Drehung vor Aufruf der Exports durchgeführt

This commit is contained in:
2026-06-11 12:08:40 +02:00
parent 0e8d264b6a
commit 9fe08411df
5 changed files with 79 additions and 19 deletions
+22 -8
View File
@@ -60,14 +60,31 @@ def classify_weiche(eintrag):
return "einzelweiche"
def get_hoehe(block):
"""Liest HOEHE aus Block-Attributen. Fallback: Z-Koordinate."""
attribs = block.get("attribs", {})
return attribs.get("HOEHE") or str(int(block.get("z", 0) or 0)) or "2000"
def get_drehung(block):
"""Liest DREHUNG aus Block-Attributen. Fallback: CAD-Rotation."""
attribs = block.get("attribs", {})
drehung_raw = attribs.get("DREHUNG")
if drehung_raw is not None:
try:
return float(drehung_raw)
except (ValueError, TypeError):
pass
return block.get("rotation", 0.0)
def build_bogen_merkmale(block, eintrag):
"""Merkmale-JSON fuer einen Omniflo Bogen."""
return {
"Länge in Meter": "0",
"Kurvenwinkel": eintrag.get("KurvenWinkel", 0),
"Radius": eintrag.get("Radius", 0),
"Höhe": "2000",
"Drehung": block.get("rotation", 0.0),
"Höhe": get_hoehe(block),
"Drehung": get_drehung(block),
"SivasNummer": str(eintrag.get("Sivasnr", ""))
}
@@ -76,14 +93,11 @@ def build_weiche_merkmale(block, eintrag):
"""Merkmale-JSON fuer eine Omniflo Weiche."""
wt = eintrag.get("WeichenTyp", "Einzelweiche")
return {
"Länge in Meter links": 0,
"Länge in Meter rechts": 0,
"Länge in Meter gerade": 0,
"Weichentyp": wt,
"Richtung": str(eintrag.get("KurvenRichtung", "")),
"Weichenwinkel": eintrag.get("KurvenWinkel", 0),
"Höhe": "2000",
"Drehung": block.get("rotation", 0.0),
"Höhe": get_hoehe(block),
"Drehung": get_drehung(block),
"Antrieb Kurve": eintrag.get("SivasnrTEF") is not None,
"SivasNummer": str(eintrag.get("Sivasnr", ""))
}