Refactoring und korrektur der Vario Förder Vario linie wenn der ab 3 grad vario keine Motor/Umlenk station hat
This commit is contained in:
@@ -60,7 +60,115 @@ class VarioFoerderer(BaseModel):
|
||||
anzahl_separatoren = int(merkmale.get("Anzahl der Separatoren"))
|
||||
|
||||
)
|
||||
|
||||
def get_offset_of_Vario_line(doc, lib_doc, voerder_richtung, winkel, upper_hoehe_vario, lower_hoehe_vario, gefaellestrecke_vario):
|
||||
winkel_VP_offset_vorne = None
|
||||
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 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
|
||||
winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel")) +3
|
||||
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"]))
|
||||
# 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))
|
||||
|
||||
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_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 =plant2dxf.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"]))
|
||||
# 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:
|
||||
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
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
|
||||
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_hinten_plusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_1"]))
|
||||
VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
|
||||
# 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:
|
||||
# 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"))
|
||||
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_hinten_minusbogen}°")
|
||||
att_hinten =plant2dxf.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"]))
|
||||
# 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"):
|
||||
# Ü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:
|
||||
if (gefaellestrecke_vario.get("Foerderrichtung_2") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung_2") == "Horizontal"):
|
||||
# Nehmen des winkels und diesen plus 3 nehmen, um den Bogen zu imporieren für heraufinden der Delta werte
|
||||
winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel_2")) +3
|
||||
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"]))
|
||||
# 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))
|
||||
|
||||
elif gefaellestrecke_vario.get("Foerderrichtung_2") == "Ab":
|
||||
# Nehmen des winkels und diesen minus 3 nehmen, um den Bogen zu imporieren für heraufinden der Delta werte
|
||||
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 =plant2dxf.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"]))
|
||||
# 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_2")) == upper_hoehe_vario:
|
||||
if (gefaellestrecke_vario.get("Foerderrichtung_2") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung_2") == "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_2")) +3
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel_2"))
|
||||
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_hinten_plusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_1"]))
|
||||
VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
|
||||
# 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:
|
||||
# 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"))
|
||||
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_hinten_minusbogen}°")
|
||||
att_hinten =plant2dxf.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"]))
|
||||
# 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))
|
||||
|
||||
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
|
||||
winkel_motor = float(config.get("Ils 2.0 core winkel","winkel_motor"))
|
||||
@@ -301,20 +409,19 @@ class VarioFoerderer(BaseModel):
|
||||
layer_umlenk, color_umlenk = plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Umlenkstation_500mm)
|
||||
block_Vario_Motorstation_500mm = plant2dxf.dreh_block( block_Vario_Motorstation_500mm, doc,lib_doc,math.radians(winkel_motor))
|
||||
block_Vario_Umlenkstation_500mm = plant2dxf.dreh_block( block_Vario_Umlenkstation_500mm , doc,lib_doc,math.radians(winkel_umlenk))
|
||||
if umlenk_vorhanden == True:
|
||||
if motor_vorhanden == True:
|
||||
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,"layer": layer_umlenk,"color": color_umlenk})
|
||||
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] - vario_abstand, start[1]+ winkel_VP_offset_vorne[0],start[2] -winkel_VP_offset_hinten[2]
|
||||
if motor_vorhanden == True:
|
||||
start_Umlenkstation_VP = start[0] - vario_abstand, start[1]+ winkel_VP_offset_vorne[0],start[2] -winkel_VP_offset_vorne[2]
|
||||
if umlenk_vorhanden == True:
|
||||
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,"layer": layer_motor,"color": color_motor})
|
||||
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] + motor_offset_x,ende[2] +motor_offset_z
|
||||
elif winkel == 3:
|
||||
ende_Motor_VP = ende[0] - vario_abstand, 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_vorne[0] ,ende[2] - winkel_VP_offset_hinten[2]
|
||||
if winkel != 3:
|
||||
winkel_core = int(config.get("Ils 2.0 core winkel","winkel_boegen"))
|
||||
winkel_minus = winkel - winkel_core
|
||||
|
||||
Reference in New Issue
Block a user