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 = {}
|
ret = {}
|
||||||
tunnel_length = {}
|
tunnel_length = {}
|
||||||
tunnel_missing_length = {}
|
tunnel_missing_length = {}
|
||||||
default_length = "5" # Default-Länge in Metern
|
|
||||||
|
|
||||||
for insert, pos in zip(all_inserts, all_positions):
|
for insert, pos in zip(all_inserts, all_positions):
|
||||||
if "NAME" not in insert: # Tunnel haben immer einen eindeutigen Namen
|
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_] = []
|
||||||
ret[id_].append(ld["pos"])
|
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"]:
|
if "laenge" in ld and ld["laenge"]:
|
||||||
tunnel_length[id_] = ld["laenge"]
|
tunnel_length[id_] = ld["laenge"]
|
||||||
else:
|
else:
|
||||||
warning_msg = f"Tunnel '{id_}' hat keine LAENGE-Angabe. Verwende Default-Länge: {default_length}m"
|
error_msg = f"Tunnel '{id_}' hat keine LAENGE-Angabe. Bitte LAENGE-Attribut im DXF-Symbol setzen."
|
||||||
print(f"WARNUNG: {warning_msg}")
|
print(f"FEHLER: {error_msg}")
|
||||||
tunnel_missing_length[id_] = warning_msg
|
tunnel_missing_length[id_] = error_msg
|
||||||
tunnel_length[id_] = default_length
|
|
||||||
|
|
||||||
# Warnings zum ErrorCollector hinzufügen
|
# Fehlende LAENGE als Fehler melden (stoppt die Verarbeitung)
|
||||||
if error_collector and tunnel_missing_length:
|
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
|
# Füge Längeninformation hinzu, falls Tunnel gefunden wurden
|
||||||
if len(tunnel_length) > 0:
|
if len(tunnel_length) > 0:
|
||||||
|
|||||||
+1
-1
@@ -573,7 +573,7 @@ class Anlage():
|
|||||||
color = "blue"
|
color = "blue"
|
||||||
elif re.match("t-.*", rname):
|
elif re.match("t-.*", rname):
|
||||||
color = "orange"
|
color = "orange"
|
||||||
tname = rname.split("-")[2]
|
tname = rname.split("-", 2)[2]
|
||||||
weight = self.get_tunnel_length(tname)
|
weight = self.get_tunnel_length(tname)
|
||||||
elif re.match("c-.*", rname):
|
elif re.match("c-.*", rname):
|
||||||
color = "green"
|
color = "green"
|
||||||
|
|||||||
Reference in New Issue
Block a user