Block_methoden in einen eigen File refactored
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
import math
|
||||
import re
|
||||
import plant2dxf
|
||||
import math
|
||||
from ezdxf.math import Matrix44
|
||||
import block_methoden
|
||||
|
||||
|
||||
class Gefaellestrecke(BaseModel):
|
||||
@@ -22,7 +24,6 @@ class Gefaellestrecke(BaseModel):
|
||||
|
||||
@classmethod
|
||||
def from_merkmale(cls, teileid: str, x: float, y: float, merkmale: dict) -> 'Gefaellestrecke':
|
||||
|
||||
h0 = float(merkmale.get("Höhe unten")) * 1000
|
||||
h1 = float(merkmale.get("Höhe oben")) * 1000
|
||||
laenge = float(merkmale.get("Länge in Meter")) * 1000
|
||||
@@ -37,6 +38,79 @@ class Gefaellestrecke(BaseModel):
|
||||
anzahl_scanner = int(merkmale.get("Anzahl der Scanner")),
|
||||
anzahl_separatoren = int(merkmale.get("Anzahl der Separatoren"))
|
||||
)
|
||||
|
||||
def ein_motor_oder_eine_umlenk(x, y,start,ende, doc, lib_doc, hoehe_gefaehlle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_0, hat_umlenk_0, tefkurve_0, block,umlenk_gerade,motor_gerade):
|
||||
|
||||
block_Vario_Bogen_auf = (f"Vario_Bogen_auf_3°")
|
||||
block_Vario_Bogen_ab = (f"Vario_Bogen_ab_3°")
|
||||
block_Vario_Bogen_auf_links = (f"Vario_Bogen_auf_3°") + "_links"
|
||||
block_Vario_Bogen_ab_links = (f"Vario_Bogen_ab_3°") + "_links"
|
||||
auf_attrib = block_methoden.import_block(block_Vario_Bogen_auf,lib_doc,doc)
|
||||
ab_attrib = block_methoden.import_block(block_Vario_Bogen_ab,lib_doc,doc)
|
||||
Vario_Bogen_auf_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_attrib["DELTA_SP_0"]))
|
||||
Vario_Bogen_auf_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_SP_1"]))
|
||||
Vario_Bogen_ab_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_0"]))
|
||||
Vario_Bogen_ab_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_1"]))
|
||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_0):
|
||||
if wert < 0:
|
||||
Vario_Bogen_auf_Delta_SP_0[i] = abs(wert)
|
||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_1):
|
||||
if wert< 0:
|
||||
Vario_Bogen_auf_Delta_SP_1[i] = abs(wert)
|
||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_0):
|
||||
if wert< 0:
|
||||
Vario_Bogen_ab_Delta_SP_0[i] = abs(wert)
|
||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_1):
|
||||
if wert< 0:
|
||||
Vario_Bogen_ab_Delta_SP_1[i] = abs(wert)
|
||||
block_methoden.turn_two_blocks_left(doc, block_Vario_Bogen_auf, block_Vario_Bogen_ab, block_Vario_Bogen_ab_links, block_Vario_Bogen_auf_links)
|
||||
if hat_motor_0 == True:
|
||||
if tefkurve_0 == "rechts":
|
||||
if motor_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_ab,(start[0]-x,start[1]-Vario_Bogen_ab_Delta_SP_0[0]-y,start[2]- Vario_Bogen_ab_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start = [start[0],start[1]-Vario_Bogen_ab_Delta_SP_0[0]- Vario_Bogen_ab_Delta_SP_1[0],start[2]-Vario_Bogen_ab_Delta_SP_0[2]- Vario_Bogen_ab_Delta_SP_1[2]]
|
||||
block.add_blockref(blockname_motor_links, (start[0]-x,start[1] - 250* math.cos(math.radians(3))-y,start[2] - 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500* math.cos(math.radians(3))
|
||||
start[2] = start[2] - 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Motorstation_500mm", (start[0]-x,start[1] -y,start[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500
|
||||
|
||||
else:
|
||||
if motor_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_ab_links,(start[0]-x,start[1]-Vario_Bogen_ab_Delta_SP_0[0]-y,start[2]- Vario_Bogen_ab_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start = [start[0],start[1]-Vario_Bogen_ab_Delta_SP_0[0]- Vario_Bogen_ab_Delta_SP_1[0],start[2]-Vario_Bogen_ab_Delta_SP_0[2]- Vario_Bogen_ab_Delta_SP_1[2]]
|
||||
block.add_blockref(block_Vario_Motorstation_500mm, (start[0]-x,start[1] - 250* math.cos(math.radians(3))-y,start[2] - 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500* math.cos(math.radians(3))
|
||||
start[2] = start[2] - 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Motorstation_500mm_links", (start[0]-x,start[1] -y,start[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500
|
||||
|
||||
if hat_umlenk_0 == True:
|
||||
if tefkurve_0 == "rechts":
|
||||
if umlenk_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_auf_links,(ende[0]-x,ende[1]+Vario_Bogen_auf_Delta_SP_0[0]-y,ende[2] + Vario_Bogen_auf_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 90})
|
||||
ende = [ende[0],ende[1]+ Vario_Bogen_auf_Delta_SP_0[0]+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]+Vario_Bogen_auf_Delta_SP_0[2]+ Vario_Bogen_auf_Delta_SP_1[2]]
|
||||
block.add_blockref(blockname_umlenk_links, (ende[0]-x,ende[1] + 250* math.cos(math.radians(3))-y,ende[2] + 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
|
||||
ende [1]= ende[1] + 500* math.cos(math.radians(3))
|
||||
ende[2] = ende[2] + 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Umlenkstation_500mm", (ende[0]-x,ende[1] + 250-y,ende[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
ende [1]= ende[1] + 500
|
||||
|
||||
else:
|
||||
if umlenk_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_auf,(ende[0]-x,ende[1]+Vario_Bogen_auf_Delta_SP_0[0]-y,ende[2] + Vario_Bogen_auf_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 90})
|
||||
ende = [ende[0],ende[1]+ Vario_Bogen_auf_Delta_SP_0[0]+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]+Vario_Bogen_auf_Delta_SP_0[2]+ Vario_Bogen_auf_Delta_SP_1[2]]
|
||||
block.add_blockref(block_Vario_Umlenkstation_500mm, (ende[0]-x,ende[1] + 250* math.cos(math.radians(3))-y,ende[2] + 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
ende [1]= ende[1] + 500* math.cos(math.radians(3))
|
||||
ende[2] = ende[2] + 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Umlenkstation_500mm", (ende[0]-x,ende[1] + 250-y,ende[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
ende [1]= ende[1] + 500
|
||||
return start,ende
|
||||
def hat_motor_umlenk_station (gefaelle_objekt, gefaellestrecke_nachbarn):
|
||||
hat_motor_0 = None
|
||||
hat_motor_1 = None
|
||||
@@ -52,7 +126,6 @@ class Gefaellestrecke(BaseModel):
|
||||
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"))
|
||||
|
||||
@@ -4,6 +4,7 @@ import math
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
from typing import Optional
|
||||
import plant2dxf
|
||||
import block_methoden
|
||||
|
||||
|
||||
ATTR_TAG = "TeileId" # Attributtag im Block
|
||||
@@ -218,8 +219,8 @@ class Kreisel(BaseModel):
|
||||
rotation = math.degrees(math.atan2(p2_oben[1] - p1_oben[1], p2_oben[0] - p1_oben[0]))
|
||||
if drehrichtung == "GUZS":
|
||||
rotation += 180
|
||||
plant2dxf.import_block("Richtungspfeil", lib_doc, doc)
|
||||
blockref_layer, color = plant2dxf.get_insert_color_layer(lib_doc, "Richtungspfeil")
|
||||
block_methoden.import_block("Richtungspfeil", lib_doc, doc)
|
||||
blockref_layer, color = block_methoden.get_insert_color_layer(lib_doc, "Richtungspfeil")
|
||||
bref = msp.add_blockref("Richtungspfeil", (px, py,z1), dxfattribs={"rotation": rotation,"layer": blockref_layer})
|
||||
if verbose:
|
||||
print(f"[INFO] Drehrichtung '{drehrichtung}': Richtungspfeil oben bei ({px:.1f}, {py:.1f}), rot={rotation:.1f}")
|
||||
@@ -231,8 +232,8 @@ class Kreisel(BaseModel):
|
||||
rotation = math.degrees(math.atan2(p2_unten[1] - p1_unten[1], p2_unten[0] - p1_unten[0]))
|
||||
if drehrichtung == "UZS":
|
||||
rotation += 180
|
||||
plant2dxf.import_block("Richtungspfeil", lib_doc, doc)
|
||||
blockref_layer, color = plant2dxf.get_insert_color_layer( lib_doc, "Richtungspfeil")
|
||||
block_methoden.import_block("Richtungspfeil", lib_doc, doc)
|
||||
blockref_layer, color = block_methoden.get_insert_color_layer( lib_doc, "Richtungspfeil")
|
||||
bref = msp.add_blockref("Richtungspfeil", (px, py, z1), dxfattribs={"rotation": rotation , "layer": blockref_layer})
|
||||
if verbose:
|
||||
print(f"[INFO] Drehrichtung '{drehrichtung}':Richtungspfeil unten bei ({px:.1f}, {py:.1f}), rot={rotation:.1f}")
|
||||
@@ -4,6 +4,7 @@ import math
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
from typing import Optional
|
||||
import plant2dxf
|
||||
import block_methoden
|
||||
class Omniflo(BaseModel):
|
||||
teileid:str
|
||||
x:float
|
||||
@@ -68,8 +69,8 @@ class Omniflo(BaseModel):
|
||||
else:
|
||||
linie.dxf.layer = "A-2"
|
||||
def omniflo_foerdererstellung(msp, x, y, doc, lib_doc, omniflo_objekt, rotation):
|
||||
plant2dxf.import_block("bogen1",lib_doc,doc)
|
||||
plant2dxf.import_block("bogen2",lib_doc,doc)
|
||||
block_methoden.import_block("bogen1",lib_doc,doc)
|
||||
block_methoden.import_block("bogen2",lib_doc,doc)
|
||||
|
||||
laenge = omniflo_objekt.laenge
|
||||
h0 = omniflo_objekt.h0
|
||||
|
||||
@@ -5,6 +5,8 @@ from typing import Optional
|
||||
import plant2dxf
|
||||
from ezdxf.math import Matrix44
|
||||
import re
|
||||
import block_methoden
|
||||
|
||||
|
||||
class VarioFoerderer(BaseModel):
|
||||
teileid: str
|
||||
@@ -77,7 +79,7 @@ class VarioFoerderer(BaseModel):
|
||||
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)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
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
|
||||
@@ -89,7 +91,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_vorne = int(gefaellestrecke_vario.get("Winkel"))
|
||||
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_vorne_minusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.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
|
||||
@@ -102,7 +104,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
|
||||
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_hinten_plusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_hinten =block_methoden.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
|
||||
@@ -114,7 +116,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
|
||||
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_hinten_minusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_hinten =block_methoden.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
|
||||
@@ -123,7 +125,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel")) +3
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_1"]))
|
||||
VP_0_nachbar_hinten = 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"]))
|
||||
@@ -139,13 +141,13 @@ class VarioFoerderer(BaseModel):
|
||||
((-270.0< rotation_zwischen< -90.0)and y < y_foerderer) or
|
||||
(rotation == -90.0 and x < x_foerderer) or ((rotation == -270.0)and x<x_foerderer)):
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
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"]))
|
||||
winkel_VP_offset_vorne = (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))
|
||||
else:
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_vorne_plusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_hinten =block_methoden.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"]))
|
||||
winkel_VP_offset_hinten = (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))
|
||||
@@ -153,7 +155,7 @@ class VarioFoerderer(BaseModel):
|
||||
|
||||
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)
|
||||
att_kurve = block_methoden.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"]))
|
||||
@@ -197,7 +199,7 @@ class VarioFoerderer(BaseModel):
|
||||
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)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
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
|
||||
@@ -209,7 +211,7 @@ class VarioFoerderer(BaseModel):
|
||||
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)
|
||||
att_vorne =block_methoden.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
|
||||
@@ -222,7 +224,7 @@ class VarioFoerderer(BaseModel):
|
||||
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)
|
||||
att_hinten =block_methoden.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
|
||||
@@ -234,7 +236,7 @@ class VarioFoerderer(BaseModel):
|
||||
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)
|
||||
att_hinten =block_methoden.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
|
||||
@@ -243,7 +245,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel_2")) +3
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel_2"))
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_1"]))
|
||||
VP_0_nachbar_hinten = 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"]))
|
||||
@@ -259,19 +261,19 @@ class VarioFoerderer(BaseModel):
|
||||
((-270.0< rotation_zwischen< -90.0)and y < y_foerderer) or
|
||||
(rotation == -90.0 and x < x_foerderer) or ((rotation == -270.0)and x<x_foerderer)):
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
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"]))
|
||||
winkel_VP_offset_vorne = (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))
|
||||
else:
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_vorne_plusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_hinten =block_methoden.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"]))
|
||||
winkel_VP_offset_hinten = (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:
|
||||
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)
|
||||
att_kurve = block_methoden.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"]))
|
||||
@@ -376,12 +378,12 @@ class VarioFoerderer(BaseModel):
|
||||
# Den Motorstaton und Umlenkstation auf die richtige position in block einfügen falls nötig
|
||||
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
|
||||
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
|
||||
plant2dxf.import_block(block_Vario_Motorstation_500mm, lib_doc, doc)
|
||||
plant2dxf.import_block(block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
||||
layer_motor, color_motor = plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Motorstation_500mm)
|
||||
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))
|
||||
block_methoden.import_block(block_Vario_Motorstation_500mm, lib_doc, doc)
|
||||
block_methoden.import_block(block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
||||
layer_motor, color_motor = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Motorstation_500mm)
|
||||
layer_umlenk, color_umlenk = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Umlenkstation_500mm)
|
||||
block_Vario_Motorstation_500mm = block_methoden.dreh_block(block_Vario_Motorstation_500mm,doc,lib_doc,math.radians(winkel_motor))
|
||||
block_Vario_Umlenkstation_500mm = block_methoden.dreh_block( block_Vario_Umlenkstation_500mm, doc,lib_doc,math.radians(winkel_umlenk))
|
||||
if umlenk_vorhanden == True:
|
||||
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, "layer":layer_umlenk,"color": color_umlenk})
|
||||
ende = (ende[0] ,ende[1] + umlenk_offset_x,ende[2] - umlenk_offset_z)
|
||||
@@ -395,12 +397,12 @@ class VarioFoerderer(BaseModel):
|
||||
block_Vario_Bogen_auf = (f"Vario_Bogen_auf_{winkel_plus}°")
|
||||
block_Vario_Bogen_ab = (f"Vario_Bogen_ab_{winkel_plus}°")
|
||||
|
||||
auf_attrib =plant2dxf.import_block(block_Vario_Bogen_auf, lib_doc, doc)
|
||||
ab_attrib =plant2dxf.import_block(block_Vario_Bogen_ab, lib_doc, doc)
|
||||
layer_auf,color_auf = plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Bogen_auf)
|
||||
layer_ab,color_ab =plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Bogen_ab)
|
||||
block_Vario_Bogen_auf = plant2dxf.dreh_block(block_Vario_Bogen_auf, doc,lib_doc,math.radians(winkel_core))
|
||||
block_Vario_Bogen_ab = plant2dxf.dreh_block(block_Vario_Bogen_ab, doc,lib_doc,math.radians(-winkel))
|
||||
auf_attrib =block_methoden.import_block(block_Vario_Bogen_auf, lib_doc, doc)
|
||||
ab_attrib =block_methoden.import_block(block_Vario_Bogen_ab, lib_doc, doc)
|
||||
layer_auf,color_auf = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Bogen_auf)
|
||||
layer_ab,color_ab =block_methoden.get_insert_color_layer(lib_doc,block_Vario_Bogen_ab)
|
||||
block_Vario_Bogen_auf = block_methoden.dreh_block(block_Vario_Bogen_auf, doc,lib_doc,math.radians(winkel_core))
|
||||
block_Vario_Bogen_ab = block_methoden.dreh_block(block_Vario_Bogen_ab, doc,lib_doc,math.radians(-winkel))
|
||||
|
||||
|
||||
Vario_Bogen_auf_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_attrib["DELTA_SP_0"]))
|
||||
@@ -538,12 +540,12 @@ class VarioFoerderer(BaseModel):
|
||||
# Importieren und setzen der UMlenkungstation oder Motorstation falls nötig
|
||||
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
|
||||
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
|
||||
plant2dxf.import_block( block_Vario_Motorstation_500mm, lib_doc, doc)
|
||||
plant2dxf.import_block( block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
||||
layer_motor, color_motor = plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Motorstation_500mm)
|
||||
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))
|
||||
block_methoden.import_block( block_Vario_Motorstation_500mm, lib_doc, doc)
|
||||
block_methoden.import_block( block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
||||
layer_motor, color_motor = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Motorstation_500mm)
|
||||
layer_umlenk, color_umlenk = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Umlenkstation_500mm)
|
||||
block_Vario_Motorstation_500mm = block_methoden.dreh_block( block_Vario_Motorstation_500mm, doc,lib_doc,math.radians(winkel_motor))
|
||||
block_Vario_Umlenkstation_500mm = block_methoden.dreh_block( block_Vario_Umlenkstation_500mm , doc,lib_doc,math.radians(winkel_umlenk))
|
||||
if umlenk_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
|
||||
@@ -562,12 +564,12 @@ class VarioFoerderer(BaseModel):
|
||||
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 =plant2dxf.import_block( block_Vario_Bogen_ab , lib_doc, doc)
|
||||
auf_attrib =plant2dxf.import_block( block_Vario_Bogen_auf, lib_doc, doc)
|
||||
layer_auf,color_auf = plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Bogen_auf)
|
||||
layer_ab,color_ab =plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Bogen_ab)
|
||||
block_Vario_Bogen_ab = plant2dxf.dreh_block( block_Vario_Bogen_ab, doc,lib_doc, math.radians(winkel_core))
|
||||
block_Vario_Bogen_auf= plant2dxf.dreh_block( block_Vario_Bogen_auf, doc,lib_doc, math.radians(winkel))
|
||||
ab_attrib =block_methoden.import_block( block_Vario_Bogen_ab , lib_doc, doc)
|
||||
auf_attrib =block_methoden.import_block( block_Vario_Bogen_auf, lib_doc, doc)
|
||||
layer_auf,color_auf = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Bogen_auf)
|
||||
layer_ab,color_ab =block_methoden.get_insert_color_layer(lib_doc,block_Vario_Bogen_ab)
|
||||
block_Vario_Bogen_ab = block_methoden.dreh_block( block_Vario_Bogen_ab, doc,lib_doc, math.radians(winkel_core))
|
||||
block_Vario_Bogen_auf= block_methoden.dreh_block( block_Vario_Bogen_auf, doc,lib_doc, math.radians(winkel))
|
||||
Vario_Bogen_auf_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_attrib["DELTA_SP_0"]))
|
||||
Vario_Bogen_auf_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_SP_1"]))
|
||||
Vario_Bogen_ab_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_0"]))
|
||||
|
||||
Reference in New Issue
Block a user