CSV-Export: Nachbarschaftserkennung ueber Bounding-Box-Ueberschneidung (STRtree/shapely)

Neue Spalte "Nachbarn" (kommaseparierte TeileId-Liste) in export_csv.py:
zwei Elemente gelten als benachbart, wenn ihre Bounding-Boxes (x/y-Ebene)
sich ueberschneiden. Toleranz konfigurierbar in mm ueber cfg/export.cfg
[Nachbarschaft] -> toleranz_mm, siehe lib/export_neighbors.py.
Nur EXPORTCSV betroffen, EXPORTSIVAS bleibt unveraendert.

shapely als neue Abhaengigkeit in requirements.txt ergaenzt.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-22 15:26:30 +02:00
parent 57badf0556
commit 6ab698286f
9 changed files with 315 additions and 127 deletions
+2 -2
View File
@@ -107,7 +107,7 @@ class TestOmnifloExportUnit:
out_dir = _output_dir()
os.makedirs(out_dir, exist_ok=True)
csv_path = os.path.join(out_dir, "omniflo_export.csv")
header = "Elementnummer;TeileArt;TeileId;Bezeichnung;Planquadrat;Anzahl;Position;Boundingbox;Merkmale"
header = "Elementnummer;TeileArt;TeileId;Bezeichnung;Planquadrat;Anzahl;Position;Boundingbox;Nachbarn;Merkmale"
with open(csv_path, "w", encoding="utf-8") as f:
f.write(header + "\n")
for item in self.items:
@@ -333,7 +333,7 @@ def _reference_dir():
def _normalize_row(line):
"""Splittet eine CSV-Zeile und ersetzt die TeileId (UUID) durch Platzhalter."""
cols = line.strip().split(";", 8)
cols = line.strip().split(";", 9)
if len(cols) >= 3:
cols[2] = "<ID>"
return cols