From aa711c49d3a3f2df8c6efd5e0fa3bacaf0e6a2f5 Mon Sep 17 00:00:00 2001
From: Paul Wolok
Date: Thu, 6 Nov 2025 10:50:22 +0100
Subject: [PATCH] Offset von 3 grad ab bogen minimiert wenn es mit was anderem
Vorderer verbundem ist
---
lib/plant2dxf.py | 621 ++++++++++++++++++++++++++++++++++++++---------
1 file changed, 507 insertions(+), 114 deletions(-)
diff --git a/lib/plant2dxf.py b/lib/plant2dxf.py
index 983a104..afa6efb 100644
--- a/lib/plant2dxf.py
+++ b/lib/plant2dxf.py
@@ -90,12 +90,23 @@ def import_block(block_name: str, from_doc, to_doc, winkel = None) -> None:
- Stellt sicher, dass benutzte Layer im Ziel existieren (mit Eigenschaften)
- Übernimmt Basispunkt und Block-Layer, falls vorhanden
"""
-
+ src = from_doc.blocks[block_name]
+ att_def = {}
if ((block_name in to_doc.blocks)):
- return
+ for ent in src:
+ copy = ent.copy()
+
+ if ent.dxftype() == "ATTDEF":
+ att_def[ent.dxf.tag] =ent.dxf.text
+ if ent.dxftype() == "INSERT":
+
+ import_block(ent.dxf.name,from_doc, to_doc,None)
+
+ if att_def != []:
+ return att_def
+ return
if block_name not in from_doc.blocks:
raise ValueError(f"Block '{block_name}' nicht in Bibliothek gefunden.")
- src = from_doc.blocks[block_name]
# Sicherstellen, dass alle verwendeten Layer existieren
try:
@@ -127,12 +138,10 @@ def import_block(block_name: str, from_doc, to_doc, winkel = None) -> None:
except Exception:
pass
- att_def = {}
+
for ent in src:
copy = ent.copy()
- if ent.dxftype() == "ATTDEF":
- if ent.dxf.tag == "DELTA_SP_0":
- test = 3
+
if ent.dxftype() == "ATTDEF":
att_def[ent.dxf.tag] =ent.dxf.text
if ent.dxftype() == "INSERT":
@@ -319,6 +328,11 @@ def handle_standard(msp, blocknames, teileid, x, y, lib_doc, doc, verbose):
f"({x:.1f}, {y:.1f})")
+def handle_ils_2_0_eckrad(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config):
+ import_block("AN8",lib_doc,doc)
+ hight = float(merkmale.get("Höhe in m"))* 1000
+ msp.add_blockref("AN8",(x,y,hight))
+
def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config):
#Vorbereitung der attributen
@@ -387,15 +401,17 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{drehung0}_{hoehe_gefaehlle}_{verbunden_am_einen}_{hight}"
- erstellung_gefaelle_block_verbunenden_am_einen(x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle, drehung0, laenge, blockname,hight)
- blockref_layer = get_layer(doc, lib_doc, blockname)
- bref =msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation, "layer": blockref_layer})
- a =bref.add_attrib(
- tag= "NAME",
- text= merkmale.get("bezeichner"),
- insert = (x,y)
- )
- a.is_invisible = True
+ only_es_or_as = erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle, drehung0, laenge, blockname,hight)
+
+ if only_es_or_as == False:
+ blockref_layer = get_layer(doc, lib_doc, blockname)
+ bref =msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation, "layer": blockref_layer})
+ a =bref.add_attrib(
+ tag= "NAME",
+ text= merkmale.get("bezeichner"),
+ insert = (x,y)
+ )
+ a.is_invisible = True
@@ -590,20 +606,41 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
-
+def add_attributes_to_block(block, attributes):
+ """
+ Fügt einem bestehenden ezdxf-Block Attribut-Definitionen hinzu.
+
+ Parameter:
+ block – ein ezdxf.blocks.BlockLayout Objekt
+ attributes – Liste von Tupeln [(tag, value), ...]
+ """
+ for tag, value in attributes.items():
+ test = 3
+ tag = tag
+ value = value
+ a =block.add_attrib(
+ tag=tag,
+ text=value,
+ )
+ a.is_invisible = True
+
def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config):
-
+
+ winkel_VP_offset_vorne = None
+ winkel_VP_offset_hinten = None
# erstellung des Layers falls nicht vorhanden
if "VARIO" not in doc.layers:
doc.layers.add(name="VARIO", color=3)
+
+ if "6-SP" not in doc.layers:
+ doc.layers.add(name="6-SP", color=7)
# Vorbereitung der Werte
voerder_richtung = merkmale.get("Förderrichtung")
winkel = int(merkmale.get("Winkel"))
- verbunden_am_einen = False
+
erster_kreisel_höher = False
ein_kreisel_höher = False
richtung2 ="DEFAULT"
- unterschiedlich = False
asoffset = float(config.get("ILS 2.0 Gefällestrecke", "asoffset"))
esoffset = float(config.get("ILS 2.0 Gefällestrecke", "esoffset"))
rotation = float(merkmale.get("Drehung"))
@@ -618,6 +655,9 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
lower_hoehe_vario = hight
# Korrektur der rotation mit der Umstellung der Höhe
rotation = rotation -180
+
+
+
hoehe_vario= (upper_hoehe_vario + lower_hoehe_vario)/2
# Hollen der Information der Nachbarn strukturen ob diese Kreisel sind
for nachbarn in strecken_nachbarn:
@@ -625,6 +665,100 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
gefaellestrecke_vario = nachbarn
break
laenge = float(merkmale.get("Länge in Meter")) *1000
+
+ if gefaellestrecke_vario.get("Winkel") != None and winkel == 3 and voerder_richtung == "Ab":
+ if float(gefaellestrecke_vario.get("h0")) == lower_hoehe_vario:
+ if (gefaellestrecke_vario.get("Foerderrichtung") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung") == "Horizontal"):
+ winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel")) +3
+ winkel_vorne = int(gefaellestrecke_vario.get("Winkel"))
+
+ blockname = (f"Vario_Bogen_ab_{winkel_vorne_plusbogen}°")
+ att_vorne =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"]))
+ winkel_VP_offset_vorne = (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.cos(math.radians(-winkel_vorne)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.sin(math.radians(-winkel_vorne)), VP_1_nachbar_vorne[1],- (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.sin(math.radians(-winkel_vorne)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.cos(math.radians(-winkel_vorne))
+
+ else:
+ winkel_vorne_minusbogen = int(gefaellestrecke_vario.get("Winkel")) -3
+ winkel_vorne = int(gefaellestrecke_vario.get("Winkel"))
+
+ blockname = (f"Vario_Bogen_ab_{winkel_vorne_minusbogen}°")
+ att_vorne =import_block(blockname,lib_doc,doc)
+ SP_0_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
+ VP_0_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_0"]))
+ winkel_VP_offset_vorne = (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:
+ if (gefaellestrecke_vario.get("Foerderrichtung") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung") == "Horizontal"):
+ winkel_hinten_plusbogen = int(gefaellestrecke_vario.get("Winkel")) +3
+ winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
+
+ blockname = (f"Vario_Bogen_auf_{winkel_hinten_plusbogen}°")
+ att_hinten =import_block(blockname,lib_doc,doc)
+ SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_0"]))
+ VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_0"]))
+ winkel_VP_offset_hinten = (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.cos(math.radians(3)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.sin(math.radians(3)), VP_0_nachbar_hinten[1],- (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.sin(math.radians(3)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.cos(math.radians(3))
+
+ else:
+ winkel_hinten_minusbogen = int(gefaellestrecke_vario.get("Winkel")) -3
+ winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
+
+ blockname = (f"Vario_Bogen_auf_{winkel_hinten_minusbogen}°")
+ att_hinten =import_block(blockname,lib_doc,doc)
+ SP_1_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_1"]))
+ VP_1_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
+ winkel_VP_offset_hinten = (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))
+
+
+
+ if (gefaellestrecke_vario.get("Winkel_2") != None):
+ if float(gefaellestrecke_vario.get("h0_2")) == lower_hoehe_vario:
+ if (gefaellestrecke_vario.get("Foerderrichtung_2") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung_2") == "Horizontal"):
+ winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel_2")) +3
+ winkel_vorne = int(gefaellestrecke_vario.get("Winkel_2"))
+
+ blockname = (f"Vario_Bogen_ab_{winkel_vorne_plusbogen}°")
+ att_vorne =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"]))
+ winkel_VP_offset_vorne = (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.cos(math.radians(-winkel_vorne)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.sin(math.radians(-winkel_vorne)), VP_1_nachbar_vorne[1],- (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.sin(math.radians(-winkel_vorne)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.cos(math.radians(-winkel_vorne))
+
+ else:
+ winkel_vorne_minusbogen = int(gefaellestrecke_vario.get("Winkel_2")) -3
+ winkel_vorne = int(gefaellestrecke_vario.get("Winkel_2"))
+
+ blockname = (f"Vario_Bogen_ab_{winkel_vorne_minusbogen}°")
+ att_vorne =import_block(blockname,lib_doc,doc)
+ SP_0_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
+ VP_0_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_0"]))
+ winkel_VP_offset_vorne = (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_2")) == upper_hoehe_vario:
+ if (gefaellestrecke_vario.get("Foerderrichtung_2") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung_2") == "Horizontal"):
+ winkel_hinten_plusbogen = int(gefaellestrecke_vario.get("Winkel_2")) +3
+
+
+ blockname = (f"Vario_Bogen_auf_{winkel_hinten_plusbogen}°")
+ att_hinten =import_block(blockname,lib_doc,doc)
+ SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_0"]))
+ VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_0"]))
+ winkel_VP_offset_hinten = (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.cos(math.radians(3)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.sin(math.radians(3)), VP_0_nachbar_hinten[1],- (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.sin(math.radians(3)) + (SP_0_nachbar_hinten[2] - VP_1_nachbar_hinten[2])*math.cos(math.radians(3))
+
+ else:
+ winkel_hinten_minusbogen = int(gefaellestrecke_vario.get("Winkel")) -3
+ winkel_hinten = int(gefaellestrecke_vario.get("Winkel_2"))
+
+
+
+ blockname = (f"Vario_Bogen_auf_{winkel_hinten_minusbogen}°")
+ att_hinten =import_block(blockname,lib_doc,doc)
+ SP_1_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_1"]))
+ VP_1_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
+ winkel_VP_offset_hinten = ((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_vorne[0]) * math.sin(math.radians(winkel_hinten)) + (SP_1_nachbar_hinten[2] - VP_1_nachbar_hinten[2])*math.cos(math.radians(winkel_hinten))
+
+
# Für spätere berechnung schauen ob der erste Kreis in der Liste höher ist
if upper_hoehe_vario == gefaellestrecke_vario.get("Hoehe0"):
ein_kreisel_höher = True
@@ -679,6 +813,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
line = Line.new(dxfattribs={"start": l,"end":m })
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block_vario.add_entity(copy)
@@ -696,11 +831,12 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario )
ende = m
line = Line.new(dxfattribs={"start": l,"end":m })
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block_vario.add_entity(copy)
# Erstellung des Vario_förderes selber
- vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung )
+ vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
# reintuen des förderes in den Modelspace
if merkmale.get("Motorseite")== "links":
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
@@ -726,9 +862,9 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
dy_true = halbe_laenge * math.cos (0)
# Schauen welches as oder es element man wo verbinden muss und bereits in den block tuen, der None wert ist ein Wert der für die Gefällestrecke notwendig ist
# Entnehmen von start und end Werte für spätere vario erstellung
- start, ende =erstellung_gefaelle_block_verbunenden_am_einen(x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario, drehung0, laenge, blockname,None ,block_vario, voerder_richtung, ein_kreisel_höher)
+ start, ende =erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario, drehung0, laenge, blockname,None ,block_vario, voerder_richtung, ein_kreisel_höher)
# Erstellung des Varios selber
- vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung )
+ vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
# reintuen des förderes in den Modelspace
if merkmale.get("Motorseite")== "links":
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
@@ -800,6 +936,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
line = Line.new(dxfattribs={"start": l,"end":m })
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block_vario.add_entity(copy)
@@ -816,11 +953,12 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario )
ende = m
line = Line.new(dxfattribs={"start": l,"end":m })
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block_vario.add_entity(copy)
# Die Vario erstellung selber
- vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung )
+ vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
# reintuen des förderes in den Modelspace
if merkmale.get("Motorseite")== "links":
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
@@ -868,6 +1006,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
line = Line.new(dxfattribs={"start": l,"end":m })
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block_vario.add_entity(copy)
@@ -888,6 +1027,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
z1 = m[2]
line = Line.new(dxfattribs={"start": l,"end":m })
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block_vario.add_entity(copy)
@@ -897,7 +1037,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
# Entnehmen von start und end Werte für spätere vario erstellung
start, ende =gefaellegerade_erstellung(x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario,richtung2, drehung0, drehung1, laenge, None, blockname,block_vario,voerder_richtung, am_kreisel,erster_kreisel_höher,y1,z1)
# Erstellung der Vario gefälle selber
- vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung )
+ vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
# Reintuen des endblockes in den Modelspace
if merkmale.get("Motorseite")== "links":
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
@@ -927,7 +1067,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
# Entnehmen von start und end Werte für spätere vario erstellung
start, ende =gefaellegerade_erstellung(x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario,richtung2, drehung0, drehung1, laenge, None, blockname,block_vario,voerder_richtung)
# Erstellung des Vario selber
- vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung )
+ vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung,winkel_VP_offset_vorne,winkel_VP_offset_hinten )
# Reintuen des endblockes in den Modelspace
if merkmale.get("Motorseite")== "links":
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
@@ -961,36 +1101,88 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
# Erstellung des Förderes selber
- vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block,block_name_links, start, ende,voerder_richtung )
+ vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
# Reintuen des endblockes in den Modelspace
if merkmale.get("Motorseite")== "links":
- insert = msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
+ msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
if merkmale.get("Motorseite")== "rechts":
- insert =msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
- attrib_values = {}
+ msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
+
-def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block,block_name_links, start, ende,voerder_richtung ):
+def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block,block_name_links, start, ende,voerder_richtung,winkel_VP_offset_vorne,winkel_VP_offset_hinten ):
+ motor_vorhanden = merkmale.get("Motor")
+ umlenk_vorhanden = merkmale.get("Umlenk")
# Falls auf der Vario Förderer auf ist
+ umlenk_motor_offset = tuple(float(x) for x in(config.get("ILS 2.0 Variofoerderer","Umlenkstation")).split(","))
+ # gefahellewinkel =float(merkmale.get("Gefahellewinkel"))
+
+ # gefaelle = float(merkmale.get("Gefällestrecke"))
+ # if motor_vorhanden == "True":
+ # gefaelle = gefaelle - umlenk_motor_offset[0]
+ # if umlenk_vorhanden == "True":
+ # gefaelle = gefaelle - umlenk_motor_offset[0]
+
+
+
+
if voerder_richtung== "Auf" or voerder_richtung== "Horizontal":
-
+
+ # if gefaelle > 0:
+ # halbesgefaelle = gefaelle/2
+ # if motor_vorhanden == "True" and umlenk_vorhanden == "True":
+ # halbesgefaelle = gefaelle/2
+ # gefaelle_ende = ende[0], ende[1] +halbesgefaelle, ende[2] -math.sin(math.radians(gefahellewinkel))* halbesgefaelle
+ # line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
+ # line_ende_gefaelle.dxf.layer = "6-SP"
+ # copy_ende = line_ende_gefaelle.copy()
+ # copy_ende.translate(-x,-y,-hoehe_vario)
+ # block.add_entity(copy_ende)
+ # ende = gefaelle_ende
+
+ # gefaelle_start = start[0], start[1] -halbesgefaelle, start[2] +math.sin(math.radians(gefahellewinkel)) * halbesgefaelle
+ # line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
+ # line_start_gefaelle.dxf.layer = "6-SP"
+ # copy_start = line_start_gefaelle.copy()
+ # copy_start.translate(-x,-y,-hoehe_vario)
+ # block.add_entity(copy_start)
+ # start = gefaelle_start
+
+ # elif motor_vorhanden== "True":
+ # gefaelle_start = start[0], start[1] -gefaelle, start[2] +math.sin(math.radians(gefahellewinkel)) * gefaelle
+ # line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
+ # line_start_gefaelle.dxf.layer = "6-SP"
+ # copy_start = line_start_gefaelle.copy()
+ # copy_start.translate(-x,-y,-hoehe_vario)
+ # block.add_entity(copy_start)
+ # start = gefaelle_start
+
+ # elif umlenk_vorhanden== "True":
+ # gefaelle_ende = ende[0], ende[1] +gefaelle, ende[2] -math.sin(math.radians(gefahellewinkel))* gefaelle
+ # line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
+ # line_ende_gefaelle.dxf.layer = "6-SP"
+ # copy_ende = line_ende_gefaelle.copy()
+ # copy_ende.translate(-x,-y,-hoehe_vario)
+ # block.add_entity(copy_ende)
+ # ende = gefaelle_ende
+
# Den Motorstaton und Umlenkstation auf die richtige position in block einfügen
- umlenk_motor_offset = tuple(float(x) for x in(config.get("ILS 2.0 Variofoerderer","Umlenkstation")).split(","))
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
import_block(block_Vario_Motorstation_500mm, lib_doc, doc)
- import_block(block_Vario_Umlenkstation_500mm , lib_doc, doc,math.radians(3))
+ import_block(block_Vario_Umlenkstation_500mm , lib_doc, doc)
block_Vario_Motorstation_500mm = dreh_block(block_Vario_Motorstation_500mm,doc,math.radians(3))
block_Vario_Umlenkstation_500mm = dreh_block( block_Vario_Umlenkstation_500mm, doc,math.radians(3))
-
-
- block.add_blockref(block_Vario_Umlenkstation_500mm,(ende[0] -x,ende[1] -y + umlenk_motor_offset[0]/2,ende[2] - hoehe_vario -umlenk_motor_offset[2]/2 ),dxfattribs={"rotation": 90})
- ende = (ende[0] ,ende[1] + umlenk_motor_offset[0],ende[2] -umlenk_motor_offset[2])
- block.add_blockref(block_Vario_Motorstation_500mm, (start[0]-x , start[1] - umlenk_motor_offset[0]/2 -y ,start[2] - hoehe_vario +umlenk_motor_offset[2]/2),dxfattribs={"rotation": 90})
- start = start[0] , start[1] - umlenk_motor_offset[0],start[2] +umlenk_motor_offset[2]
+ if umlenk_vorhanden == "True":
+ block.add_blockref(block_Vario_Umlenkstation_500mm,(ende[0] -x,ende[1] -y + umlenk_motor_offset[0]/2,ende[2] - hoehe_vario -umlenk_motor_offset[2]/2 ),dxfattribs={"rotation": 90})
+ ende = (ende[0] ,ende[1] + umlenk_motor_offset[0],ende[2] -umlenk_motor_offset[2])
+ if motor_vorhanden == "True":
+ block.add_blockref(block_Vario_Motorstation_500mm, (start[0]-x , start[1] - umlenk_motor_offset[0]/2 -y ,start[2] - hoehe_vario +umlenk_motor_offset[2]/2),dxfattribs={"rotation": 90})
+ start = start[0] , start[1] - umlenk_motor_offset[0],start[2] +umlenk_motor_offset[2]
+
if winkel == 48:
# Einfügen der 51 Bogen und deren notwendigen Werten von dem config nehmen
block_Vario_Bogen_auf_51 = "Vario_Bogen_auf_51°"
@@ -1079,14 +1271,16 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
block.add_entity(copy_VP)
# Erstellung der zwischen Line
line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
- # msp.add_blockref(block_Vario_Bogen_auf_51,(x,y,0))
- # msp.add_line((x+1000,y,0),(x-1000,y,0))
+ # a = msp.add_blockref(block_Vario_Bogen_ab_51,(x,y,0))
+ # msp.add_line((x+1000,y + 50,0),(x-1000,y +50,0))
# msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, ab_51_attrib)
@@ -1181,14 +1375,17 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
block.add_entity(copy_VP)
# Erstellung der zwischen Line
line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
- # msp.add_blockref(block_Vario_Bogen_ab_39,(x,y,0))
- # msp.add_line((x+267.49,y-66.5,0),(x-267.49,y-66.5,0))
+ # a = msp.add_blockref(block_Vario_Bogen_ab_39,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
# msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, ab_39_attrib)
+
elif winkel == 24:
@@ -1283,14 +1480,16 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
# Erstellung der zwischen Line
line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
- # msp.add_blockref(block_Vario_Bogen_ab_27,(x,y,0))
- # msp.add_line((x+1000,y,0),(x-1000,y,0))
+ # a = msp.add_blockref(block_Vario_Bogen_ab_27,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
# msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, ab_27_attrib)
@@ -1385,11 +1584,16 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
# Erstellung der zwischen Line
line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
+ # a = msp.add_blockref(block_Vario_Bogen_ab_18,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
+ # msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, ab_18_attrib)
@@ -1477,11 +1681,17 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
copy_VP.translate(-x,-y,-hoehe_vario)
block.add_entity(copy_VP)
line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
+ # a = msp.add_blockref(block_Vario_Bogen_auf_15,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
+ # msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, auf_15_attrib)
+
@@ -1574,24 +1784,114 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
block.add_entity(copy_VP)
line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
- # msp.add_blockref(block_Vario_Bogen_auf_12,(x,y,0))
- # msp.add_line((x+1000,y,0),(x-1000,y,0))
+ # a = msp.add_blockref(block_Vario_Bogen_ab_12,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
# msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, ab_12_attrib)
+
elif winkel == 3:
+ block_Vario_ab_6 = "Vario_Bogen_ab_6°"
+ block_Vario_auf_6 = "Vario_Bogen_auf_6°"
+ ab_6_attrib =import_block( block_Vario_ab_6 , lib_doc, doc)
+ auf_6_attrib =import_block( block_Vario_auf_6 , lib_doc, doc)
+ block_Vario_ab_6 = dreh_block( block_Vario_ab_6, doc, math.radians(3))
+ block_Vario_auf_6 = dreh_block( block_Vario_auf_6 , doc, math.radians(-3))
+ Vario_Bogen_auf_6_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_6_attrib["DELTA_SP_0"]))
+ Vario_Bogen_auf_6_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_6_attrib["DELTA_SP_1"]))
+ Vario_Bogen_ab_6_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_6_attrib["DELTA_SP_0"]))
+ Vario_Bogen_ab_6_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_6_attrib["DELTA_SP_1"]))
+ Vario_Bogen_auf_6_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_6_attrib["DELTA_VP_1"]))
+ Vario_Bogen_ab_6_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_6_attrib["DELTA_VP_0"]))
+
+
+ Vario_Bogen_auf_6_Delta_SP_0 = [Vario_Bogen_auf_6_Delta_SP_0 [0] * math.cos(math.radians(-3))+ Vario_Bogen_auf_6_Delta_SP_0[2]* math.sin(math.radians(-3)) ,Vario_Bogen_auf_6_Delta_SP_0[1],-Vario_Bogen_auf_6_Delta_SP_0[0] * math.sin(math.radians(-3))+ Vario_Bogen_auf_6_Delta_SP_0[2] * math.cos(math.radians(-3)) ]
+ Vario_Bogen_auf_6_Delta_SP_1 = [Vario_Bogen_auf_6_Delta_SP_1 [0] * math.cos(math.radians(-3))+ Vario_Bogen_auf_6_Delta_SP_1[2]* math.sin(math.radians(-3)) ,Vario_Bogen_auf_6_Delta_SP_1[1],-Vario_Bogen_auf_6_Delta_SP_1[0] * math.sin(math.radians(-3))+ Vario_Bogen_auf_6_Delta_SP_1[2] * math.cos(math.radians(-3)) ]
+ Vario_Bogen_ab_6_Delta_SP_0 = [Vario_Bogen_ab_6_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_6_Delta_SP_0[1],-Vario_Bogen_ab_6_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_0[2] * math.cos(math.radians(3)) ]
+ Vario_Bogen_ab_6_Delta_SP_1 =[ Vario_Bogen_ab_6_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_6_Delta_SP_1[1],-Vario_Bogen_ab_6_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_1[2] * math.cos(math.radians(3)) ]
+ Vario_Bogen_auf_6_Delta_VP_1 = [Vario_Bogen_auf_6_Delta_VP_1 [0] * math.cos(math.radians(-3))+ Vario_Bogen_auf_6_Delta_VP_1[2]* math.sin(math.radians(-3)) ,Vario_Bogen_auf_6_Delta_VP_1[1],-Vario_Bogen_auf_6_Delta_VP_1[0] * math.sin(math.radians(-3))+ Vario_Bogen_auf_6_Delta_VP_1[2] * math.cos(math.radians(-3)) ]
+ Vario_Bogen_ab_6_Delta_VP_0 = [Vario_Bogen_ab_6_Delta_VP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_6_Delta_VP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_6_Delta_VP_0[1],-Vario_Bogen_ab_6_Delta_VP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_6_Delta_VP_0[2] * math.cos(math.radians(3)) ]
+
+ i = 0
+
+ for negativ in Vario_Bogen_auf_6_Delta_SP_0:
+ if i< 2:
+ if negativ< 0:
+ negativ = negativ*-1
+ Vario_Bogen_auf_6_Delta_SP_0[i] = negativ
+ i = i + 1
+
+ i = 0
+ for negativ in Vario_Bogen_auf_6_Delta_SP_1:
+ if i< 2:
+ if negativ< 0:
+ negativ= negativ*-1
+ Vario_Bogen_auf_6_Delta_SP_1[i] = negativ
+ i = i + 1
+ i = 0
+ for negativ in Vario_Bogen_ab_6_Delta_SP_0:
+ if i< 2:
+ if negativ< 0:
+ negativ = negativ*-1
+ Vario_Bogen_ab_6_Delta_SP_0[i] = negativ
+ i = i + 1
+ i = 0
+ for negativ in Vario_Bogen_ab_6_Delta_SP_1:
+ if i< 2:
+ if negativ < 0:
+ negativ = negativ*-1
+ Vario_Bogen_ab_6_Delta_SP_1[i] = negativ
+ i = i + 1
+ i = 0
+ for negativ in Vario_Bogen_auf_6_Delta_VP_1:
+ if i<2:
+ if negativ < 0:
+ negativ = negativ*-1
+ Vario_Bogen_auf_6_Delta_VP_1[i] = negativ
+ i = i + 1
+ i = 0
+ for negativ in Vario_Bogen_ab_6_Delta_VP_0:
+ if i <2:
+ if negativ < 0:
+ negativ = negativ*-1
+
+ Vario_Bogen_ab_6_Delta_VP_0[i] = negativ
+ i = i + 1
+ block.add_blockref(block_Vario_auf_6,(ende[0] -x ,ende[1] +Vario_Bogen_auf_6_Delta_SP_0[0] -y ,ende[2] - Vario_Bogen_auf_6_Delta_SP_0[2]- hoehe_vario ),dxfattribs={"rotation": 90})
+
+ ende_VP = (ende[0] +Vario_Bogen_auf_6_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_6_Delta_VP_1[0]+Vario_Bogen_auf_6_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_6_Delta_VP_1[2]- Vario_Bogen_auf_6_Delta_SP_0[2])
+ ende = (ende[0] ,ende[1] +Vario_Bogen_auf_6_Delta_SP_1[0] + Vario_Bogen_auf_6_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_6_Delta_SP_1[2] - Vario_Bogen_auf_6_Delta_SP_0[2])
+
+ block.add_blockref(block_Vario_ab_6 ,(start[0]-x,start[1] - Vario_Bogen_ab_6_Delta_SP_1[0] -y ,start[2] - hoehe_vario-Vario_Bogen_ab_6_Delta_SP_1[2]),dxfattribs={"rotation": 90})
+
+ start_VP = start[0] +Vario_Bogen_ab_6_Delta_VP_0[1],start[1]-Vario_Bogen_ab_6_Delta_VP_0[0] - Vario_Bogen_ab_6_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_6_Delta_VP_0[2] - Vario_Bogen_ab_6_Delta_SP_1[2]
+ start = start[0] ,start[1] - Vario_Bogen_ab_6_Delta_SP_0[0] - Vario_Bogen_ab_6_Delta_SP_1[0],start[2] +Vario_Bogen_ab_6_Delta_SP_0[2] - Vario_Bogen_ab_6_Delta_SP_1[2]
+ line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
+ line_VP.dxf.layer = "VARIO"
+ copy_VP = line_VP.copy()
+
+ copy_VP.translate(-x,-y,-hoehe_vario)
+ block.add_entity(copy_VP)
+
line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
+ # a = msp.add_blockref(block_Vario_ab_6,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
+ # msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, ab_6_attrib)
elif winkel == 0:
block_Vario_Bogen_auf_3 = "Vario_Bogen_auf_3°"
block_Vario_Bogen_ab_3 = "Vario_Bogen_ab_3°"
@@ -1683,25 +1983,56 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
# Erstellung der zwischen Line
line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
+ # a = msp.add_blockref(block_Vario_Bogen_ab_3,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
+ # msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, ab_3_attrib)
elif voerder_richtung == "Ab":
- umlenk_motor_offset = tuple(float(x) for x in(config.get("ILS 2.0 Variofoerderer","Umlenkstation")).split(","))
+ # if gefaelle > 0:
+ # halbesgefaelle = gefaelle/2
+ # gefaelle_ende = ende[0], ende[1] +halbesgefaelle, ende[2] +math.sin(math.radians(gefahellewinkel))* halbesgefaelle
+ # line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
+ # line_ende_gefaelle.dxf.layer = "6-SP"
+ # copy_ende = line_ende_gefaelle.copy()
+ # copy_ende.translate(-x,-y,-hoehe_vario)
+ # block.add_entity(copy_ende)
+ # ende = gefaelle_ende
+
+ # gefaelle_start = start[0], start[1] -halbesgefaelle, start[2] -math.sin(math.radians(gefahellewinkel)) * halbesgefaelle
+ # line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
+ # line_start_gefaelle.dxf.layer = "6-SP"
+ # copy_start = line_start_gefaelle.copy()
+ # copy_start.translate(-x,-y,-hoehe_vario)
+ # block.add_entity(copy_start)
+ # start = gefaelle_start
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
import_block( block_Vario_Motorstation_500mm, lib_doc, doc)
import_block( block_Vario_Umlenkstation_500mm , lib_doc, doc)
block_Vario_Motorstation_500mm = dreh_block( block_Vario_Motorstation_500mm, doc,math.radians(3))
block_Vario_Umlenkstation_500mm = dreh_block( block_Vario_Umlenkstation_500mm , doc,math.radians(3))
- block.add_blockref(block_Vario_Umlenkstation_500mm,(start[0] -x,start[1] -y - umlenk_motor_offset[0]/2, start[2] - hoehe_vario -umlenk_motor_offset[2]/2 ),dxfattribs={"rotation": 270})
- start = (start[0] ,start[1] - umlenk_motor_offset[0],start[2] -umlenk_motor_offset[2])
- block.add_blockref(block_Vario_Motorstation_500mm, (ende[0]-x , ende[1] + umlenk_motor_offset[0]/2 -y ,ende[2] - hoehe_vario +umlenk_motor_offset[2]/2),dxfattribs={"rotation": 270})
- ende = ende[0] , ende[1] + umlenk_motor_offset[0],ende[2] +umlenk_motor_offset[2]
+ if umlenk_vorhanden == "True":
+ block.add_blockref(block_Vario_Umlenkstation_500mm,(start[0] -x,start[1] -y - umlenk_motor_offset[0]/2, start[2] - hoehe_vario -umlenk_motor_offset[2]/2 ),dxfattribs={"rotation": 270})
+ start_Umlenkstation_VP = start[0] - 66.5, start[1] -500 *math.cos(math.radians(-3))+ math.sin(math.radians(-3))* -45,start[2] + math.sin(math.radians(-3))*500+ math.cos(math.radians(-3))*-45
+ start = (start[0] ,start[1] - umlenk_motor_offset[0],start[2] -umlenk_motor_offset[2])
+ elif winkel == 3:
+ start_Umlenkstation_VP = start[0] - 66.5, start[1]+ winkel_VP_offset_vorne[0],start[2] -winkel_VP_offset_hinten[2]
+ if motor_vorhanden == "True":
+ block.add_blockref(block_Vario_Motorstation_500mm, (ende[0]-x , ende[1] + umlenk_motor_offset[0]/2 -y ,ende[2] - hoehe_vario +umlenk_motor_offset[2]/2),dxfattribs={"rotation": 270})
+ ende_Motor_VP = ende[0] - 66.5, ende[1] +500 *math.cos(math.radians(-3))+ math.sin(math.radians(-3))* -45,ende[2] - math.sin(math.radians(-3))*500+ math.cos(math.radians(-3))*-45
+
+ ende = ende[0] , ende[1] + umlenk_motor_offset[0],ende[2] +umlenk_motor_offset[2]
+ elif winkel == 3:
+ ende_Motor_VP = ende[0] - 66.5, ende[1]+ winkel_VP_offset_hinten[0] ,ende[2] - winkel_VP_offset_vorne[2]
+
if winkel == 48:
block_Vario_ab_45 = "Vario_Bogen_ab_45°"
block_Vario_auf_45 = "Vario_Bogen_auf_45°"
@@ -1789,13 +2120,15 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
block.add_entity(copy_VP)
line = Line.new(dxfattribs={"start":start,"end":ende })
+ line.dxf.layer = "6-SP"
copy = line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
- msp.add_blockref(block_Vario_ab_45,(x,y,0))
- msp.add_line((x+442.08,y-66.5,0),(x-630.21,y-66.5,0))
- msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # a = msp.add_blockref(block_Vario_ab_45,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
+ # msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, ab_45_attrib)
elif winkel == 36:
block_Vario_ab_33 = "Vario_Bogen_ab_33°"
@@ -1880,13 +2213,14 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
line = Line.new(dxfattribs={"start":start,"end":ende })
+ line.dxf.layer = "6-SP"
copy = line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
- # msp.add_blockref(block_Vario_ab_33,(x,y,0))
- # msp.add_line((x+1000,y,0),(x-630.21,y,0))
+ # a = msp.add_blockref(block_Vario_ab_33,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
# msp.add_line((x,y+1000,0),(x,y-1000,0))
-
+ # add_attributes_to_block(a, ab_33_attrib)
elif winkel == 24:
block_Vario_ab_21 = "Vario_Bogen_ab_21°"
block_Vario_auf_21 = "Vario_Bogen_auf_21°"
@@ -1971,10 +2305,14 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
block.add_entity(copy_VP)
line = Line.new(dxfattribs={"start":start,"end":ende })
+ line.dxf.layer = "6-SP"
copy = line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
- # msp.add_blockref(block_Vario_ab_21,(x,y,0))
+ # a = msp.add_blockref(block_Vario_ab_21,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
+ # msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, ab_21_attrib)
elif winkel == 15:
block_Vario_ab_12 = "Vario_Bogen_ab_12°"
block_Vario_auf_12 = "Vario_Bogen_auf_12°"
@@ -2059,9 +2397,14 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
block.add_entity(copy_VP)
line = Line.new(dxfattribs={"start":start,"end":ende })
+ line.dxf.layer = "6-SP"
copy = line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
+ # a = msp.add_blockref(block_Vario_ab_12,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
+ # msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, ab_12_attrib)
elif winkel == 12:
block_Vario_ab_9 = "Vario_Bogen_ab_9°"
@@ -2145,12 +2488,15 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
copy_VP.translate(-x,-y,-hoehe_vario)
block.add_entity(copy_VP)
line = Line.new(dxfattribs={"start":start,"end":ende })
+ line.dxf.layer = "6-SP"
copy = line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
- # msp.add_blockref(block_Vario_auf_9,(x,y,0))
- # msp.add_line((x+1000,y -66.5,45),(x-150.23,y -66.5, 45))
+ # a = msp.add_blockref(block_Vario_ab_9,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
# msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, ab_9_attrib)
+
elif winkel == 9:
@@ -2236,15 +2582,22 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
block.add_entity(copy_VP)
line = Line.new(dxfattribs={"start":start,"end":ende })
+ line.dxf.layer = "6-SP"
copy = line.copy()
copy.translate(-x,-y,-hoehe_vario)
block.add_entity(copy)
- # msp.add_blockref(block_Vario_auf_6,(x,y,0))
- # msp.add_line((x+500,y,45),(x-500,y,45))
- # msp.add_line((x,y+500,0),(x,y-500,0))
-
+ # a = msp.add_blockref(block_Vario_auf_6,(x,y,0))
+ # msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
+ # msp.add_line((x,y+1000,0),(x,y-1000,0))
+ # add_attributes_to_block(a, auf_6_attrib)
elif winkel == 3:
+ line_VP = Line.new(dxfattribs={"start": start_Umlenkstation_VP,"end": ende_Motor_VP})
+ line_VP.dxf.layer = "VARIO"
+ copy_VP = line_VP.copy()
+ copy_VP.translate(-x,-y,-hoehe_vario)
+ block.add_entity(copy_VP)
line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
copy= line.copy()
@@ -2331,8 +2684,8 @@ def handle_omniflo(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols,
-def erstellung_gefaelle_block_verbunenden_am_einen(x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle, drehung0, laenge,blockname, hight = None, block_vario = None, vario_richtung = None, verbungden_höher = None):
-
+def erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle, drehung0, laenge,blockname, hight = None, block_vario = None, vario_richtung = None, verbungden_höher = None):
+
halbe_laenge = laenge / 2
dy = halbe_laenge * math.cos(0)
@@ -2356,19 +2709,24 @@ def erstellung_gefaelle_block_verbunenden_am_einen(x, y, doc, lib_doc, asoffset,
elif vario_richtung =="Horizontal":
# TODO
return start, ende
+ if laenge > asoffset:
+ start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
+ ende = (x , y - dy ,lower_hoehe_gefaehlle)
- start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
- ende = (x , y - dy ,lower_hoehe_gefaehlle)
+ line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
+ copy= line.copy()
- line = Line.new(dxfattribs={"start": start, "end": ende})
- line.dxf.layer = "6-SP"
- copy= line.copy()
-
- copy.translate(-x,-y,-hoehe_gefaehlle)
- block.add_entity(copy)
+ copy.translate(-x,-y,-hoehe_gefaehlle)
+ block.add_entity(copy)
- block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] -hoehe_gefaehlle))
+ block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] -hoehe_gefaehlle))
+ return False
+ else:
+ msp.add_blockref(block_as,(x,y,upper_hoehe_gefaehlle))
+ return True
+
elif ((blockname not in doc.blocks and hight == "lower" and drehung0 == "GUZS") or (vario_richtung == "Auf"and verbungden_höher == True and drehung0 == "GUZS") or (vario_richtung == "Ab" and verbungden_höher == False and drehung0 == "GUZS")):
block_es = "200000146_ES-Element_90_rechts"
import_block(block_es,lib_doc,doc)
@@ -2389,21 +2747,23 @@ def erstellung_gefaelle_block_verbunenden_am_einen(x, y, doc, lib_doc, asoffset,
# TODO
return start, ende
+ if laenge > esoffset:
+ start = (x , y + dy,upper_hoehe_gefaehlle)
+ ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
- start = (x , y + dy,upper_hoehe_gefaehlle)
- ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
+ line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
+ copy= line.copy()
+ copy.translate(-x,-y,-hoehe_gefaehlle)
+ block.add_entity(copy)
+ block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset-y ,ende[2] -hoehe_gefaehlle))
+ return False
+ else:
+ msp.add_blockref(block_es,(x,y,lower_hoehe_gefaehlle))
+ return True
- line = Line.new(dxfattribs={"start": start, "end": ende})
- line.dxf.layer = "6-SP"
- copy= line.copy()
-
- copy.translate(-x,-y,-hoehe_gefaehlle)
- block.add_entity(copy)
-
-
- block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset-y ,ende[2] -hoehe_gefaehlle))
elif ((blockname not in doc.blocks and hight == "higher" and drehung0 == "UZS")or (vario_richtung == "Auf"and verbungden_höher == False and drehung0 == "UZS") or (vario_richtung == "Ab" and verbungden_höher == True and drehung0 == "UZS")):
block_as = "200000217_AS-Element_90_links"
import_block(block_as,lib_doc,doc)
@@ -2424,19 +2784,20 @@ def erstellung_gefaelle_block_verbunenden_am_einen(x, y, doc, lib_doc, asoffset,
elif vario_richtung =="Horizontal":
# TODO
return start, ende
- start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
- ende = (x , y - dy ,lower_hoehe_gefaehlle)
+
+ if laenge > asoffset:
+ start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
+ ende = (x , y - dy ,lower_hoehe_gefaehlle)
+ line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
+ copy= line.copy()
+ copy.translate(-x ,-y,-hoehe_gefaehlle)
+ block.add_entity(copy)
+ block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
+ else:
+ msp.add_blockref(block_as,(x,y,upper_hoehe_gefaehlle),dxfattribs={"rotation": 180})
- line = Line.new(dxfattribs={"start": start, "end": ende})
- line.dxf.layer = "6-SP"
- copy= line.copy()
-
- copy.translate(-x ,-y,-hoehe_gefaehlle)
- block.add_entity(copy)
-
-
- block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
elif (( blockname not in doc.blocks and hight == "lower" and drehung0 == "UZS") or (vario_richtung == "Auf" and verbungden_höher == True and drehung0 == "UZS") or (vario_richtung == "Ab" and verbungden_höher == False and drehung0 == "UZS")):
if hight != None:
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
@@ -2456,22 +2817,22 @@ def erstellung_gefaelle_block_verbunenden_am_einen(x, y, doc, lib_doc, asoffset,
elif vario_richtung =="Horizontal":
# TODO
return start, ende
- start = (x , y + dy ,upper_hoehe_gefaehlle)
- ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
+ if laenge > esoffset:
+ start = (x , y + dy ,upper_hoehe_gefaehlle)
+ ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
+ line = Line.new(dxfattribs={"start": start, "end": ende})
+ line.dxf.layer = "6-SP"
+ copy= line.copy()
- line = Line.new(dxfattribs={"start": start, "end": ende})
- line.dxf.layer = "6-SP"
- copy= line.copy()
+ copy.translate(-x ,-y,-hoehe_gefaehlle)
+ block.add_entity(copy)
- copy.translate(-x ,-y,-hoehe_gefaehlle)
- block.add_entity(copy)
-
-
-
-
-
- block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
+ block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
+ return False
+ else:
+ msp.add_blockref(block_es,(x,y,lower_hoehe_gefaehlle),dxfattribs={"rotation": 180})
+ return True
def gefaellegerade_erstellung(x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle,richtung2, drehung0, drehung1, laenge, hight_position, blockname, block_vario = None,voerder_richtung = None, am_kreisel = None, erster_kreisel_höher = None,y1=None,z1 =None):
@@ -3145,16 +3506,16 @@ def get_rotations_of_strecken(csv_path:Path) -> dict:
geraden = []
kreisel =[]
strecken_nachbarn = []
+ foerderernachbarn = []
anweisungen = 0
"""Gib für jede gefällestrecke zurück welche Drehrichtung die benachbarten Kreisel haben """
with csv_path.open(newline="", encoding="utf-8") as fh:
reader = csv.DictReader(fh, delimiter=';')
for row in reader:
bezeichner = row["TeileArt"].strip()
- if bezeichner == "ILS 2.0 Gefällestrecke" or bezeichner =="ILS 2.0 VarioFoerderer":
+ if bezeichner == "ILS 2.0 Gefällestrecke":
Id = row["TeileId"].strip()
NachbarIds = row["NachbarIds"].strip()
-
geraden.append({"Id": Id, "NachbarIds": NachbarIds})
if bezeichner == "ILS 2.0 Kreisel":
Id = row["TeileId"].strip()
@@ -3168,10 +3529,23 @@ def get_rotations_of_strecken(csv_path:Path) -> dict:
"Abstand (Kreiselachse A - Kreiselachse) in Meter", "20"
).replace(",", ".")
kreisel.append({"Id":Id, "drehung":drehung, "höhe":hight,"x": x, "y": y, "rotation": rotation,"abstand":abstand_m})
+ if bezeichner =="ILS 2.0 VarioFoerderer":
+ Id = row["TeileId"].strip()
+ NachbarIds = row["NachbarIds"].strip()
+ merkmale = parse_merkmale(row.get("Merkmale", ""))
+ winkel = merkmale.get("Winkel")
+ h0 = float(merkmale.get("Höhe Anfang")) * 1000
+ h1 = float(merkmale.get("Höhe Ende")) * 1000
+ foerderrichtung = merkmale.get("Förderrichtung")
+ geraden.append({"Id": Id,"NachbarIds":NachbarIds, "Winkel":winkel, "h0": h0,"h1": h1,"Foerderrichtung":foerderrichtung })
+
+
+
for gerade in geraden:
anweisungen = 0
+ geraden_anweisung = 0
eintrag = {"Id": gerade["Id"]}
for kreis in kreisel:
if kreis["Id"] in gerade["NachbarIds"]:
@@ -3191,6 +3565,25 @@ def get_rotations_of_strecken(csv_path:Path) -> dict:
eintrag["rotation1"] = kreis.get("rotation")
eintrag["abstand1"] = kreis.get("abstand")
break
+ if(gerade.get("Winkel") != None ):
+ for vario_gerade in geraden:
+
+ if vario_gerade["Id"] in gerade["NachbarIds"] and vario_gerade.get("Winkel") != None:
+ if geraden_anweisung == 0:
+ eintrag["Winkel"] = vario_gerade.get("Winkel")
+ eintrag["h0"] = vario_gerade.get("h0")
+ eintrag["h1"] = vario_gerade.get("h1")
+ eintrag["Foerderrichtung"] = vario_gerade.get("Foerderrichtung")
+ geraden_anweisung =1
+ elif geraden_anweisung == 1:
+ eintrag["Winkel_2"] = vario_gerade.get("Winkel")
+ eintrag["h0_2"] = vario_gerade.get("h0")
+ eintrag["h1_2"] = vario_gerade.get("h1")
+ eintrag["Foerderrichtung_2"] = vario_gerade.get("Foerderrichtung")
+ break
+
+
+
strecken_nachbarn.append(eintrag)
return strecken_nachbarn