Hinzufügung von rotation in test_ils.csv

rotation system für kurven hinzugefügt, und rotation probleme für Linean behoben
This commit is contained in:
2025-09-03 13:44:39 +02:00
parent 67aed63507
commit 36648649a5
2 changed files with 25 additions and 11 deletions
+5 -5
View File
@@ -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}
Can't render this file because it contains an unexpected character in line 2 and column 104.
+20 -6
View File
@@ -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})")