Dict fü Dubletten angelegt. Error message angepasst.
This commit is contained in:
+11
-13
@@ -147,14 +147,11 @@ def check_double_ids(ld, id, allSensors):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
|
||||
|
||||
def extract_input_positions(insert_iterable) -> tuple:
|
||||
allSensors = dict()
|
||||
allCables = dict()
|
||||
allunknowns = dict()
|
||||
doubleIds = list()
|
||||
doubleIds = dict()
|
||||
allSchaltschrank = dict()
|
||||
|
||||
for insert in insert_iterable:
|
||||
@@ -171,11 +168,13 @@ def extract_input_positions(insert_iterable) -> tuple:
|
||||
allSensors[id] = merge_two_dicts(allSensors[id], ld) #Kombiniert alle infos aus dxf und "pos"
|
||||
else:
|
||||
# gib aus wo sich beide gleichlautenden Elemente auf der Zeichnung befinden
|
||||
doubleIds.append((id, allSensors[id]["pos"]) )
|
||||
doubleIds.append((id, ld["pos"]) )
|
||||
|
||||
if id not in doubleIds:
|
||||
doubleIds[id] = []
|
||||
doubleIds[id].append(allSensors[id]["pos"]) # erste Position
|
||||
doubleIds[id].append(ld["pos"]) # zweite Position
|
||||
else:
|
||||
allSensors[id] = ld
|
||||
|
||||
elif typ == "Kabel":
|
||||
allCables[id] = ld
|
||||
elif typ == "Schaltschrankelement":
|
||||
@@ -478,7 +477,7 @@ def dxf_is_binary(dxf_path):
|
||||
def validate_configs():
|
||||
errors= []
|
||||
|
||||
print("Validating given configs: Checking for inconsistency.")
|
||||
print("\nValidating given configs: Checking for inconsistency.")
|
||||
|
||||
# 1. Alle Prefixes aus Routing_include müssen in Cable_Mapping stehen (nur BMK.cfg)
|
||||
if config_BMK.has_section("Routing-Include") and config_BMK.has_section("Cable-Mapping"):
|
||||
@@ -508,9 +507,9 @@ def validate_configs():
|
||||
print("Inconsistencies found:")
|
||||
for e in errors:
|
||||
print(f"- {e}")
|
||||
print("continuing")
|
||||
print("\ncontinuing with routing process")
|
||||
else:
|
||||
print ("No inconsistencies found")
|
||||
print ("No inconsistencies found. Continuing with routing process.")
|
||||
|
||||
def check_environment_var(env_str:str) -> Path:
|
||||
out_path = os.environ.get(env_str)
|
||||
@@ -592,9 +591,8 @@ if __name__ == '__main__':
|
||||
res_sens, res_double = get_input_positions(msp)
|
||||
|
||||
if args.errors and len(res_double) > 0:
|
||||
err_ids = set()
|
||||
for item in res_double:
|
||||
err_ids.add(item[0])
|
||||
print("Duplicate blocks found. Writing errors-file.")
|
||||
err_ids = list(res_double.keys())
|
||||
write_results(to_json(list(err_ids)), work_dir, args.errors)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user