Vario Kurve mit Gefällestrecke verbunden verbessert, Sonderfall horinzonal und 3 grad bogen hinzugefügt

This commit is contained in:
2025-12-17 14:42:53 +01:00
parent d909fa6c1a
commit 843011bab9
2 changed files with 219 additions and 130 deletions
+59 -37
View File
@@ -37,73 +37,95 @@ class Gefaellestrecke(BaseModel):
anzahl_scanner = int(merkmale.get("Anzahl der Scanner")),
anzahl_separatoren = int(merkmale.get("Anzahl der Separatoren"))
)
def hat_motor_umlenk_station (doc, lib_doc, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, gefaellestrecke_nachbarn):
def hat_motor_umlenk_station (gefaelle_objekt, gefaellestrecke_nachbarn):
hat_motor_0 = None
hat_motor_1 = None
hat_umlenk_0 = None
hat_umlenk_1 = None
tefkurve_0 = None
tefkurve_1 = None
umlenk_gerade = False
motor_gerade = False
upper_hoehe_gefaehlle = gefaelle_objekt.h1
lower_hoehe_gefaehlle = gefaelle_objekt.h0
rotation = gefaelle_objekt.drehung
x = gefaelle_objekt.x
y = gefaelle_objekt.y
if "Kurvenrichtung" in gefaellestrecke_nachbarn:
vario_hoehe_0 = float(gefaellestrecke_nachbarn.get("vario_hoehe_0"))
vario_hoehe_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_1"))
kurvenrichtung = gefaellestrecke_nachbarn.get("Kurvenrichtung")
tefkurve_0 = gefaellestrecke_nachbarn.get("Tefkurve")
if (kurvenrichtung == "links" and tefkurve_0 == "Aussen") or kurvenrichtung == "rechts" and tefkurve_0 == "Innen":
tefkurve_0 = "links"
else:
tefkurve_0 = gefaellestrecke_nachbarn.get("Tefkurve")
x_angetrieben = gefaellestrecke_nachbarn.get("X_angetrieben")
y_angetrieben = gefaellestrecke_nachbarn.get("Y_angetrieben")
if (kurvenrichtung == "links" and tefkurve_0 == "außen") or kurvenrichtung == "rechts" and tefkurve_0 == "innen":
tefkurve_0 = "rechts"
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
blockname_motor_links = block_Vario_Motorstation_500mm +"links"
blockname_umlenk_links = block_Vario_Umlenkstation_500mm + "links"
plant2dxf.import_block(block_Vario_Umlenkstation_500mm,lib_doc,doc)
plant2dxf.import_block(block_Vario_Motorstation_500mm,lib_doc,doc)
block_Vario_Umlenkstation_500mm =plant2dxf.dreh_block(block_Vario_Umlenkstation_500mm,doc,lib_doc,math.radians(3))
block_Vario_Motorstation_500mm =plant2dxf.dreh_block(block_Vario_Motorstation_500mm,doc,lib_doc,math.radians(3))
if blockname_motor_links not in doc.blocks:
matrix = Matrix44.scale(1,-1,1)
block_motor_links = doc.blocks.new(name=blockname_motor_links,base_point=(0,0,0))
block_umlenk_links = doc.blocks.new(name=blockname_umlenk_links,base_point=(0,0,0))
block_motor_rechts = doc.blocks[block_Vario_Motorstation_500mm]
block_umlenk_rechts = doc.blocks[block_Vario_Umlenkstation_500mm]
for e in block_motor_rechts:
copy = e.copy()
copy.transform(matrix)
block_motor_links.add_entity(copy)
for e in block_umlenk_rechts:
copy = e.copy()
copy.transform(matrix)
block_umlenk_links.add_entity(copy)
else:
tefkurve_0 = "links"
if upper_hoehe_gefaehlle > lower_hoehe_gefaehlle:
if vario_hoehe_0 == upper_hoehe_gefaehlle or vario_hoehe_1 == upper_hoehe_gefaehlle:
hat_motor_0 = True
else:
hat_umlenk_0 = True
if upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
elif upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
if vario_hoehe_0 == lower_hoehe_gefaehlle or vario_hoehe_1 == lower_hoehe_gefaehlle:
hat_motor_0 = True
else:
hat_umlenk_0 = True
else:
rotation_zwischen = rotation
if rotation_zwischen == 0.0:
rotation_zwischen = -360.0
if (((-360.0<= rotation_zwischen< -270.0)and y > y_angetrieben) or ((-90.0< rotation< 0.0)and y > y_angetrieben) or
((-270.0< rotation_zwischen< -90.0)and y < y_angetrieben) or
(rotation == -90.0 and x < x_angetrieben) or ((rotation == -270.0)and x<x_angetrieben)):
hat_umlenk_0 = True
umlenk_gerade = True
else:
hat_motor_0 = True
motor_gerade = True
if "Kurvenrichtung_1" in gefaellestrecke_nachbarn:
vario_hoehe_0_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_0_1")) * 1000
vario_hoehe_1_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_1_1")) * 1000
vario_hoehe_0_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_0_1"))
vario_hoehe_1_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_1_1"))
kurvenrichtung_1 = gefaellestrecke_nachbarn.get("Kurvenrichtung_1")
tefkurve_1 = gefaellestrecke_nachbarn.get("Tefkurve_1")
if (kurvenrichtung_1 == "links" and tefkurve_1 == "Aussen") or kurvenrichtung_1 == "rechts" and tefkurve_1 == "Innen":
tefkurve_0 = "links"
if (kurvenrichtung_1 == "links" and tefkurve_1 == "außen") or kurvenrichtung_1 == "rechts" and tefkurve_1 == "innen":
tefkurve_1 = "rechts"
else:
tefkurve_0 = "rechts"
tefkurve_1 = "links"
if upper_hoehe_gefaehlle > lower_hoehe_gefaehlle:
if vario_hoehe_0_1 == upper_hoehe_gefaehlle or vario_hoehe_1_1 == upper_hoehe_gefaehlle:
hat_motor_1 = True
else:
hat_umlenk_1 = True
if upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
elif upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
if vario_hoehe_0_1 == lower_hoehe_gefaehlle or vario_hoehe_1_1 == lower_hoehe_gefaehlle:
hat_motor_1 = True
else:
hat_umlenk_1 = True
return hat_motor_0,hat_umlenk_0,hat_motor_1,hat_umlenk_1, tefkurve_0, tefkurve_1
else:
rotation_zwischen = rotation
if rotation_zwischen == 0.0:
rotation_zwischen = -360.0
if (((-360.0<= rotation_zwischen< -270.0)and y > y_angetrieben) or ((-90.0< rotation< 0.0)and y > y_angetrieben) or
((-270.0< rotation_zwischen< -90.0)and y < y_angetrieben) or
(rotation == -90.0 and x < x_angetrieben) or ((rotation == -270.0)and x<x_angetrieben)):
hat_umlenk_1 = True
umlenk_gerade = True
else:
hat_motor_1 = True
motor_gerade = True
hat_zusatz ={}
hat_zusatz["hat_motor_0"] = hat_motor_0
hat_zusatz["hat_motor_1"] = hat_motor_1
hat_zusatz["hat_umlenk_0"] = hat_umlenk_0
hat_zusatz["hat_umlenk_1"] = hat_umlenk_1
hat_zusatz["tefkurve_0"] = tefkurve_0
hat_zusatz["tefkurve_1"] = tefkurve_1
hat_zusatz["umlenk_gerade"] = umlenk_gerade
hat_zusatz["motor_gerade"] = motor_gerade
return hat_zusatz