Update der Attribute Höhe und Drehung vor Aufruf der Exports durchgeführt
This commit is contained in:
+22
-8
@@ -43,13 +43,30 @@ def generate_shape_id():
|
||||
# Merkmale-Builder
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
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):
|
||||
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", ""))
|
||||
}
|
||||
|
||||
@@ -57,14 +74,11 @@ def build_bogen_merkmale(block, eintrag):
|
||||
def build_weiche_merkmale(block, eintrag):
|
||||
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", ""))
|
||||
}
|
||||
|
||||
+22
-8
@@ -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", ""))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user