Fehlende Länge des Tunnels zu Fehler deklariert
This commit is contained in:
+6
-8
@@ -505,7 +505,6 @@ def get_tunnel_positions_from_symbols(all_inserts: list, all_positions: list, er
|
||||
ret = {}
|
||||
tunnel_length = {}
|
||||
tunnel_missing_length = {}
|
||||
default_length = "5" # Default-Länge in Metern
|
||||
|
||||
for insert, pos in zip(all_inserts, all_positions):
|
||||
if "NAME" not in insert: # Tunnel haben immer einen eindeutigen Namen
|
||||
@@ -524,18 +523,17 @@ def get_tunnel_positions_from_symbols(all_inserts: list, all_positions: list, er
|
||||
ret[id_] = []
|
||||
ret[id_].append(ld["pos"])
|
||||
|
||||
# Sammle Längeninformation falls vorhanden, sonst Default verwenden
|
||||
# Sammle Längeninformation falls vorhanden, sonst Fehler melden
|
||||
if "laenge" in ld and ld["laenge"]:
|
||||
tunnel_length[id_] = ld["laenge"]
|
||||
else:
|
||||
warning_msg = f"Tunnel '{id_}' hat keine LAENGE-Angabe. Verwende Default-Länge: {default_length}m"
|
||||
print(f"WARNUNG: {warning_msg}")
|
||||
tunnel_missing_length[id_] = warning_msg
|
||||
tunnel_length[id_] = default_length
|
||||
error_msg = f"Tunnel '{id_}' hat keine LAENGE-Angabe. Bitte LAENGE-Attribut im DXF-Symbol setzen."
|
||||
print(f"FEHLER: {error_msg}")
|
||||
tunnel_missing_length[id_] = error_msg
|
||||
|
||||
# Warnings zum ErrorCollector hinzufügen
|
||||
# Fehlende LAENGE als Fehler melden (stoppt die Verarbeitung)
|
||||
if error_collector and tunnel_missing_length:
|
||||
error_collector.add_warnings({"tunnel_missing_length": tunnel_missing_length})
|
||||
error_collector.add_errors({"tunnel_missing_length": tunnel_missing_length})
|
||||
|
||||
# Füge Längeninformation hinzu, falls Tunnel gefunden wurden
|
||||
if len(tunnel_length) > 0:
|
||||
|
||||
+1
-1
@@ -573,7 +573,7 @@ class Anlage():
|
||||
color = "blue"
|
||||
elif re.match("t-.*", rname):
|
||||
color = "orange"
|
||||
tname = rname.split("-")[2]
|
||||
tname = rname.split("-", 2)[2]
|
||||
weight = self.get_tunnel_length(tname)
|
||||
elif re.match("c-.*", rname):
|
||||
color = "green"
|
||||
|
||||
Reference in New Issue
Block a user