From 1d3fa60ed491a74ff1aabbed2f266e23b4a58fe2 Mon Sep 17 00:00:00 2001
From: Paul Wolok
Date: Tue, 2 Dec 2025 14:18:09 +0100
Subject: [PATCH] =?UTF-8?q?werte=20in=20die=20config=20eingef=C3=BCgt?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
cfg/shapes.cfg | 15 +++++-----
lib/plant2dxf.py | 78 +++++++++++++++++++++++-------------------------
2 files changed, 45 insertions(+), 48 deletions(-)
diff --git a/cfg/shapes.cfg b/cfg/shapes.cfg
index 40b4b65..160febf 100644
--- a/cfg/shapes.cfg
+++ b/cfg/shapes.cfg
@@ -23,17 +23,18 @@ esoffset = 479.95
[ILS 2.0 Variofoerderer]
-Umlenkstation = 499.3148,0,26.1680
-
+Umlenkstation = 500.0, 0.0, 0.0
+Motorstation = 500.0, 0.0, 0.0
+vario_abstand = 66.5
[ILS 2.0 Variofoerderer_Bogen_block_namen]
bogen_3_auf = Vario_Bogen_auf_3°
bogen_3_ab = Vario_Bogen_ab_3°
[Ils 2.0 core winkel]
-winkel_boegen = 3
-winkel_motor = 3
-winkel_umlenk = 3
-winkel_as = 3
-winkel_es = 3
+winkel_boegen = 3.0
+winkel_motor = 3.0
+winkel_umlenk = 3.0
+winkel_as = 3.0
+winkel_es = 3.0
[Omniflo]
OFgeradesivas = 821106002
Tefgeradesivas = 1
diff --git a/lib/plant2dxf.py b/lib/plant2dxf.py
index 73e30df..2e0d5b0 100644
--- a/lib/plant2dxf.py
+++ b/lib/plant2dxf.py
@@ -1661,36 +1661,32 @@ def erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, upper
winkel_es = float(config.get("Ils 2.0 core winkel", "winkel_es"))
asoffset_y = asoffset * math.cos(math.radians(winkel_as))
asoffset_z = asoffset * math.sin(math.radians(winkel_as))
- esoffset_y = esoffset * math.cos(math.radians(winkel_as))
- esoffset_z = esoffset * math.sin(math.radians(winkel_as))
+ esoffset_y = esoffset * math.cos(math.radians(winkel_es))
+ esoffset_z = esoffset * math.sin(math.radians(winkel_es))
block_as = None
block_es = None
if (( hight == "higher" and drehung0 == "GUZS" )or (vario_richtung == "Auf"and verbungden_höher == False and drehung0 == "GUZS")or
(vario_richtung == "Ab" and verbungden_höher == True and drehung0 == "GUZS")or (vario_richtung == "Horizontal" and drehung0 == "GUZS" and (mit_horizontal_verbunden == "unten_drehung_0_or_-90" or mit_horizontal_verbunden == "oben_drehung_-180_or_-270"))):
block_as = "200000241_AS-Element_90_rechts"
import_block(block_as,lib_doc,doc)
- block_as = dreh_block(block_as,doc,math.radians(winkel_as))
elif ((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")or (vario_richtung == "Horizontal" and drehung0 == "GUZS" and (mit_horizontal_verbunden == "oben_drehung_0_or_-90" or mit_horizontal_verbunden == "unten_drehung_-180_or_-270"))):
block_es = "200000146_ES-Element_90_rechts"
import_block(block_es,lib_doc,doc)
- block_es = dreh_block(block_es,doc,math.radians(winkel_es))
elif ((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")or (vario_richtung == "Horizontal" and drehung0 == "UZS" and (mit_horizontal_verbunden == "unten_drehung_0_or_-90" or mit_horizontal_verbunden == "oben_drehung_-180_or_-270"))):
block_as = "200000217_AS-Element_90_links"
import_block(block_as,lib_doc,doc)
- block_as = dreh_block(block_as,doc,math.radians(winkel_es))
elif (( 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")or (vario_richtung == "Horizontal" and drehung0 == "UZS" and (mit_horizontal_verbunden == "oben_drehung_0_or_-90" or mit_horizontal_verbunden == "unten_drehung_-180_or_-270"))):
block_es = "400102632_ES-Element_90_links"
import_block(block_es,lib_doc,doc)
- block_es = dreh_block(block_es,doc,math.radians(winkel_es))
-
if block_as != None:
+ block_as = dreh_block(block_as,doc,math.radians(winkel_as))
if vario_richtung == "Auf" or vario_richtung =="Horizontal":
start = (x , y + dy ,upper_hoehe_gefaehlle)
ende = (x , y - dy + asoffset_y ,lower_hoehe_gefaehlle - asoffset_z)
@@ -1716,6 +1712,7 @@ def erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, upper
msp.add_blockref(block_as,(x,y,upper_hoehe_gefaehlle))
return True
elif block_es != None:
+ block_es = dreh_block(block_es,doc,math.radians(winkel_es))
if vario_richtung == "Auf" or vario_richtung =="Horizontal":
start = (x , y + dy-esoffset_y ,upper_hoehe_gefaehlle + esoffset_z)
ende = (x , y - dy,lower_hoehe_gefaehlle)
@@ -1750,8 +1747,8 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
winkel_es = float(config.get("Ils 2.0 core winkel", "winkel_es"))
asoffset_y = asoffset * math.cos(math.radians(winkel_as))
asoffset_z = asoffset * math.sin(math.radians(winkel_as))
- esoffset_y = esoffset * math.cos(math.radians(winkel_as))
- esoffset_z = esoffset * math.sin(math.radians(winkel_as))
+ esoffset_y = esoffset * math.cos(math.radians(winkel_es))
+ esoffset_z = esoffset * math.sin(math.radians(winkel_es))
block_as = None
block_es = None
halbe_laenge = laenge / 2
@@ -1766,15 +1763,12 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
(voerder_richtung == "Auf" and((am_kreisel == 1 and erster_kreisel_höher == False)or (am_kreisel== 2 and erster_kreisel_höher == True)) and drehung0 == "GUZS" and drehung1== "GUZS") or
(voerder_richtung == "Ab"and ((am_kreisel == 1 and erster_kreisel_höher == True)or (am_kreisel== 2 and erster_kreisel_höher == False)) and drehung0 == "GUZS" and drehung1== "GUZS")):
block_es = "200000146_ES-Element_90_rechts"
- import_block(block_es,lib_doc,doc)
- block_es = dreh_block(block_es,doc,math.radians(winkel_es))
-
+ import_block(block_es,lib_doc,doc)
elif ((drehung0 == "GUZS" and drehung1 == "GUZS") or
(am_kreisel != None and drehung0 == "GUZS" and drehung1 == "GUZS")):
block_as = "200000241_AS-Element_90_rechts"
import_block(block_as,lib_doc,doc)
- block_as = dreh_block(block_as,doc,math.radians(winkel_as))
elif (( drehung0 == "GUZS" and drehung1 == "UZS" and hight_position == "higher")or
(voerder_richtung == "Auf" and((am_kreisel == 1 and erster_kreisel_höher == False)or (am_kreisel == 2 and erster_kreisel_höher == True))and (drehung0 == "UZS" and drehung1 == "GUZS")) or
@@ -1782,7 +1776,6 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
block_es = "400102632_ES-Element_90_links"
import_block(block_es,lib_doc,doc)
- block_es = dreh_block(block_es,doc,math.radians(winkel_es))
elif ((drehung0 == "UZS" and drehung1 == "GUZS" and hight_position == "lower")or
(voerder_richtung == "Auf" and((am_kreisel == 1 and erster_kreisel_höher == True)or (am_kreisel == 2 and erster_kreisel_höher == False))and (drehung0 == "UZS" and drehung1 == "GUZS")) or
@@ -1790,7 +1783,6 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
block_as = "200000241_AS-Element_90_rechts"
import_block(block_as,lib_doc,doc)
- block_as = dreh_block(block_as,doc,math.radians(winkel_as))
elif ((drehung0 == "UZS" and drehung1 == "UZS" and hight_position == "higher")or
(voerder_richtung == "Auf" and((am_kreisel == 1 and erster_kreisel_höher == False)or (am_kreisel== 2 and erster_kreisel_höher == True)) and drehung0 == "UZS" and drehung1== "UZS")or
@@ -1798,30 +1790,26 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
block_es = "400102632_ES-Element_90_links"
import_block(block_es,lib_doc,doc)
- block_es = dreh_block(block_es,doc,math.radians(winkel_es))
-
elif (((drehung0 == "UZS" and drehung1 == "UZS")or
(am_kreisel!= None and drehung0 == "UZS" and drehung1 == "UZS"))):
block_as = "200000217_AS-Element_90_links"
import_block(block_as,lib_doc,doc)
- block_as = dreh_block(block_as,doc,math.radians(winkel_as))
elif (((drehung0 == "UZS" and drehung1 == "GUZS" and hight_position== "higher"))or
(voerder_richtung == "Auf"and ((am_kreisel == 1 and erster_kreisel_höher == False) or (am_kreisel ==2 and erster_kreisel_höher ==True))and (drehung0 == "GUZS" and drehung1 == "UZS")) or
(voerder_richtung == "Ab" and((am_kreisel == 1 and erster_kreisel_höher == True)or (am_kreisel == 2 and erster_kreisel_höher == False))and (drehung0 == "UZS" and drehung1 == "GUZS"))):
block_es = "200000146_ES-Element_90_rechts"
import_block(block_es,lib_doc,doc)
- block_es = dreh_block(block_es,doc,math.radians(winkel_es))
elif ((drehung0 == "GUZS" and drehung1 == "UZS" and hight_position == "lower")or
(voerder_richtung == "Auf"and((am_kreisel == 1 and erster_kreisel_höher == True)or (am_kreisel == 2 and erster_kreisel_höher == False))and (drehung0 == "GUZS" and drehung1 == "UZS")) or
(voerder_richtung == "Ab" and((am_kreisel == 1 and erster_kreisel_höher == False)or (am_kreisel == 2 and erster_kreisel_höher == True))and (drehung0 == "UZS" and drehung1 == "GUZS"))):
block_as = "200000217_AS-Element_90_links"
import_block(block_as,lib_doc,doc)
- block_as = dreh_block(block_as,doc,math.radians(winkel_as))
if block_es != None:
+ block_es = dreh_block(block_es,doc,math.radians(winkel_es))
if voerder_richtung == "Auf":
start = (x , y+ dy - esoffset_y,upper_hoehe_gefaehlle + esoffset_z)
ende = (x , y1 ,z1)
@@ -1843,6 +1831,7 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
block.add_entity(copy)
block.add_blockref(block_es, (ende[0]-x ,ende[1]- esoffset_y -y ,ende[2] -hoehe_gefaehlle ))
if block_as != None:
+ block_as = dreh_block(block_as,doc,math.radians(winkel_as))
if voerder_richtung == "Auf":
start = (x , y1,z1)
ende = (x , y - dy + asoffset_y ,lower_hoehe_gefaehlle)
@@ -2099,8 +2088,11 @@ def am_kreisel_direct_verbunden(x, y, upper_hoehe_gefaehlle, lower_hoehe_gefaehl
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 ):
# Entnehmen der Motor und Umlenk station um die Gefähle auzurechnen und ob man diese tatsächlich einfügen muss
- winkel_motor = int(config.get("Ils 2.0 core winkel","winkel_motor"))
- winkel_umlenk = int(config.get("Ils 2.0 core winkel","winkel_umlenk"))
+ winkel_motor = float(config.get("Ils 2.0 core winkel","winkel_motor"))
+ winkel_umlenk = float(config.get("Ils 2.0 core winkel","winkel_umlenk"))
+ umlenk_laenge = tuple(float(x) for x in(config.get("ILS 2.0 Variofoerderer","Umlenkstation")).split(","))
+ motor_laenge = tuple(float(x) for x in(config.get("ILS 2.0 Variofoerderer","Motorstation")).split(","))
+ vario_abstand = float(config.get("ILS 2.0 Variofoerderer","vario_abstand"))
motor_vorhanden = bool(merkmale.get("hatMotor"))
umlenk_vorhanden = bool(merkmale.get("hatUmlenkung"))
if merkmale.get("Winkel_Gefaellestrecke") != None:
@@ -2110,12 +2102,16 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
gefahellewinkel = 0.0
gefaelle = 0.0
# Aktueller offset des motors und Umlenkungstation, wird wahrscheinlich später einfach berechnet (sobald man entschieden hat ob wir nur 3 grad neigung erlauben oder nicht)
- umlenk_motor_offset = tuple(float(x) for x in(config.get("ILS 2.0 Variofoerderer","Umlenkstation")).split(","))
+
+ motor_offset_x = umlenk_laenge[0]* math.cos(math.radians(winkel_motor))
+ motor_offset_z = umlenk_laenge[0]* math.sin(math.radians(winkel_motor))
+ umlenk_offset_x = motor_laenge[0]* math.cos(math.radians(winkel_umlenk))
+ umlenk_offset_z = motor_laenge[0]* math.sin(math.radians(winkel_umlenk))
# Berechnung des Gefälles
if motor_vorhanden == True:
- gefaelle = gefaelle - umlenk_motor_offset[0]
+ gefaelle = gefaelle - motor_offset_x
if umlenk_vorhanden == True:
- gefaelle = gefaelle - umlenk_motor_offset[0]
+ gefaelle = gefaelle - umlenk_offset_x
#Erstellung des Förderes falls er auf ist oder Horizontal da diese gleich aufgebaut werden
if voerder_richtung== "Auf" or voerder_richtung== "Horizontal":
@@ -2167,16 +2163,16 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
block_Vario_Motorstation_500mm = dreh_block(block_Vario_Motorstation_500mm,doc,math.radians(winkel_motor))
block_Vario_Umlenkstation_500mm = dreh_block( block_Vario_Umlenkstation_500mm, doc,math.radians(winkel_umlenk))
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])
+ block.add_blockref(block_Vario_Umlenkstation_500mm,(ende[0] -x,ende[1] -y + umlenk_offset_x/2,ende[2] - hoehe_vario -umlenk_offset_z/2 ),dxfattribs={"rotation": 90})
+ ende = (ende[0] ,ende[1] + umlenk_offset_x,ende[2] - umlenk_offset_z)
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]
+ block.add_blockref(block_Vario_Motorstation_500mm, (start[0]-x , start[1] - motor_offset_x/2 -y ,start[2] - hoehe_vario +motor_offset_z/2),dxfattribs={"rotation": 90})
+ start = start[0] , start[1] - motor_offset_x,start[2] + motor_offset_z
if voerder_richtung== "Auf":
# Einfügen der 51 grad Bogen und deren notwendigen Werten von den attributen des bogens in den block
- winkel_core = int(config.get("Ils 2.0 core winkel","winkel_boegen"))
- winkel_plus = int(winkel) + winkel_core
+ winkel_core = float(config.get("Ils 2.0 core winkel","winkel_boegen"))
+ winkel_plus = winkel + winkel_core
block_Vario_Bogen_auf = (f"Vario_Bogen_auf_{winkel_plus}°")
block_Vario_Bogen_ab = (f"Vario_Bogen_ab_{winkel_plus}°")
@@ -2367,22 +2363,22 @@ def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_var
block_Vario_Motorstation_500mm = dreh_block( block_Vario_Motorstation_500mm, doc,math.radians(winkel_motor))
block_Vario_Umlenkstation_500mm = dreh_block( block_Vario_Umlenkstation_500mm , doc,math.radians(winkel_umlenk))
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(-winkel_umlenk))+ math.sin(math.radians(-winkel_umlenk))* -45,start[2] + math.sin(math.radians(-winkel_umlenk))*500+ math.cos(math.radians(-winkel_umlenk))*-45
- start = (start[0] ,start[1] - umlenk_motor_offset[0],start[2] -umlenk_motor_offset[2])
+ block.add_blockref(block_Vario_Umlenkstation_500mm,(start[0] -x,start[1] -y - umlenk_offset_x/2, start[2] - hoehe_vario -umlenk_offset_z/2 ),dxfattribs={"rotation": 270})
+ start_Umlenkstation_VP = start[0] - vario_abstand, start[1] -500 *math.cos(math.radians(-winkel_umlenk))+ math.sin(math.radians(-winkel_umlenk))* -45,start[2] + math.sin(math.radians(-winkel_umlenk))*500+ math.cos(math.radians(-winkel_umlenk))*-45
+ start = (start[0] ,start[1] - umlenk_offset_x,start[2] -umlenk_offset_z)
elif winkel == 3:
- start_Umlenkstation_VP = start[0] - 66.5, start[1]+ winkel_VP_offset_vorne[0],start[2] -winkel_VP_offset_hinten[2]
+ start_Umlenkstation_VP = start[0] - vario_abstand, 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(-winkel_motor))+ math.sin(math.radians(-winkel_motor))* -45,ende[2] - math.sin(math.radians(-winkel_motor))*500+ math.cos(math.radians(-winkel_motor))*-45
+ block.add_blockref(block_Vario_Motorstation_500mm, (ende[0]-x , ende[1] + motor_offset_x/2 -y ,ende[2] - hoehe_vario + motor_offset_z/2),dxfattribs={"rotation": 270})
+ ende_Motor_VP = ende[0] - vario_abstand, ende[1] +500 *math.cos(math.radians(-winkel_motor))+ math.sin(math.radians(-winkel_motor))* -45,ende[2] - math.sin(math.radians(-winkel_motor))*500+ math.cos(math.radians(-winkel_motor))*-45
- ende = ende[0] , ende[1] + umlenk_motor_offset[0],ende[2] +umlenk_motor_offset[2]
+ ende = ende[0] , ende[1] + motor_offset_x,ende[2] +motor_offset_z
elif winkel == 3:
- ende_Motor_VP = ende[0] - 66.5, ende[1]+ winkel_VP_offset_hinten[0] ,ende[2] - winkel_VP_offset_vorne[2]
+ ende_Motor_VP = ende[0] - vario_abstand, ende[1]+ winkel_VP_offset_hinten[0] ,ende[2] - winkel_VP_offset_vorne[2]
if winkel != 3:
- winkel_core = int(config.get("Ils 2.0 core winkel","winkel_boegen"))
- winkel_minus = int(winkel) - winkel_core
+ winkel_core = float(config.get("Ils 2.0 core winkel","winkel_boegen"))
+ winkel_minus = winkel - winkel_core
block_Vario_Bogen_auf = (f"Vario_Bogen_auf_{winkel_minus}°")
block_Vario_Bogen_ab = (f"Vario_Bogen_ab_{winkel_minus}°")
ab_attrib =import_block( block_Vario_Bogen_ab , lib_doc, doc)