Update test dxf, refactorn von direkt am Kreisel bei Vario Förderer

This commit is contained in:
2026-01-20 08:52:34 +01:00
parent 202334570e
commit edfb75778e
11 changed files with 442731 additions and 385150 deletions
+30
View File
@@ -0,0 +1,30 @@
from pydantic import BaseModel, Field, field_validator
from typing import Optional
class Eckrad(BaseModel):
teileid: str
drehung: Optional [float] = Field(default=0.0,description="Rotation des Elements")
hoehe: Optional [float] = Field(default=0.0,description="Hoehe des Elements")
drehrichtung: Optional [str] =Field(default=None,description="Richtung des Eckrads")
@classmethod
def from_merkmale(cls, teileid: str, x: float, y: float, merkmale: dict) -> 'Eckrad':
try:
hoehe = float(merkmale.get("Höhe in Meter")) * 1000
except Exception as e:
hoehe = 0.0
try:
drehung = float(merkmale.get("Drehung"))
except Exception as e:
drehung = 0.0
try:
drehrichtung = merkmale.get("Drehrichtung")
except Exception as e:
drehrichtung = None
return cls(
teileid = teileid,
x = x,
y = y,
hoehe = hoehe,
drehung = drehung
)
+75 -1
View File
@@ -305,6 +305,79 @@ class VarioFoerderer(BaseModel):
winkel_VP_offset_vorne = (SP_1_nachbar[0] -VP_1_nachbar[0] ),0,( SP_1_nachbar[2]- VP_1_nachbar[2])
return winkel_VP_offset_vorne,winkel_VP_offset_hinten
def vario_verbuden_am_kreisel(foerderer, block_vario, start, ende, mit_horizontal_verbunden = None,kreisel_verbunden = None,am_kreisel = None,erster_kreisel_höher = None):
lower_hoehe_vario = foerderer.h0
upper_hoehe_vario = foerderer.h1
voerder_richtung = foerderer.foerderer_richtung
hoehe_vario = foerderer.hight_zwischen
x = foerderer.x
y = foerderer.y
if (kreisel_verbunden == 2 or (am_kreisel == 1 and erster_kreisel_höher == True)or (am_kreisel == 2 and erster_kreisel_höher == False))and voerder_richtung != "Horizontal":
l = (start[0],start[1],upper_hoehe_vario)
# Eine 500 mm gefällestrecke an anfang und am ende reintuen
if voerder_richtung =="Auf":
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario +500* math.sin(math.radians(3)))
start = m
elif voerder_richtung == "Ab":
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario -500* math.sin(math.radians(3)))
start = m
else:
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario )
start = m
if kreisel_verbunden == 1:
z1 = m[2]
y1 = start[1]
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)
if (kreisel_verbunden == 2 or (am_kreisel == 1 and erster_kreisel_höher == False)or (am_kreisel == 2 and erster_kreisel_höher == True)) and voerder_richtung != "Horizontal":
l = (ende[0],ende[1],lower_hoehe_vario)
if voerder_richtung =="Auf":
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario - 500* math.sin(math.radians(3)))
ende = m
elif voerder_richtung == "Ab":
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario + 500* math.sin(math.radians(3)))
ende = m
else:
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)
if kreisel_verbunden == 1:
z1 = m[2]
y1 = ende[1]
elif voerder_richtung == "Horizontal":
if mit_horizontal_verbunden == "oben_drehung_0_or_-90" or mit_horizontal_verbunden == "unten_drehung_-180_or_-270":
l = (start[0],start[1],upper_hoehe_vario)
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario)
start = 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)
else:
end = (ende[0],ende[1],lower_hoehe_vario)
en = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario )
ende = en
line = Line.new(dxfattribs={"start": end,"end":en })
line.dxf.layer = "6-SP"
copy= line.copy()
copy.translate(-x,-y,-hoehe_vario)
block_vario.add_entity(copy)
if kreisel_verbunden == 1 and mit_horizontal_verbunden == None:
return y1,z1
else:
return start, ende
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"))
@@ -663,4 +736,5 @@ class VarioFoerderer(BaseModel):
block_links.add_entity(clone)
else:
clone.transform(matrix)
block_links.add_entity(clone)
block_links.add_entity(clone)