From be36aedd0b2c5aca220feb77c1d920bc1978b851 Mon Sep 17 00:00:00 2001 From: Marcus Schellhammer Date: Mon, 28 Jul 2025 12:08:42 +0200 Subject: [PATCH] =?UTF-8?q?Angaben=20mit=20EinzelBl=C3=B6cken=20mit=20SPS?= =?UTF-8?q?=20in=20den=20Attributen=20wird=20nun=20den=20Schaltschr=C3=A4n?= =?UTF-8?q?ken=20zugeschlagen.=20Damit=20werden=20die=20Bl=C3=B6cke=20von?= =?UTF-8?q?=20SF=20und=20PF=20auch=20verarbeitet=20und=20richtig=20den=20S?= =?UTF-8?q?ensoren=20bzw.=20Schaltschrankelementen=20zugeordnet?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/getpositions.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/getpositions.py b/lib/getpositions.py index 1ff3be9..a705f45 100644 --- a/lib/getpositions.py +++ b/lib/getpositions.py @@ -246,6 +246,8 @@ def extract_input_positions(insert_iterable) -> tuple[dict, dict, dict, dict]: # Die Funktion sucht die übereinanderliegenen Elemente und baut ein Dict daraus allocate_blocks_together(all_sensors, wp) + set_single_frames_with_unique_sps(all_schaltschrank, wp) + # die noch übrigen Blöcke melden missing_attribs, double_ids = get_errors_double_and_attributes(wp) @@ -280,6 +282,20 @@ def get_errors_double_and_attributes(wp: CompareBuffer) -> tuple[dict, dict]: double_ids[id_].append(block['pos']) return missing_attribs, double_ids +def set_single_frames_with_unique_sps(all_sensors: dict, wp: CompareBuffer): + all_sensors_ids = wp.get_block_ids() + for id_ in all_sensors_ids: + blks_sps = wp.get_all_sps_blocks(id_) + + for block_with_sps in blks_sps: + # schaue ob es keinen Konflikt zu bestehenden Angaben + if "IO" in block_with_sps and "SPS" in block_with_sps: + sps_praefix = block_with_sps["SPS"] + new_id = f"{id_}@{sps_praefix}" + + all_sensors[new_id] = block_with_sps + wp.remove_block(id_, block_with_sps) + def allocate_blocks_together(all_sensors: dict, wp: CompareBuffer) -> None: """ Merge sensor blocks with the same ID that are split across multiple DXF blocks.