From fabed828dbb163142751f2d3501d53f37ba23161 Mon Sep 17 00:00:00 2001
From: Paul Wolok
Date: Wed, 10 Dec 2025 12:39:02 +0100
Subject: [PATCH] =?UTF-8?q?Vorbereitung=20f=C3=BCr=20vario=20offset=20bei?=
=?UTF-8?q?=20kurven?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
lib/Elemente/VarioFoerderer.py | 46 +++++++++++++++++++++++++---------
lib/plant2dxf.py | 4 ++-
2 files changed, 37 insertions(+), 13 deletions(-)
diff --git a/lib/Elemente/VarioFoerderer.py b/lib/Elemente/VarioFoerderer.py
index c0c0271..6e03c90 100644
--- a/lib/Elemente/VarioFoerderer.py
+++ b/lib/Elemente/VarioFoerderer.py
@@ -65,7 +65,7 @@ class VarioFoerderer(BaseModel):
winkel_VP_offset_hinten = None
if (gefaellestrecke_vario.get("Winkel") != None or gefaellestrecke_vario.get("Kurvenrichtung") != None) and ((winkel == 3 and voerder_richtung == "Ab")or voerder_richtung == "Horizontal"):
# Überprüfung wo es verbunden ist und mit welchen fördere vorne ist ende der Fahrrichtung
- if gefaellestrecke_vario.get("h0") != None:
+ if gefaellestrecke_vario.get("h0") != None :
if float(gefaellestrecke_vario.get("h0")) == lower_hoehe_vario:
if (gefaellestrecke_vario.get("Foerderrichtung") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung") == "Horizontal"):
# Nehmen des winkels und diesen plus 3 nehmen, um den Bogen zu imporieren für heraufinden der Delta werte
@@ -73,8 +73,8 @@ class VarioFoerderer(BaseModel):
winkel_vorne = int(gefaellestrecke_vario.get("Winkel"))
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
- SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_1"]))
- VP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_1"]))
+ SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
+ VP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_0"]))
# Ausrechnen des Offsets
winkel_VP_offset_hinten = (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.cos(math.radians(3)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.sin(math.radians(3)), VP_1_nachbar_vorne[1],- (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.sin(math.radians(3)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.cos(math.radians(3))
@@ -90,7 +90,7 @@ class VarioFoerderer(BaseModel):
# Ausrechnung des Offsets
winkel_VP_offset_hinten = (SP_0_nachbar_vorne[0] - VP_0_nachbar_vorne[0]) * math.cos(math.radians(3)) + (SP_0_nachbar_vorne[2] - VP_0_nachbar_vorne[2])*math.sin(math.radians(3)), VP_0_nachbar_vorne[1],- (SP_0_nachbar_vorne[0] - VP_0_nachbar_vorne[0]) * math.sin(math.radians(3)) + (SP_0_nachbar_vorne[2] - VP_0_nachbar_vorne[2])*math.cos(math.radians(3))
- elif float(gefaellestrecke_vario.get("h1")) == upper_hoehe_vario:
+ elif float(gefaellestrecke_vario.get("h1")) == upper_hoehe_vario and gefaellestrecke_vario.get("Foerderrichtung") != None:
if (gefaellestrecke_vario.get("Foerderrichtung") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung") == "Horizontal"):
# Nehmen des winkels und diesen plus 3 nehmen, um den Bogen zu imporieren für heraufinden der Delta werte
winkel_hinten_plusbogen = int(gefaellestrecke_vario.get("Winkel")) +3
@@ -103,7 +103,7 @@ class VarioFoerderer(BaseModel):
# Ausrechnung des Offsets
winkel_VP_offset_vorne = (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.cos(math.radians(-winkel_hinten)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.sin(math.radians(-winkel_hinten)), VP_0_nachbar_hinten[1],- (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.sin(math.radians(-winkel_hinten)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.cos(math.radians(-winkel_hinten))
- else:
+ elif gefaellestrecke_vario.get("Foerderrichtung") == "Ab":
# Nehmen des winkels und diesen minus 3 nehmen, um den Bogen zu imporieren für heraufinden der Delta werte
winkel_hinten_minusbogen = int(gefaellestrecke_vario.get("Winkel")) -3
winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
@@ -114,9 +114,20 @@ class VarioFoerderer(BaseModel):
VP_1_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
# Ausrechnung des Offsets
winkel_VP_offset_vorne = (SP_1_nachbar_hinten[0] - VP_1_nachbar_hinten[0]) * math.cos(math.radians(winkel_hinten)) + (SP_1_nachbar_hinten[2] - VP_1_nachbar_hinten[2])*math.sin(math.radians(winkel_hinten)), VP_1_nachbar_hinten[1],- (SP_1_nachbar_hinten[0] - VP_1_nachbar_hinten[0]) * math.sin(math.radians(winkel_hinten)) + (SP_1_nachbar_hinten[2] - VP_1_nachbar_hinten[2])*math.cos(math.radians(winkel_hinten))
-
- # Das gleiche falls der 3 grad Förderer mit zwei Förderer Verbunden ist
- if (gefaellestrecke_vario.get("Winkel_2") != None or gefaellestrecke_vario.get("Kurvenrichtung_2") != None) and ((winkel == 3 and voerder_richtung == "Ab")or voerder_richtung == "Horizontal"):
+ else:
+ blockname = (f"Vario_Kurve_{gefaellestrecke_vario.get("Kurvenrichtung")}_{gefaellestrecke_vario.get("Kurvenwinkel")}°_TEF_{gefaellestrecke_vario.get("Tefkurve")}")
+ att_kurve = plant2dxf.import_block(blockname,lib_doc,doc)
+ SP_0_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_SP_0"]))
+ VP_0_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_VP_0"]))
+ SP_1_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_SP_1"]))
+ VP_1_nachbar= list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_VP_1"]))
+ if float(gefaellestrecke_vario.get("vario_hoehe_1")) == lower_hoehe_vario:
+ winkel_VP_offset_hinten = (SP_1_nachbar[0] -VP_1_nachbar[0] ),0,( SP_1_nachbar[2]- VP_1_nachbar[2])
+ else:
+ winkel_VP_offset_vorne = (SP_0_nachbar[0] -VP_0_nachbar[0] ),0,(SP_0_nachbar[2] - VP_0_nachbar[2] )
+
+ # Das gleiche falls der 3 grad Förderer mit zwei Förderer Verbunden ist
+ if (gefaellestrecke_vario.get("Winkel_2") != None or gefaellestrecke_vario.get("Kurvenrichtung_1") != None) and ((winkel == 3 and voerder_richtung == "Ab")or voerder_richtung == "Horizontal"):
# Überprüfung wo es verbunden ist und mit welchen fördere vorne ist ende der Fahrrichtung
if gefaellestrecke_vario.get("h0_2") != None:
if float(gefaellestrecke_vario.get("h0_2")) == lower_hoehe_vario:
@@ -126,8 +137,8 @@ class VarioFoerderer(BaseModel):
winkel_vorne = int(gefaellestrecke_vario.get("Winkel_2"))
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
- SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_1"]))
- VP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_1"]))
+ SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
+ VP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_0"]))
# Ausrechnen des Offsets
winkel_VP_offset_hinten = (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.cos(math.radians(3)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.sin(math.radians(3)), VP_1_nachbar_vorne[1],- (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.sin(math.radians(3)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.cos(math.radians(3))
@@ -156,7 +167,7 @@ class VarioFoerderer(BaseModel):
# Ausrechnung des Offsets
winkel_VP_offset_vorne = (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.cos(math.radians(-winkel_hinten)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.sin(math.radians(-winkel_hinten)), VP_0_nachbar_hinten[1],- (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.sin(math.radians(-winkel_hinten)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.cos(math.radians(-winkel_hinten))
- else:
+ elif gefaellestrecke_vario.get("Foerderrichtung") == "Ab":
# Nehmen des winkels und diesen minus 3 nehmen, um den Bogen zu imporieren für heraufinden der Delta werte
winkel_hinten_minusbogen = int(gefaellestrecke_vario.get("Winkel_2")) -3
winkel_hinten = int(gefaellestrecke_vario.get("Winkel_2"))
@@ -167,7 +178,18 @@ class VarioFoerderer(BaseModel):
VP_1_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
# Ausrechnung des Offsets
winkel_VP_offset_vorne = (SP_1_nachbar_hinten[0] - VP_1_nachbar_hinten[0]) * math.cos(math.radians(winkel_hinten)) + (SP_1_nachbar_hinten[2] - VP_1_nachbar_hinten[2])*math.sin(math.radians(winkel_hinten)), VP_1_nachbar_hinten[1],- (SP_1_nachbar_hinten[0] - VP_1_nachbar_hinten[0]) * math.sin(math.radians(winkel_hinten)) + (SP_1_nachbar_hinten[2] - VP_1_nachbar_hinten[2])*math.cos(math.radians(winkel_hinten))
-
+ else:
+ blockname = (f"Vario_Kurve_{gefaellestrecke_vario.get("Kurvenrichtung_1")}_{gefaellestrecke_vario.get("Kurvenwinkel_1")}°_TEF_{gefaellestrecke_vario.get("Tefkurve_1")}")
+ att_kurve = plant2dxf.import_block(blockname,lib_doc,doc)
+ SP_0_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_SP_0"]))
+ VP_0_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_VP_0"]))
+ SP_1_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_SP_1"]))
+ VP_1_nachbar= list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_VP_1"]))
+ if float(gefaellestrecke_vario.get("vario_hoehe_1_1")) == lower_hoehe_vario:
+ winkel_VP_offset_hinten = (SP_1_nachbar[0] -VP_1_nachbar[0] ),0,( SP_1_nachbar[2]- VP_1_nachbar[2])
+ else:
+ winkel_VP_offset_vorne = (SP_0_nachbar[0] -VP_0_nachbar[0] ),0,(SP_0_nachbar[2] - VP_0_nachbar[2] )
+
return winkel_VP_offset_vorne,winkel_VP_offset_hinten
def vario_erstellung(foerderer, doc, lib_doc, config, block, block_name_links, start, ende, voerder_richtung, winkel_VP_offset_vorne, winkel_VP_offset_hinten ):
# Entnehmen der Motor und Umlenk station um die Gefähle auzurechnen und ob man diese tatsächlich einfügen muss
diff --git a/lib/plant2dxf.py b/lib/plant2dxf.py
index 2c51110..4a906ec 100644
--- a/lib/plant2dxf.py
+++ b/lib/plant2dxf.py
@@ -1286,7 +1286,7 @@ def get_nachbar_information(csv_path:Path) -> dict:
kurvenrichtung = kurve_angetrieben.kurvenrichtung
tefkurve = kurve_angetrieben.antrieb
kurve_winkel = kurve_angetrieben.winkel
- angetriebene_kurve.append({"Id": Id,"H0": h0,"H1":h1,"kurvenrichtung":kurvenrichtung,"Tefkurve": tefkurve,"Kurve_winkel": kurve_winkel})
+ angetriebene_kurve.append({"Id": Id,"H0": h0,"H1":h1,"kurvenrichtung":kurvenrichtung,"Tefkurve": tefkurve,"Kurvenwinkel": kurve_winkel})
for gerade in geraden:
anweisungen = 0
voerder_anweisung = 0
@@ -1299,12 +1299,14 @@ def get_nachbar_information(csv_path:Path) -> dict:
eintrag["vario_hoehe_1"] = foerderer.get("H1")
eintrag["Kurvenrichtung"] = foerderer.get("kurvenrichtung")
eintrag["Tefkurve"] = foerderer.get("Tefkurve")
+ eintrag["Kurvenwinkel"] = foerderer.get("Kurvenwinkel")
voerder_anweisung = 1
elif voerder_anweisung ==1:
eintrag["vario_hoehe_0_1"] = foerderer.get("H0")
eintrag["vario_hoehe_1_1"] = foerderer.get("H1")
eintrag["Kurvenrichtung_1"] = foerderer.get("kurvenrichtung")
eintrag["Tefkurve_1"] = foerderer.get("Tefkurve")
+ eintrag["Kurvenwinkel_1"] = foerderer.get("Kurvenwinkel")
for kreis in kreisel:
if kreis["Id"] in gerade["NachbarIds"]: