From 36648649a59a8dd8ddcde12aa202fceea029844d Mon Sep 17 00:00:00 2001
From: Paul Wolok
Date: Wed, 3 Sep 2025 13:44:39 +0200
Subject: [PATCH] =?UTF-8?q?Hinzuf=C3=BCgung=20von=20rotation=20in=20test?=
=?UTF-8?q?=5Fils.csv=20rotation=20system=20f=C3=BCr=20kurven=20hinzugef?=
=?UTF-8?q?=C3=BCgt,=20und=20rotation=20probleme=20f=C3=BCr=20Linean=20beh?=
=?UTF-8?q?oben?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
data/test_ils.csv | 10 +++++-----
lib/plant2dxf.py | 26 ++++++++++++++++++++------
2 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/data/test_ils.csv b/data/test_ils.csv
index b6544de..ec43a43 100644
--- a/data/test_ils.csv
+++ b/data/test_ils.csv
@@ -1,8 +1,8 @@
Elementnummer;TeileArt;TeileId;NachbarIds;Bezeichnung;Planquadrat;Merkmale
-1;"ILS 2.0 Kreisel";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";1;"Kreisel:1";"X:9174.15 Y:12039.11";{"Abstand (Kreiselachse A - Kreiselachse) in Meter":"20.265","Drehung":90}
-2;"ILS 2.0 Kreisel";"shape_8e75c773-8088-b286-9dc0-f601442d5e70";1;"Kreisel:2";"X:18174.14 Y:12004.13";{"Abstand (Kreiselachse A - Kreiselachse) in Meter":"20.265","Drehung":90}
-3;"ILS 2.0 Kreisel";"shape_d76e250a-0a46-f6d0-df52-943ab572cc63";1;"Kreisel:3";"X:12474.15 Y:22171.59";{"Abstand (Kreiselachse A - Kreiselachse) in Meter":"5","Drehung":0}
-4;"ILS 2.0 Weiche";"Weiche_Xg8Ledh-T0ejWPHluSM8tA";1;" zw. Kreisel:3 und Kreisel:1";"X:9574.15 Y:22171.59";{"Weichenart":"Aktiv","Drehung":0}
+1;"ILS 2.0 Kreisel";"shape_f81e5c4b-a976-a3c0-3304-d2b30da1ab29";1;"Kreisel:1";"X:9174.15 Y:12039.11";{"Abstand (Kreiselachse A - Kreiselachse) in Meter":"20.265","Drehung":90, "Drehrichtung":"GZS"}
+2;"ILS 2.0 Kreisel";"shape_8e75c773-8088-b286-9dc0-f601442d5e70";1;"Kreisel:2";"X:18174.14 Y:12004.13";{"Abstand (Kreiselachse A - Kreiselachse) in Meter":"20.265","Drehung":90, "Drehrichtung":"UZS"}
+3;"ILS 2.0 Kreisel";"shape_d76e250a-0a46-f6d0-df52-943ab572cc63";1;"Kreisel:3";"X:12474.15 Y:22171.59";{"Abstand (Kreiselachse A - Kreiselachse) in Meter":"5","Drehung":0, "Drehrichtung":"UZS"}
+4;"ILS 2.0 Weiche";"Weiche_Xg8Ledh-T0ejWPHluSM8tA";1;" zw. Kreisel:3 und Kreisel:1";"X:9574.15 Y:22171.59";{"Weichenart":"Aktiv","Drehung":0, "Drehrichtung":UZS}
5;"ILS 2.0 Gefällestrecke";"shape_ad62cba4-3a33-c4c5-944f-eac7abb7603e";1;"";"X:13674.14 Y:20021.68";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2","Drehung":0}
6;"ILS 2.0 Gefällestrecke";"shape_456bee3e-01e8-be9e-aa74-4265c1195bbe";1;"";"X:13624.15 Y:18421.59";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.1","Drehung":0}
7;"ILS 2.0 Gefällestrecke";"shape_30127aba-263b-1ed5-c5cf-e27933594406";1;"";"X:13674.15 Y:12821.68";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2","Drehung":0}
@@ -17,4 +17,4 @@ Elementnummer;TeileArt;TeileId;NachbarIds;Bezeichnung;Planquadrat;Merkmale
16;"ILS 2.0 Gefällestrecke";"shape_24812b84-fd3b-6a44-0302-2d0fc169a6d9";1;"";"X:13624.16 Y:17621.54";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.1","Drehung":0}
17;"ILS 2.0 Gefällestrecke";"shape_8b856d97-b18b-6263-7c98-79d8b4ca679a";1;"";"X:13674.15 Y:8821.64";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2","Drehung":0}
18;"ILS 2.0 Gefällestrecke";"shape_67f8d19e-8857-1f5d-7d90-3a2a0a9da157";1;"";"X:13674.15 Y:8021.59";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2","Drehung":0}
-19;"ILS 2.0 Gefällestrecke";"shape_80ca3488-cc41-4caa-00cd-b3de9f5428e6";1;"";"X:13674.15 Y:9621.69";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2","Drehung":0}
+19;"ILS 2.0 Gefällestrecke";"shape_80ca3488-cc41-4caa-00cd-b3de9f5428e6";1;"";"X:13674.15 Y:9621.69";{"Anzahl der Zusatzseparatoren":"1","Länge in Meter":"8.2","Drehung":0}
\ No newline at end of file
diff --git a/lib/plant2dxf.py b/lib/plant2dxf.py
index fcea5a3..d0b095a 100644
--- a/lib/plant2dxf.py
+++ b/lib/plant2dxf.py
@@ -150,7 +150,7 @@ def handle_ils_2_0_kreisel(msp, teileid, merkmale, x, y, doc, lib_doc, verbose,
if i < len(positions):
pos = (positions[i][0] + offset[0], positions[i][1] + offset[1])
import_block(blockname, lib_doc, doc)
- bref = msp.add_blockref(blockname, pos, dxfattribs={"rotation": rotation})
+ bref = msp.add_blockref(blockname, pos, dxfattribs={"rotation": merkmale.get("Drehung")})
bref.add_auto_attribs({ATTR_TAG: teileid})
if verbose:
print(f"[INFO] Block '{blockname}' (Kreisel) → {teileid} "
@@ -236,6 +236,7 @@ def handle_standard(msp, blocknames, teileid, x, y, lib_doc, doc, verbose):
print(f"[INFO] Block '{blockname}' (Standard) → {teileid} "
f"({x:.1f}, {y:.1f})")
+
def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols):
# blocks: [block1, block2], offsets: [(ox1, oy1), (ox2, oy2)]
# Länge der Strecke (in Meter, Standard 10)
@@ -292,17 +293,25 @@ def handle_omniflo(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols)
winkel = float(merkmale.get("Drehung", 0))
except Exception:
winkel = 0.0
+
winkel_rad = math.radians(winkel)
halbe_laenge = laenge / 2
- dx = halbe_laenge * math.cos(winkel_rad)
- dy = halbe_laenge * math.sin(winkel_rad)
- start = (x - dx, y - dy)
- ende = (x + dx, y + dy)
+
+ dx = halbe_laenge * math.sin(winkel_rad)
+ dy = halbe_laenge * math.cos(winkel_rad)
+
+ start = (x + dx, y + dy)
+ ende = (x - dx, y - dy)
msp.add_line(start, ende)
+
if verbose:
print(f"[INFO] Omniflo Gerade → {teileid} Linie von ({start[0]:.1f}, {start[1]:.1f}) nach ({ende[0]:.1f}, {ende[1]:.1f})")
return
# Sonst wie gehabt: Block mit SivasNummer
+ if merkmale.get("Radius") is not None:
+ r= float(merkmale.get("Radius"))
+
+
if not lib_doc:
print("[WARN] lib_doc nicht verfügbar, Block wird nicht eingefügt.")
return
@@ -314,7 +323,12 @@ def handle_omniflo(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols)
print(f"[WARN] Omniflo-Block '{blockname}' nicht in Bibliothek {lib_doc.filename}. Überspringe {teileid}.")
return
import_block(blockname, lib_doc, doc)
- bref = msp.add_blockref(blockname, (x, y))
+ if merkmale.get("Drehung")== 0:
+ bref = msp.add_blockref(blockname, (x, y), dxfattribs={"xscale": 1.0, "yscale":1.0,"rotation": merkmale.get("Drehung")})
+
+ else:
+ bref = msp.add_blockref(blockname, (x, y), dxfattribs={"xscale": 1.0, "yscale":1.0,"rotation": merkmale.get("Drehung")+180})
+
bref.add_auto_attribs({ATTR_TAG: teileid})
if verbose:
print(f"[INFO] Block '{blockname}' (Omniflo) → {teileid} ({x:.1f}, {y:.1f})")