Refoctoring
This commit is contained in:
@@ -0,0 +1,238 @@
|
|||||||
|
|
||||||
|
from ezdxf.entities import Line
|
||||||
|
import math
|
||||||
|
from pydantic import BaseModel, Field, field_validator
|
||||||
|
from typing import Optional
|
||||||
|
from plant2dxf import import_block, get_layer
|
||||||
|
|
||||||
|
|
||||||
|
ATTR_TAG = "TeileId" # Attributtag im Block
|
||||||
|
RADIUS = 400 # Radius der Kreiselkreise (mm)
|
||||||
|
|
||||||
|
class Kreisel(BaseModel):
|
||||||
|
"""Pydantic-Modell für Kreisel-Komponenten."""
|
||||||
|
teileid: str
|
||||||
|
x: float = Field(description="X-Koordinate des Kreisel-Zentrums")
|
||||||
|
y: float = Field(description="Y-Koordinate des Kreisel-Zentrums")
|
||||||
|
hoehe: float = Field(description="Höhe in mm")
|
||||||
|
drehung: float = Field(default=0.0, description="Drehung/Winkel in Grad")
|
||||||
|
drehrichtung: Optional[str] = Field(default=None, description="Drehrichtung: UZS oder GUZS")
|
||||||
|
abstand: float = Field(default=20000.0, description="Abstand zwischen Kreiselachsen in mm")
|
||||||
|
kreiselart: Optional[str] = Field(default=None, description="Kreiselart, z.B. 'Pin'")
|
||||||
|
anzahl_scanner: float = Field(default=0.0, description="Anzahl der Scanner")
|
||||||
|
anzahl_separatoren: float = Field(default=0.0, description="Anzahl der Separatoren")
|
||||||
|
|
||||||
|
@field_validator('abstand')
|
||||||
|
@classmethod
|
||||||
|
def validate_abstand(cls, v):
|
||||||
|
"""Konvertiert Abstand von Meter zu mm, falls nötig."""
|
||||||
|
if isinstance(v, str):
|
||||||
|
v = v.replace(",", ".")
|
||||||
|
try:
|
||||||
|
v = float(v) * 1000 # Meter → mm
|
||||||
|
except ValueError:
|
||||||
|
v = 10000.0 # Fallback 10 m
|
||||||
|
return v
|
||||||
|
|
||||||
|
@field_validator('hoehe')
|
||||||
|
@classmethod
|
||||||
|
def validate_hoehe(cls, v):
|
||||||
|
"""Konvertiert Höhe von Meter zu mm, falls nötig."""
|
||||||
|
if isinstance(v, str):
|
||||||
|
v = v.replace(",", ".")
|
||||||
|
try:
|
||||||
|
v = float(v) * 1000 # Meter → mm
|
||||||
|
except ValueError:
|
||||||
|
v = 0.0
|
||||||
|
return v
|
||||||
|
|
||||||
|
@property
|
||||||
|
def halbabstand(self) -> float:
|
||||||
|
"""Halbabstand zwischen den beiden Blöcken."""
|
||||||
|
return self.abstand / 2
|
||||||
|
|
||||||
|
@property
|
||||||
|
def winkel_rad(self) -> float:
|
||||||
|
"""Winkel in Radianten für Berechnungen."""
|
||||||
|
if self.drehung == 270 or self.drehung == 90:
|
||||||
|
return math.radians(self.drehung)
|
||||||
|
else:
|
||||||
|
return math.radians(self.drehung - 180)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def richtung_rad(self) -> float:
|
||||||
|
"""Richtung in Radianten (für am_kreisel_direct_verbunden)."""
|
||||||
|
# Wird aus drehung abgeleitet oder separat gesetzt
|
||||||
|
return math.radians(self.drehung)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def pos1(self) -> tuple[float, float, float]:
|
||||||
|
"""Position des ersten Blocks (x, y, z)."""
|
||||||
|
dx = self.halbabstand * math.cos(self.winkel_rad)
|
||||||
|
dy = self.halbabstand * math.sin(self.winkel_rad)
|
||||||
|
return (self.x - dx, self.y - dy, self.hoehe)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def pos2(self) -> tuple[float, float, float]:
|
||||||
|
"""Position des zweiten Blocks (x, y, z)."""
|
||||||
|
dx = self.halbabstand * math.cos(self.winkel_rad)
|
||||||
|
dy = self.halbabstand * math.sin(self.winkel_rad)
|
||||||
|
return (self.x + dx, self.y + dy, self.hoehe)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def z(self) -> float:
|
||||||
|
"""Z-Koordinate (gleich der Höhe)."""
|
||||||
|
return self.hoehe
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_merkmale(cls, teileid: str, x: float, y: float, merkmale: dict) -> 'Kreisel':
|
||||||
|
"""Erstellt ein Kreisel-Objekt aus einem merkmale-Dictionary."""
|
||||||
|
hoehe_m = merkmale.get("Höhe in m", "0").replace(",", ".")
|
||||||
|
try:
|
||||||
|
hoehe = float(hoehe_m) * 1000
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
hoehe = 0.0
|
||||||
|
|
||||||
|
abstand_m = merkmale.get("Abstand (Kreiselachse A - Kreiselachse) in Meter", "20").replace(",", ".")
|
||||||
|
try:
|
||||||
|
abstand = float(abstand_m) * 1000
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
abstand = 10000.0
|
||||||
|
|
||||||
|
try:
|
||||||
|
drehung = float(merkmale.get("Drehung", "0"))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
drehung = 0.0
|
||||||
|
|
||||||
|
try:
|
||||||
|
anzahl_scanner = float(merkmale.get("Anzahl der Scanner", "0"))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
anzahl_scanner = 0.0
|
||||||
|
|
||||||
|
try:
|
||||||
|
anzahl_separatoren = float(merkmale.get("Anzahl der Separatoren", "0"))
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
anzahl_separatoren = 0.0
|
||||||
|
|
||||||
|
return cls(
|
||||||
|
teileid=teileid,
|
||||||
|
x=x,
|
||||||
|
y=y,
|
||||||
|
hoehe=hoehe,
|
||||||
|
drehung=drehung,
|
||||||
|
drehrichtung=merkmale.get("Drehrichtung"),
|
||||||
|
abstand=abstand,
|
||||||
|
kreiselart=merkmale.get("Kreiselart"),
|
||||||
|
anzahl_scanner=anzahl_scanner,
|
||||||
|
anzahl_separatoren=anzahl_separatoren
|
||||||
|
)
|
||||||
|
|
||||||
|
def draw_kreisel_lines(msp, pos1, pos2, kreisel):
|
||||||
|
"""Zeichnet tangentiale Linien zwischen zwei Kreiselblöcken, unabhängig vom Winkel."""
|
||||||
|
rotation = kreisel.drehung
|
||||||
|
x1, y1, z1 = pos1
|
||||||
|
x2, y2, z1 = pos2
|
||||||
|
# Verbindungsvektor
|
||||||
|
dx = x2 - x1
|
||||||
|
dy = y2 - y1
|
||||||
|
# Länge
|
||||||
|
length = math.hypot(dx, dy)
|
||||||
|
if length == 0:
|
||||||
|
return # keine Linie bei identischen Punkten
|
||||||
|
# Normalenvektor (senkrecht, normiert, Länge = RADIUS)
|
||||||
|
|
||||||
|
nx = -dy / length * RADIUS
|
||||||
|
ny = dx / length * RADIUS
|
||||||
|
# Tangentialpunkte
|
||||||
|
p1a = (x1 + nx, y1 + ny,z1)
|
||||||
|
p1b = (x1 - nx, y1 - ny,z1)
|
||||||
|
p2a = (x2 + nx, y2 + ny,z1)
|
||||||
|
p2b = (x2 - nx, y2 - ny,z1)
|
||||||
|
if kreisel.kreiselart == "Pin":
|
||||||
|
if rotation == 0.0:
|
||||||
|
p1a2 = p1a[0] - RADIUS - 50, p1a[1] + 50, z1
|
||||||
|
p1b2 = p1b[0] - RADIUS - 50, p1b[1] - 50, z1
|
||||||
|
p2a2 = p2a[0] + RADIUS + 50, p2a[1] + 50, z1
|
||||||
|
p2b2 = p2b[0] + RADIUS + 50, p2b[1] - 50, z1
|
||||||
|
Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"})
|
||||||
|
Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"})
|
||||||
|
msp.add_entity(Line1)
|
||||||
|
msp.add_entity(Line2)
|
||||||
|
elif rotation == 180.0:
|
||||||
|
p1a2 = p1a[0] + RADIUS + 50, p1a[1] - 50, z1
|
||||||
|
p1b2 = p1b[0] + RADIUS + 50, p1b[1] + 50, z1
|
||||||
|
p2a2 = p2a[0] - RADIUS - 50, p2a[1] - 50, z1
|
||||||
|
p2b2 = p2b[0] - RADIUS - 50, p2b[1] + 50, z1
|
||||||
|
Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"})
|
||||||
|
Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"})
|
||||||
|
msp.add_entity(Line1)
|
||||||
|
msp.add_entity(Line2)
|
||||||
|
elif rotation == 90.0:
|
||||||
|
p1a2 = p1a[0] + 50, p1a[1] - 50 + RADIUS , z1
|
||||||
|
p1b2 = p1b[0] - 50, p1b[1] - 50 + RADIUS, z1
|
||||||
|
p2a2 = p2a[0] + 50, p2a[1] + 50 - RADIUS, z1
|
||||||
|
p2b2 = p2b[0] - 50, p2b[1] + 50 - RADIUS, z1
|
||||||
|
Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"})
|
||||||
|
Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"})
|
||||||
|
msp.add_entity(Line1)
|
||||||
|
msp.add_entity(Line2)
|
||||||
|
elif rotation == 270.0:
|
||||||
|
p1a2 = p1a[0] - 50, p1a[1] + 50 - RADIUS , z1
|
||||||
|
p1b2 = p1b[0] + 50, p1b[1] + 50 - RADIUS, z1
|
||||||
|
p2a2 = p2a[0] - 50, p2a[1] - 50 + RADIUS, z1
|
||||||
|
p2b2 = p2b[0] + 50, p2b[1] - 50 + RADIUS, z1
|
||||||
|
Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"})
|
||||||
|
Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"})
|
||||||
|
msp.add_entity(Line1)
|
||||||
|
msp.add_entity(Line2)
|
||||||
|
|
||||||
|
# Linien zeichnen
|
||||||
|
msp.add_line(p1a, p2a)
|
||||||
|
msp.add_line(p1b, p2b)
|
||||||
|
|
||||||
|
def draw_kreisel_drehrichtung_markierung(msp, pos1, pos2, kreisel, lib_doc, doc, verbose):
|
||||||
|
drehrichtung = (kreisel.drehrichtung or "").upper()
|
||||||
|
if drehrichtung not in ("UZS", "GUZS"):
|
||||||
|
return
|
||||||
|
x1, y1,z1= pos1
|
||||||
|
x2, y2,z2 = pos2
|
||||||
|
dx = x2 - x1
|
||||||
|
dy = y2 - y1
|
||||||
|
length = math.hypot(dx, dy)
|
||||||
|
if length == 0:
|
||||||
|
return
|
||||||
|
# Normalenvektor (senkrecht, normiert, Länge = RADIUS)
|
||||||
|
nx = -dy / length * RADIUS
|
||||||
|
ny = dx / length * RADIUS
|
||||||
|
# Obere Linie
|
||||||
|
p1_oben = (x1 + nx, y1 + ny)
|
||||||
|
p2_oben = (x2 + nx, y2 + ny)
|
||||||
|
# Untere Linie
|
||||||
|
p1_unten = (x1 - nx, y1 - ny)
|
||||||
|
p2_unten = (x2 - nx, y2 - ny)
|
||||||
|
# S-LP auf oberer Linie (Drehrichtung wie angegeben)
|
||||||
|
for i in range(1, 4):
|
||||||
|
t = i / 4 # 1/4, 2/4, 3/4
|
||||||
|
px = p1_oben[0] + t * (p2_oben[0] - p1_oben[0])
|
||||||
|
py = p1_oben[1] + t * (p2_oben[1] - p1_oben[1])
|
||||||
|
rotation = math.degrees(math.atan2(p2_oben[1] - p1_oben[1], p2_oben[0] - p1_oben[0]))
|
||||||
|
if drehrichtung == "GUZS":
|
||||||
|
rotation += 180
|
||||||
|
import_block("Richtungspfeil", lib_doc, doc)
|
||||||
|
blockref_layer = get_layer(doc, 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}")
|
||||||
|
# S-LP auf unterer Linie (Drehrichtung invertiert)
|
||||||
|
for i in range(1, 4):
|
||||||
|
t = i / 4
|
||||||
|
px = p1_unten[0] + t * (p2_unten[0] - p1_unten[0])
|
||||||
|
py = p1_unten[1] + t * (p2_unten[1] - p1_unten[1])
|
||||||
|
rotation = math.degrees(math.atan2(p2_unten[1] - p1_unten[1], p2_unten[0] - p1_unten[0]))
|
||||||
|
if drehrichtung == "UZS":
|
||||||
|
rotation += 180
|
||||||
|
import_block("Richtungspfeil", lib_doc, doc)
|
||||||
|
blockref_layer = get_layer(doc, 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}")
|
||||||
@@ -0,0 +1,457 @@
|
|||||||
|
from ezdxf.entities import Line
|
||||||
|
import math
|
||||||
|
from pydantic import BaseModel, Field, field_validator
|
||||||
|
from typing import Optional
|
||||||
|
import plant2dxf
|
||||||
|
from ezdxf.math import Matrix44
|
||||||
|
import re
|
||||||
|
|
||||||
|
class VarioFoerderer(BaseModel):
|
||||||
|
teileid: str
|
||||||
|
x: float = Field(description="X-Koordinate des Foerder-Zentrums")
|
||||||
|
y: float = Field(description="Y-Koordinate des Foerder-Zentrums")
|
||||||
|
laenge:float = Field(description = "Länge des Förderers")
|
||||||
|
winkel: float = Field(description = "Winkel des Färderers")
|
||||||
|
h0: float = Field(description="Höhe Anfang in Merkmale")
|
||||||
|
h1: float = Field(description="Höhe Ende in Merkmale")
|
||||||
|
hat_motor: bool = Field(description="Überprüft ob der Vörderer ein Motor hat")
|
||||||
|
hat_umlenk: bool = Field(description="Überprüft ob der Vörderer eine Umlenkstation hat")
|
||||||
|
drehung: float = Field(default=0.0, description="Drehung/Winkel in Grad")
|
||||||
|
foerderer_richtung : str= Field(description="In welche richtung geförderd wird")
|
||||||
|
gefaelle_laenge: Optional [float] = Field(default=0.0,description="Länge der zusätzlichen Gefälle Strecke falls vorhanden")
|
||||||
|
gefaelle_winkel: Optional [float] = Field(default=0.0,description="Winkel der Gefällestrecke, falls diese Vorhanden ist")
|
||||||
|
anzahl_scanner: int = Field(default=0, description="Anzahl der Scanner")
|
||||||
|
anzahl_separatoren: int = Field(default=0, description="Anzahl der Separatoren")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def hight_zwischen(self):
|
||||||
|
return ((self.h0 + self.h1) /2)
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def from_merkmale(cls, teileid: str, x: float, y: float, merkmale: dict) -> 'VarioFoerderer':
|
||||||
|
|
||||||
|
h0 = float(merkmale.get("Höhe Anfang")) * 1000
|
||||||
|
h1 = float(merkmale.get("Höhe Ende")) * 1000
|
||||||
|
laenge = float(merkmale.get("Länge in Meter")) * 1000
|
||||||
|
gefaelle_laenge = merkmale.get("Laenge_Gefaellestrecke")
|
||||||
|
if gefaelle_laenge == None:
|
||||||
|
gefaelle_laenge = 0.0
|
||||||
|
gefaelle_winkel = 0.0
|
||||||
|
else:
|
||||||
|
gefaelle_laenge = float(gefaelle_laenge)
|
||||||
|
gefaelle_winkel = float(merkmale.get("Winkel_Gefaellestrecke")),
|
||||||
|
return cls(
|
||||||
|
teileid = teileid,
|
||||||
|
laenge = laenge,
|
||||||
|
x = x,
|
||||||
|
y = y,
|
||||||
|
|
||||||
|
foerderer_richtung =merkmale.get("Förderrichtung"),
|
||||||
|
winkel = float(merkmale.get("Winkel")),
|
||||||
|
hat_motor = bool(merkmale.get("hatMotor")),
|
||||||
|
hat_umlenk = bool(merkmale.get("hatUmlenkung")),
|
||||||
|
h0 = h0,
|
||||||
|
h1 =h1,
|
||||||
|
drehung = float(merkmale.get("Drehung")),
|
||||||
|
gefaelle_laenge = gefaelle_laenge,
|
||||||
|
gefalle_winkel = gefaelle_winkel,
|
||||||
|
anzahl_scanner = int(merkmale.get("Anzahl der Scanner")),
|
||||||
|
anzahl_separatoren = int(merkmale.get("Anzahl der Separatoren"))
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
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"))
|
||||||
|
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 = foerderer.hat_motor
|
||||||
|
umlenk_vorhanden = foerderer.hat_umlenk
|
||||||
|
gefahellewinkel =foerderer.gefaelle_winkel
|
||||||
|
gefaelle = foerderer.gefaelle_laenge
|
||||||
|
x = foerderer.x
|
||||||
|
y = foerderer.y
|
||||||
|
hoehe_vario = foerderer.hight_zwischen
|
||||||
|
winkel = int(foerderer.winkel)
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
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 - motor_offset_x
|
||||||
|
if umlenk_vorhanden == True:
|
||||||
|
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":
|
||||||
|
# erstellung des gefälles falls es nicht null ist (also keins angegeben ist oder es durch andere Sachen wie Motor ersetzt wird)
|
||||||
|
if gefaelle > 0:
|
||||||
|
# Setzng die hälfte des Gefälles auf beide seiten falls dieser nicht mit einem anderen Förder verbunden ist was durch die abwesenheit eines motors/umlenkung gezeigt wird
|
||||||
|
halbesgefaelle = gefaelle/2
|
||||||
|
if motor_vorhanden == True and umlenk_vorhanden == True:
|
||||||
|
halbesgefaelle = gefaelle/2
|
||||||
|
gefaelle_ende = ende[0], ende[1] +halbesgefaelle, ende[2] -math.sin(math.radians(gefahellewinkel))* halbesgefaelle
|
||||||
|
line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
|
||||||
|
line_ende_gefaelle.dxf.layer = "6-SP"
|
||||||
|
copy_ende = line_ende_gefaelle.copy()
|
||||||
|
copy_ende.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_ende)
|
||||||
|
ende = gefaelle_ende
|
||||||
|
|
||||||
|
gefaelle_start = start[0], start[1] -halbesgefaelle, start[2] +math.sin(math.radians(gefahellewinkel)) * halbesgefaelle
|
||||||
|
line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
|
||||||
|
line_start_gefaelle.dxf.layer = "6-SP"
|
||||||
|
copy_start = line_start_gefaelle.copy()
|
||||||
|
copy_start.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_start)
|
||||||
|
start = gefaelle_start
|
||||||
|
|
||||||
|
elif motor_vorhanden== True:
|
||||||
|
gefaelle_start = start[0], start[1] -gefaelle, start[2] +math.sin(math.radians(gefahellewinkel)) * gefaelle
|
||||||
|
line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
|
||||||
|
line_start_gefaelle.dxf.layer = "6-SP"
|
||||||
|
copy_start = line_start_gefaelle.copy()
|
||||||
|
copy_start.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_start)
|
||||||
|
start = gefaelle_start
|
||||||
|
|
||||||
|
elif umlenk_vorhanden== True:
|
||||||
|
gefaelle_ende = ende[0], ende[1] +gefaelle, ende[2] -math.sin(math.radians(gefahellewinkel))* gefaelle
|
||||||
|
line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
|
||||||
|
line_ende_gefaelle.dxf.layer = "6-SP"
|
||||||
|
copy_ende = line_ende_gefaelle.copy()
|
||||||
|
copy_ende.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_ende)
|
||||||
|
ende = gefaelle_ende
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
block_Vario_Motorstation_500mm = plant2dxf.dreh_block(block_Vario_Motorstation_500mm,doc,math.radians(winkel_motor))
|
||||||
|
block_Vario_Umlenkstation_500mm = plant2dxf.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_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] - 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 = winkel + winkel_core
|
||||||
|
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)
|
||||||
|
block_Vario_Bogen_auf = plant2dxf.dreh_block(block_Vario_Bogen_auf, doc,math.radians(winkel_core))
|
||||||
|
block_Vario_Bogen_ab = plant2dxf.dreh_block(block_Vario_Bogen_ab, 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"]))
|
||||||
|
Vario_Bogen_ab_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_1"]))
|
||||||
|
Vario_Bogen_auf_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_VP_1"]))
|
||||||
|
Vario_Bogen_ab_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_VP_0"]))
|
||||||
|
|
||||||
|
Vario_Bogen_auf_Delta_SP_0 = [Vario_Bogen_auf_Delta_SP_0 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_SP_0[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_auf_Delta_SP_0[1],-Vario_Bogen_auf_Delta_SP_0[0] * math.sin(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_SP_0[2] * math.cos(math.radians(winkel_core)) ]
|
||||||
|
Vario_Bogen_auf_Delta_SP_1 = [Vario_Bogen_auf_Delta_SP_1 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_SP_1[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_auf_Delta_SP_1[1],-Vario_Bogen_auf_Delta_SP_1[0] * math.sin(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_SP_1[2] * math.cos(math.radians(winkel_core)) ]
|
||||||
|
Vario_Bogen_ab_Delta_SP_0 = [Vario_Bogen_ab_Delta_SP_0 [0] * math.cos(math.radians(-winkel))+ Vario_Bogen_ab_Delta_SP_0[2]* math.sin(math.radians(-winkel)) ,Vario_Bogen_ab_Delta_SP_0[1],-Vario_Bogen_ab_Delta_SP_0[0] * math.sin(math.radians(-winkel))+ Vario_Bogen_ab_Delta_SP_0[2] * math.cos(math.radians(-winkel)) ]
|
||||||
|
Vario_Bogen_ab_Delta_SP_1 =[ Vario_Bogen_ab_Delta_SP_1 [0] * math.cos(math.radians(-winkel))+ Vario_Bogen_ab_Delta_SP_1[2]* math.sin(math.radians(-winkel)) ,Vario_Bogen_ab_Delta_SP_1[1],-Vario_Bogen_ab_Delta_SP_1[0] * math.sin(math.radians(-winkel))+ Vario_Bogen_ab_Delta_SP_1[2] * math.cos(math.radians(-winkel)) ]
|
||||||
|
Vario_Bogen_auf_Delta_VP_1 = [Vario_Bogen_auf_Delta_VP_1 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_VP_1[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_auf_Delta_VP_1[1],-Vario_Bogen_auf_Delta_VP_1[0] * math.sin(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_VP_1[2] * math.cos(math.radians(winkel_core)) ]
|
||||||
|
Vario_Bogen_ab_Delta_VP_0 = [Vario_Bogen_ab_Delta_VP_0 [0] * math.cos(math.radians(-winkel))+ Vario_Bogen_ab_Delta_VP_0[2]* math.sin(math.radians(-winkel)) ,Vario_Bogen_ab_Delta_VP_0[1],-Vario_Bogen_ab_Delta_VP_0[0] * math.sin(math.radians(-winkel))+ Vario_Bogen_ab_Delta_VP_0[2] * math.cos(math.radians(-winkel)) ]
|
||||||
|
|
||||||
|
# negative Zahlen für x und y positive setzen, damit man weniger nachdenken muss (theoretisch ist SP0 x immer negative und SP1 immer positive aber dies vereinfacht die konsistenz der Werte wann ich was addieren oder subtrahieren muss)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_0):
|
||||||
|
if i< 2 and wert < 0:
|
||||||
|
Vario_Bogen_auf_Delta_SP_0[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_1):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_auf_Delta_SP_1[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_0):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_ab_Delta_SP_0[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_1):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_ab_Delta_SP_1[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_auf_Delta_VP_1):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_auf_Delta_VP_1[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_ab_Delta_VP_0):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_ab_Delta_VP_0[i] = abs(wert)
|
||||||
|
|
||||||
|
#einfügen des auf blockes und veränderund der ende Punktes dementsprechend und erstellung von endeVP für die VARIO linie
|
||||||
|
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_vario ),dxfattribs={"rotation": 90})
|
||||||
|
ende_VP = (ende[0] +Vario_Bogen_auf_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_Delta_VP_1[0]+Vario_Bogen_auf_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_Delta_VP_1[2]- Vario_Bogen_auf_Delta_SP_0[2])
|
||||||
|
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_Delta_SP_1[0] + Vario_Bogen_auf_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_Delta_SP_1[2] - Vario_Bogen_auf_Delta_SP_0[2])
|
||||||
|
#einfügen des auf blockes und veränderund der start Punktes dementsprechend und erstellung von startVP für die VARIO linie
|
||||||
|
block.add_blockref(block_Vario_Bogen_ab ,(start[0]-x,start[1] - Vario_Bogen_ab_Delta_SP_1[0] -y ,start[2] - hoehe_vario-Vario_Bogen_ab_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
||||||
|
|
||||||
|
start_VP = start[0] +Vario_Bogen_ab_Delta_VP_0[1],start[1]-Vario_Bogen_ab_Delta_VP_0[0] - Vario_Bogen_ab_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_Delta_VP_0[2] - Vario_Bogen_ab_Delta_SP_1[2]
|
||||||
|
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_1[2]+ Vario_Bogen_ab_Delta_SP_0[2]
|
||||||
|
|
||||||
|
# Erstellung der VARIO Line
|
||||||
|
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||||||
|
line_VP.dxf.layer = "VARIO"
|
||||||
|
copy_VP = line_VP.copy()
|
||||||
|
|
||||||
|
copy_VP.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_VP)
|
||||||
|
# Erstellung der zwischen Line
|
||||||
|
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||||||
|
line.dxf.layer = "6-SP"
|
||||||
|
|
||||||
|
copy= line.copy()
|
||||||
|
|
||||||
|
copy.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy)
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Einfügen der 3 grad Bogen und deren notwendigen Werten von den attributen des bogens in den block
|
||||||
|
|
||||||
|
block_Vario_Bogen_auf_3 = str(config.get("ILS 2.0 Variofoerderer_Bogen_block_namen","bogen_3_auf"))
|
||||||
|
block_Vario_Bogen_ab_3 = str(config.get("ILS 2.0 Variofoerderer_Bogen_block_namen","bogen_3_ab"))
|
||||||
|
auf_3_attrib =plant2dxf.import_block(block_Vario_Bogen_auf_3, lib_doc, doc)
|
||||||
|
ab_3_attrib = plant2dxf.import_block(block_Vario_Bogen_ab_3, lib_doc, doc)
|
||||||
|
block_Vario_Bogen_auf_3= plant2dxf.dreh_block(block_Vario_Bogen_auf_3, doc,math.radians(3))
|
||||||
|
block_Vario_Bogen_ab_3 = plant2dxf.dreh_block(block_Vario_Bogen_ab_3, doc,math.radians(0))
|
||||||
|
Vario_Bogen_auf_3_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_3_attrib["DELTA_SP_0"]))
|
||||||
|
Vario_Bogen_auf_3_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_3_attrib["DELTA_SP_1"]))
|
||||||
|
Vario_Bogen_ab_3_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_3_attrib["DELTA_SP_0"]))
|
||||||
|
Vario_Bogen_ab_3_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_3_attrib["DELTA_SP_1"]))
|
||||||
|
Vario_Bogen_auf_3_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_3_attrib["DELTA_VP_1"]))
|
||||||
|
Vario_Bogen_ab_3_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_3_attrib["DELTA_VP_0"]))
|
||||||
|
|
||||||
|
Vario_Bogen_auf_3_Delta_SP_0 = [Vario_Bogen_auf_3_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_3_Delta_SP_0[1],-Vario_Bogen_auf_3_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||||||
|
Vario_Bogen_auf_3_Delta_SP_1 = [Vario_Bogen_auf_3_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_3_Delta_SP_1[1],-Vario_Bogen_auf_3_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||||||
|
Vario_Bogen_ab_3_Delta_SP_0 = [Vario_Bogen_ab_3_Delta_SP_0 [0] ,Vario_Bogen_ab_3_Delta_SP_0[1],Vario_Bogen_ab_3_Delta_SP_0[2] ]
|
||||||
|
Vario_Bogen_ab_3_Delta_SP_1 =[ Vario_Bogen_ab_3_Delta_SP_1 [0] ,Vario_Bogen_ab_3_Delta_SP_1[1],Vario_Bogen_ab_3_Delta_SP_1[2] ]
|
||||||
|
Vario_Bogen_auf_3_Delta_VP_1 = [Vario_Bogen_auf_3_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_3_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_3_Delta_VP_1[1],-Vario_Bogen_auf_3_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_3_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||||||
|
Vario_Bogen_ab_3_Delta_VP_0 = [Vario_Bogen_ab_3_Delta_VP_0 [0],Vario_Bogen_ab_3_Delta_VP_0[1],Vario_Bogen_ab_3_Delta_VP_0[2] ]
|
||||||
|
|
||||||
|
# negative Zahlen für x und y positive setzen, damit man weniger nachdenken muss (theoretisch ist SP0 x immer negative und SP1 immer positive aber dies vereinfacht die konsistenz der Werte wann ich was addieren oder subtrahieren muss)
|
||||||
|
|
||||||
|
for i, wert in enumerate(Vario_Bogen_auf_3_Delta_SP_0):
|
||||||
|
if i< 2 and wert < 0:
|
||||||
|
Vario_Bogen_auf_3_Delta_SP_0[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_auf_3_Delta_SP_1):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_auf_3_Delta_SP_1[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_ab_3_Delta_SP_0):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_ab_3_Delta_SP_0[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_ab_3_Delta_SP_1):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_ab_3_Delta_SP_1[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_auf_3_Delta_VP_1):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_auf_3_Delta_VP_1[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_ab_3_Delta_VP_0):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_ab_3_Delta_VP_0[i] = abs(wert)
|
||||||
|
|
||||||
|
#einfügen des auf blockes und veränderund der ende Punktes dementsprechend und erstellung von endeVP für die VARIO linie
|
||||||
|
if motor_vorhanden == True:
|
||||||
|
block.add_blockref(block_Vario_Bogen_auf_3,(ende[0] -x ,ende[1] +Vario_Bogen_auf_3_Delta_SP_0[0] -y ,ende[2] - Vario_Bogen_auf_3_Delta_SP_0[2]- hoehe_vario ),dxfattribs={"rotation": 90})
|
||||||
|
ende_VP = (ende[0] +Vario_Bogen_auf_3_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_3_Delta_VP_1[0]+Vario_Bogen_auf_3_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_3_Delta_VP_1[2]- Vario_Bogen_auf_3_Delta_SP_0[2])
|
||||||
|
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_3_Delta_SP_1[0] + Vario_Bogen_auf_3_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_3_Delta_SP_1[2] - Vario_Bogen_auf_3_Delta_SP_0[2])
|
||||||
|
else:
|
||||||
|
ende_VP = ende[0] +Vario_Bogen_auf_3_Delta_VP_1[1] ,ende[1] , ende[2]
|
||||||
|
|
||||||
|
#einfügen des auf blockes und veränderund der start Punktes dementsprechend und erstellung von startVP für die VARIO linie
|
||||||
|
if umlenk_vorhanden == True:
|
||||||
|
block.add_blockref(block_Vario_Bogen_ab_3 ,(start[0]-x,start[1] - Vario_Bogen_ab_3_Delta_SP_1[0] -y ,start[2] - hoehe_vario - Vario_Bogen_ab_3_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
||||||
|
start_VP = start[0] +Vario_Bogen_ab_3_Delta_VP_0[1],start[1]-Vario_Bogen_ab_3_Delta_VP_0[0] - Vario_Bogen_ab_3_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_3_Delta_VP_0[2] - Vario_Bogen_ab_3_Delta_SP_1[2]
|
||||||
|
start = start[0] ,start[1] - Vario_Bogen_ab_3_Delta_SP_0[0] - Vario_Bogen_ab_3_Delta_SP_1[0],start[2] +Vario_Bogen_ab_3_Delta_SP_0[2] - Vario_Bogen_ab_3_Delta_SP_1[2]
|
||||||
|
else:
|
||||||
|
start_VP = start[0] +Vario_Bogen_ab_3_Delta_VP_0[1],start[1] , start[2]
|
||||||
|
# Erstellung der VARIO Line
|
||||||
|
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||||||
|
line_VP.dxf.layer = "VARIO"
|
||||||
|
copy_VP = line_VP.copy()
|
||||||
|
|
||||||
|
copy_VP.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_VP)
|
||||||
|
|
||||||
|
# Erstellung der zwischen Line
|
||||||
|
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||||||
|
line.dxf.layer = "6-SP"
|
||||||
|
|
||||||
|
copy= line.copy()
|
||||||
|
|
||||||
|
copy.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy)
|
||||||
|
|
||||||
|
elif voerder_richtung == "Ab":
|
||||||
|
# Setzng die hälfte des Gefälles auf beide seiten falls dieser nicht mit einem anderen Förder verbunden ist was durch die abwesenheit eines motors/umlenkung gezeigt wird
|
||||||
|
|
||||||
|
if gefaelle > 0:
|
||||||
|
if motor_vorhanden == True and umlenk_vorhanden == True:
|
||||||
|
halbesgefaelle = gefaelle/2
|
||||||
|
gefaelle_ende = ende[0], ende[1] +halbesgefaelle, ende[2] +math.sin(math.radians(gefahellewinkel))* halbesgefaelle
|
||||||
|
line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
|
||||||
|
line_ende_gefaelle.dxf.layer = "6-SP"
|
||||||
|
copy_ende = line_ende_gefaelle.copy()
|
||||||
|
copy_ende.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_ende)
|
||||||
|
ende = gefaelle_ende
|
||||||
|
|
||||||
|
gefaelle_start = start[0], start[1] -halbesgefaelle, start[2] -math.sin(math.radians(gefahellewinkel)) * halbesgefaelle
|
||||||
|
line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
|
||||||
|
line_start_gefaelle.dxf.layer = "6-SP"
|
||||||
|
copy_start = line_start_gefaelle.copy()
|
||||||
|
copy_start.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_start)
|
||||||
|
start = gefaelle_start
|
||||||
|
elif motor_vorhanden == True:
|
||||||
|
gefaelle_ende = ende[0], ende[1] +gefaelle, ende[2] +math.sin(math.radians(gefahellewinkel))* gefaelle
|
||||||
|
line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
|
||||||
|
line_ende_gefaelle.dxf.layer = "6-SP"
|
||||||
|
copy_ende = line_ende_gefaelle.copy()
|
||||||
|
copy_ende.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_ende)
|
||||||
|
ende = gefaelle_ende
|
||||||
|
elif umlenk_vorhanden == True:
|
||||||
|
gefaelle_start = start[0], start[1] -gefaelle, start[2] -math.sin(math.radians(gefahellewinkel)) * gefaelle
|
||||||
|
line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
|
||||||
|
line_start_gefaelle.dxf.layer = "6-SP"
|
||||||
|
copy_start = line_start_gefaelle.copy()
|
||||||
|
copy_start.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_start)
|
||||||
|
start = gefaelle_start
|
||||||
|
|
||||||
|
# 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)
|
||||||
|
block_Vario_Motorstation_500mm = plant2dxf.dreh_block( block_Vario_Motorstation_500mm, doc,math.radians(winkel_motor))
|
||||||
|
block_Vario_Umlenkstation_500mm = plant2dxf.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_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] - 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] + 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] + 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]
|
||||||
|
|
||||||
|
if winkel != 3:
|
||||||
|
winkel_core = int(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 =plant2dxf.import_block( block_Vario_Bogen_ab , lib_doc, doc)
|
||||||
|
auf_attrib =plant2dxf.import_block( block_Vario_Bogen_auf, lib_doc, doc)
|
||||||
|
block_Vario_Bogen_ab = plant2dxf.dreh_block( block_Vario_Bogen_ab, doc, math.radians(winkel_core))
|
||||||
|
block_Vario_Bogen_auf= plant2dxf.dreh_block( block_Vario_Bogen_auf, 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"]))
|
||||||
|
Vario_Bogen_ab_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_1"]))
|
||||||
|
Vario_Bogen_auf_Delta_VP_0 = list(float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_VP_0"]))
|
||||||
|
Vario_Bogen_ab_Delta_VP_1= list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_VP_1"]))
|
||||||
|
|
||||||
|
Vario_Bogen_auf_Delta_SP_0 = [Vario_Bogen_auf_Delta_SP_0 [0] * math.cos(math.radians(winkel))+ Vario_Bogen_auf_Delta_SP_0[2]* math.sin(math.radians(winkel)) ,Vario_Bogen_auf_Delta_SP_0[1],-Vario_Bogen_auf_Delta_SP_0[0] * math.sin(math.radians(winkel))+ Vario_Bogen_auf_Delta_SP_0[2] * math.cos(math.radians(winkel)) ]
|
||||||
|
Vario_Bogen_auf_Delta_SP_1 = [Vario_Bogen_auf_Delta_SP_1 [0] * math.cos(math.radians(winkel))+ Vario_Bogen_auf_Delta_SP_1[2]* math.sin(math.radians(winkel)) ,Vario_Bogen_auf_Delta_SP_1[1],-Vario_Bogen_auf_Delta_SP_1[0] * math.sin(math.radians(winkel))+ Vario_Bogen_auf_Delta_SP_1[2] * math.cos(math.radians(winkel)) ]
|
||||||
|
Vario_Bogen_ab_Delta_SP_0 = [Vario_Bogen_ab_Delta_SP_0 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_ab_Delta_SP_0[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_ab_Delta_SP_0[1],-Vario_Bogen_ab_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_Delta_SP_0[2] * math.cos(math.radians(winkel_core)) ]
|
||||||
|
Vario_Bogen_ab_Delta_SP_1 =[ Vario_Bogen_ab_Delta_SP_1 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_ab_Delta_SP_1[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_ab_Delta_SP_1[1],-Vario_Bogen_ab_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_Delta_SP_1[2] * math.cos(math.radians(winkel_core)) ]
|
||||||
|
Vario_Bogen_auf_Delta_VP_0 = [Vario_Bogen_auf_Delta_VP_0 [0] * math.cos(math.radians(winkel))+ Vario_Bogen_auf_Delta_VP_0[2]* math.sin(math.radians(winkel)) ,Vario_Bogen_auf_Delta_VP_0[1],-Vario_Bogen_auf_Delta_VP_0[0] * math.sin(math.radians(winkel))+ Vario_Bogen_auf_Delta_VP_0[2] * math.cos(math.radians(winkel)) ]
|
||||||
|
Vario_Bogen_ab_Delta_VP_1 = [Vario_Bogen_ab_Delta_VP_1 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_ab_Delta_VP_1[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_ab_Delta_VP_1[1],-Vario_Bogen_ab_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_Delta_VP_1[2] * math.cos(math.radians(winkel_core)) ]
|
||||||
|
|
||||||
|
# negative Zahlen für x und y positive setzen, damit man weniger nachdenken muss (theoretisch ist SP0 x immer negative und SP1 immer positive aber dies vereinfacht die konsistenz der Werte wann ich was addieren oder subtrahieren muss)
|
||||||
|
|
||||||
|
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_0):
|
||||||
|
if i< 2 and wert < 0:
|
||||||
|
Vario_Bogen_auf_Delta_SP_0[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_1):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_auf_Delta_SP_1[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_0):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_ab_Delta_SP_0[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_1):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_ab_Delta_SP_1[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_auf_Delta_VP_0):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_auf_Delta_VP_0[i] = abs(wert)
|
||||||
|
for i, wert in enumerate(Vario_Bogen_ab_Delta_VP_1):
|
||||||
|
if i< 2 and wert< 0:
|
||||||
|
Vario_Bogen_ab_Delta_VP_1[i] = abs(wert)
|
||||||
|
|
||||||
|
#einfügen des auf blockes und veränderund der start Punktes dementsprechend und erstellung von startVP für die VARIO linie
|
||||||
|
block.add_blockref(block_Vario_Bogen_ab, (start[0]-x,start[1]-y- Vario_Bogen_ab_Delta_SP_0[0], start[2]- hoehe_vario- Vario_Bogen_ab_Delta_SP_0[2]),dxfattribs={"rotation": 270})
|
||||||
|
start_VP = start[0] -Vario_Bogen_ab_Delta_VP_1[1],start[1]- Vario_Bogen_ab_Delta_VP_1[0]- Vario_Bogen_ab_Delta_SP_0[0] ,start[2]+Vario_Bogen_ab_Delta_VP_1[2]-Vario_Bogen_ab_Delta_SP_0[2]
|
||||||
|
|
||||||
|
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])
|
||||||
|
|
||||||
|
#einfügen des auf blockes und veränderund der ende Punktes dementsprechend und erstellung von endeVP für die VARIO linie
|
||||||
|
block.add_blockref(block_Vario_Bogen_auf, (ende[0]-x,ende[1]-y+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]-hoehe_vario -Vario_Bogen_auf_Delta_SP_1[2]),dxfattribs={"rotation": 270})
|
||||||
|
ende_VP = (ende[0] -Vario_Bogen_auf_Delta_VP_0[1], ende[1] + Vario_Bogen_auf_Delta_VP_0[0]+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_Delta_VP_0[2]- Vario_Bogen_auf_Delta_SP_1[2])
|
||||||
|
ende = (ende[0],ende[1]+ Vario_Bogen_auf_Delta_SP_1[0]+ Vario_Bogen_auf_Delta_SP_0[0],ende[2]- Vario_Bogen_auf_Delta_SP_1[2]+ Vario_Bogen_auf_Delta_SP_0[2])
|
||||||
|
|
||||||
|
# Erstellung der VARIO Line
|
||||||
|
|
||||||
|
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||||||
|
line_VP.dxf.layer = "VARIO"
|
||||||
|
copy_VP = line_VP.copy()
|
||||||
|
|
||||||
|
copy_VP.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_VP)
|
||||||
|
# Erstellung der zwischen Line
|
||||||
|
|
||||||
|
line = Line.new(dxfattribs={"start":start,"end":ende })
|
||||||
|
line.dxf.layer = "6-SP"
|
||||||
|
copy = line.copy()
|
||||||
|
copy.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy)
|
||||||
|
|
||||||
|
elif winkel == 3:
|
||||||
|
# Nur erstellung der zwischen und Vario linie weil der Bogen hier nicht nötig ist
|
||||||
|
line_VP = Line.new(dxfattribs={"start": start_Umlenkstation_VP,"end": ende_Motor_VP})
|
||||||
|
line_VP.dxf.layer = "VARIO"
|
||||||
|
copy_VP = line_VP.copy()
|
||||||
|
copy_VP.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy_VP)
|
||||||
|
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||||||
|
line.dxf.layer = "6-SP"
|
||||||
|
|
||||||
|
copy= line.copy()
|
||||||
|
|
||||||
|
copy.translate(-x,-y,-hoehe_vario)
|
||||||
|
block.add_entity(copy)
|
||||||
|
|
||||||
|
# Erstellung einer Spiegelung an der y achse (hier wird es ausgeführt durch -x) für die erstellung des Förderers mit den vario stationen links
|
||||||
|
matrix = Matrix44.scale(-1,1,1)
|
||||||
|
block_links = doc.blocks.new(block_name_links, base_point=(0,0,0))
|
||||||
|
#spiegelung aller elemente außer es und as elemente falls diese vorhanden sind um die logik wie die platziert werden nicht zu zerstören
|
||||||
|
for entity in block:
|
||||||
|
clone= entity.copy()
|
||||||
|
if entity.dxftype() == "INSERT":
|
||||||
|
if (entity.dxf.name.startswith("400102632_ES-Element_90_links") or entity.dxf.name.startswith("200000146_ES-Element_90_rechts") or
|
||||||
|
entity.dxf.name.startswith("200000241_AS-Element_90_rechts") or entity.dxf.name.startswith("200000217_AS-Element_90_links")
|
||||||
|
):
|
||||||
|
block_links.add_entity(clone)
|
||||||
|
else:
|
||||||
|
clone.transform(matrix)
|
||||||
|
block_links.add_entity(clone)
|
||||||
|
else:
|
||||||
|
clone.transform(matrix)
|
||||||
|
block_links.add_entity(clone)
|
||||||
+53
-701
@@ -18,11 +18,10 @@ from ezdxf.math import Matrix44, X_AXIS,Y_AXIS,Z_AXIS
|
|||||||
from ezdxf import bbox
|
from ezdxf import bbox
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import math
|
import math
|
||||||
import re
|
|
||||||
from pydantic import BaseModel, Field, field_validator
|
from pydantic import BaseModel, Field, field_validator
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
from utils import check_environment_var, setup_logger
|
from utils import check_environment_var, setup_logger
|
||||||
|
from Elemente import Kreisel, VarioFoerderer
|
||||||
# global_zaehler = 0
|
# global_zaehler = 0
|
||||||
# --------------------------------------------------------- CFG-Leser für shapes.cfg
|
# --------------------------------------------------------- CFG-Leser für shapes.cfg
|
||||||
def get_shape_cfg(teileart, cfg_path, logger=None):
|
def get_shape_cfg(teileart, cfg_path, logger=None):
|
||||||
@@ -70,674 +69,41 @@ ATTR_TAG = "TeileId" # Attributtag im Block
|
|||||||
RADIUS = 400 # Radius der Kreiselkreise (mm)
|
RADIUS = 400 # Radius der Kreiselkreise (mm)
|
||||||
|
|
||||||
# --------------------------------------------------------- Pydantic Modelle
|
# --------------------------------------------------------- Pydantic Modelle
|
||||||
class Kreisel(BaseModel):
|
|
||||||
"""Pydantic-Modell für Kreisel-Komponenten."""
|
|
||||||
teileid: str
|
|
||||||
x: float = Field(description="X-Koordinate des Kreisel-Zentrums")
|
|
||||||
y: float = Field(description="Y-Koordinate des Kreisel-Zentrums")
|
|
||||||
hoehe: float = Field(description="Höhe in mm")
|
|
||||||
drehung: float = Field(default=0.0, description="Drehung/Winkel in Grad")
|
|
||||||
drehrichtung: Optional[str] = Field(default=None, description="Drehrichtung: UZS oder GUZS")
|
|
||||||
abstand: float = Field(default=20000.0, description="Abstand zwischen Kreiselachsen in mm")
|
|
||||||
kreiselart: Optional[str] = Field(default=None, description="Kreiselart, z.B. 'Pin'")
|
|
||||||
anzahl_scanner: float = Field(default=0.0, description="Anzahl der Scanner")
|
|
||||||
anzahl_separatoren: float = Field(default=0.0, description="Anzahl der Separatoren")
|
|
||||||
|
|
||||||
@field_validator('abstand')
|
|
||||||
@classmethod
|
|
||||||
def validate_abstand(cls, v):
|
|
||||||
"""Konvertiert Abstand von Meter zu mm, falls nötig."""
|
|
||||||
if isinstance(v, str):
|
|
||||||
v = v.replace(",", ".")
|
|
||||||
try:
|
|
||||||
v = float(v) * 1000 # Meter → mm
|
|
||||||
except ValueError:
|
|
||||||
v = 10000.0 # Fallback 10 m
|
|
||||||
return v
|
|
||||||
|
|
||||||
@field_validator('hoehe')
|
|
||||||
@classmethod
|
|
||||||
def validate_hoehe(cls, v):
|
|
||||||
"""Konvertiert Höhe von Meter zu mm, falls nötig."""
|
|
||||||
if isinstance(v, str):
|
|
||||||
v = v.replace(",", ".")
|
|
||||||
try:
|
|
||||||
v = float(v) * 1000 # Meter → mm
|
|
||||||
except ValueError:
|
|
||||||
v = 0.0
|
|
||||||
return v
|
|
||||||
|
|
||||||
@property
|
|
||||||
def halbabstand(self) -> float:
|
|
||||||
"""Halbabstand zwischen den beiden Blöcken."""
|
|
||||||
return self.abstand / 2
|
|
||||||
|
|
||||||
@property
|
|
||||||
def winkel_rad(self) -> float:
|
|
||||||
"""Winkel in Radianten für Berechnungen."""
|
|
||||||
if self.drehung == 270 or self.drehung == 90:
|
|
||||||
return math.radians(self.drehung)
|
|
||||||
else:
|
|
||||||
return math.radians(self.drehung - 180)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def richtung_rad(self) -> float:
|
|
||||||
"""Richtung in Radianten (für am_kreisel_direct_verbunden)."""
|
|
||||||
# Wird aus drehung abgeleitet oder separat gesetzt
|
|
||||||
return math.radians(self.drehung)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def pos1(self) -> tuple[float, float, float]:
|
|
||||||
"""Position des ersten Blocks (x, y, z)."""
|
|
||||||
dx = self.halbabstand * math.cos(self.winkel_rad)
|
|
||||||
dy = self.halbabstand * math.sin(self.winkel_rad)
|
|
||||||
return (self.x - dx, self.y - dy, self.hoehe)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def pos2(self) -> tuple[float, float, float]:
|
|
||||||
"""Position des zweiten Blocks (x, y, z)."""
|
|
||||||
dx = self.halbabstand * math.cos(self.winkel_rad)
|
|
||||||
dy = self.halbabstand * math.sin(self.winkel_rad)
|
|
||||||
return (self.x + dx, self.y + dy, self.hoehe)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def z(self) -> float:
|
|
||||||
"""Z-Koordinate (gleich der Höhe)."""
|
|
||||||
return self.hoehe
|
|
||||||
|
|
||||||
@classmethod
|
|
||||||
def from_merkmale(cls, teileid: str, x: float, y: float, merkmale: dict) -> 'Kreisel':
|
|
||||||
"""Erstellt ein Kreisel-Objekt aus einem merkmale-Dictionary."""
|
|
||||||
hoehe_m = merkmale.get("Höhe in m", "0").replace(",", ".")
|
|
||||||
try:
|
|
||||||
hoehe = float(hoehe_m) * 1000
|
|
||||||
except (ValueError, TypeError):
|
|
||||||
hoehe = 0.0
|
|
||||||
|
|
||||||
abstand_m = merkmale.get("Abstand (Kreiselachse A - Kreiselachse) in Meter", "20").replace(",", ".")
|
|
||||||
try:
|
|
||||||
abstand = float(abstand_m) * 1000
|
|
||||||
except (ValueError, TypeError):
|
|
||||||
abstand = 10000.0
|
|
||||||
|
|
||||||
try:
|
|
||||||
drehung = float(merkmale.get("Drehung", "0"))
|
|
||||||
except (ValueError, TypeError):
|
|
||||||
drehung = 0.0
|
|
||||||
|
|
||||||
try:
|
|
||||||
anzahl_scanner = float(merkmale.get("Anzahl der Scanner", "0"))
|
|
||||||
except (ValueError, TypeError):
|
|
||||||
anzahl_scanner = 0.0
|
|
||||||
|
|
||||||
try:
|
|
||||||
anzahl_separatoren = float(merkmale.get("Anzahl der Separatoren", "0"))
|
|
||||||
except (ValueError, TypeError):
|
|
||||||
anzahl_separatoren = 0.0
|
|
||||||
|
|
||||||
return cls(
|
|
||||||
teileid=teileid,
|
|
||||||
x=x,
|
|
||||||
y=y,
|
|
||||||
hoehe=hoehe,
|
|
||||||
drehung=drehung,
|
|
||||||
drehrichtung=merkmale.get("Drehrichtung"),
|
|
||||||
abstand=abstand,
|
|
||||||
kreiselart=merkmale.get("Kreiselart"),
|
|
||||||
anzahl_scanner=anzahl_scanner,
|
|
||||||
anzahl_separatoren=anzahl_separatoren
|
|
||||||
)
|
|
||||||
|
|
||||||
def draw_kreisel_lines(msp, pos1, pos2, kreisel):
|
|
||||||
"""Zeichnet tangentiale Linien zwischen zwei Kreiselblöcken, unabhängig vom Winkel."""
|
|
||||||
rotation = kreisel.drehung
|
|
||||||
x1, y1, z1 = pos1
|
|
||||||
x2, y2, z1 = pos2
|
|
||||||
# Verbindungsvektor
|
|
||||||
dx = x2 - x1
|
|
||||||
dy = y2 - y1
|
|
||||||
# Länge
|
|
||||||
length = math.hypot(dx, dy)
|
|
||||||
if length == 0:
|
|
||||||
return # keine Linie bei identischen Punkten
|
|
||||||
# Normalenvektor (senkrecht, normiert, Länge = RADIUS)
|
|
||||||
|
|
||||||
nx = -dy / length * RADIUS
|
class Gefaellestrecke(BaseModel):
|
||||||
ny = dx / length * RADIUS
|
|
||||||
# Tangentialpunkte
|
|
||||||
p1a = (x1 + nx, y1 + ny,z1)
|
|
||||||
p1b = (x1 - nx, y1 - ny,z1)
|
|
||||||
p2a = (x2 + nx, y2 + ny,z1)
|
|
||||||
p2b = (x2 - nx, y2 - ny,z1)
|
|
||||||
if kreisel.kreiselart == "Pin":
|
|
||||||
if rotation == 0.0:
|
|
||||||
p1a2 = p1a[0] - RADIUS - 50, p1a[1] + 50, z1
|
|
||||||
p1b2 = p1b[0] - RADIUS - 50, p1b[1] - 50, z1
|
|
||||||
p2a2 = p2a[0] + RADIUS + 50, p2a[1] + 50, z1
|
|
||||||
p2b2 = p2b[0] + RADIUS + 50, p2b[1] - 50, z1
|
|
||||||
Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"})
|
|
||||||
Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"})
|
|
||||||
msp.add_entity(Line1)
|
|
||||||
msp.add_entity(Line2)
|
|
||||||
elif rotation == 180.0:
|
|
||||||
p1a2 = p1a[0] + RADIUS + 50, p1a[1] - 50, z1
|
|
||||||
p1b2 = p1b[0] + RADIUS + 50, p1b[1] + 50, z1
|
|
||||||
p2a2 = p2a[0] - RADIUS - 50, p2a[1] - 50, z1
|
|
||||||
p2b2 = p2b[0] - RADIUS - 50, p2b[1] + 50, z1
|
|
||||||
Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"})
|
|
||||||
Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"})
|
|
||||||
msp.add_entity(Line1)
|
|
||||||
msp.add_entity(Line2)
|
|
||||||
elif rotation == 90.0:
|
|
||||||
p1a2 = p1a[0] + 50, p1a[1] - 50 + RADIUS , z1
|
|
||||||
p1b2 = p1b[0] - 50, p1b[1] - 50 + RADIUS, z1
|
|
||||||
p2a2 = p2a[0] + 50, p2a[1] + 50 - RADIUS, z1
|
|
||||||
p2b2 = p2b[0] - 50, p2b[1] + 50 - RADIUS, z1
|
|
||||||
Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"})
|
|
||||||
Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"})
|
|
||||||
msp.add_entity(Line1)
|
|
||||||
msp.add_entity(Line2)
|
|
||||||
elif rotation == 270.0:
|
|
||||||
p1a2 = p1a[0] - 50, p1a[1] + 50 - RADIUS , z1
|
|
||||||
p1b2 = p1b[0] + 50, p1b[1] + 50 - RADIUS, z1
|
|
||||||
p2a2 = p2a[0] - 50, p2a[1] - 50 + RADIUS, z1
|
|
||||||
p2b2 = p2b[0] + 50, p2b[1] - 50 + RADIUS, z1
|
|
||||||
Line1 = Line.new(dxfattribs={"start": p1a2,"end": p2a2,"layer": "Pinbereich"})
|
|
||||||
Line2 = Line.new(dxfattribs={"start": p1b2,"end": p2b2,"layer": "Pinbereich"})
|
|
||||||
msp.add_entity(Line1)
|
|
||||||
msp.add_entity(Line2)
|
|
||||||
|
|
||||||
# Linien zeichnen
|
|
||||||
msp.add_line(p1a, p2a)
|
|
||||||
msp.add_line(p1b, p2b)
|
|
||||||
|
|
||||||
def draw_kreisel_drehrichtung_markierung(msp, pos1, pos2, kreisel, lib_doc, doc, verbose):
|
|
||||||
drehrichtung = (kreisel.drehrichtung or "").upper()
|
|
||||||
if drehrichtung not in ("UZS", "GUZS"):
|
|
||||||
return
|
|
||||||
x1, y1,z1= pos1
|
|
||||||
x2, y2,z2 = pos2
|
|
||||||
dx = x2 - x1
|
|
||||||
dy = y2 - y1
|
|
||||||
length = math.hypot(dx, dy)
|
|
||||||
if length == 0:
|
|
||||||
return
|
|
||||||
# Normalenvektor (senkrecht, normiert, Länge = RADIUS)
|
|
||||||
nx = -dy / length * RADIUS
|
|
||||||
ny = dx / length * RADIUS
|
|
||||||
# Obere Linie
|
|
||||||
p1_oben = (x1 + nx, y1 + ny)
|
|
||||||
p2_oben = (x2 + nx, y2 + ny)
|
|
||||||
# Untere Linie
|
|
||||||
p1_unten = (x1 - nx, y1 - ny)
|
|
||||||
p2_unten = (x2 - nx, y2 - ny)
|
|
||||||
# S-LP auf oberer Linie (Drehrichtung wie angegeben)
|
|
||||||
for i in range(1, 4):
|
|
||||||
t = i / 4 # 1/4, 2/4, 3/4
|
|
||||||
px = p1_oben[0] + t * (p2_oben[0] - p1_oben[0])
|
|
||||||
py = p1_oben[1] + t * (p2_oben[1] - p1_oben[1])
|
|
||||||
rotation = math.degrees(math.atan2(p2_oben[1] - p1_oben[1], p2_oben[0] - p1_oben[0]))
|
|
||||||
if drehrichtung == "GUZS":
|
|
||||||
rotation += 180
|
|
||||||
import_block("Richtungspfeil", lib_doc, doc)
|
|
||||||
blockref_layer = get_layer(doc, 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}")
|
|
||||||
# S-LP auf unterer Linie (Drehrichtung invertiert)
|
|
||||||
for i in range(1, 4):
|
|
||||||
t = i / 4
|
|
||||||
px = p1_unten[0] + t * (p2_unten[0] - p1_unten[0])
|
|
||||||
py = p1_unten[1] + t * (p2_unten[1] - p1_unten[1])
|
|
||||||
rotation = math.degrees(math.atan2(p2_unten[1] - p1_unten[1], p2_unten[0] - p1_unten[0]))
|
|
||||||
if drehrichtung == "UZS":
|
|
||||||
rotation += 180
|
|
||||||
import_block("Richtungspfeil", lib_doc, doc)
|
|
||||||
blockref_layer = get_layer(doc, 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}")
|
|
||||||
|
|
||||||
|
|
||||||
class VarioFoerderer(BaseModel):
|
|
||||||
teileid: str
|
teileid: str
|
||||||
x: float = Field(description="X-Koordinate des Foerder-Zentrums")
|
x: float = Field(description="X-Koordinate des Foerder-Zentrums")
|
||||||
y: float = Field(description="Y-Koordinate des Foerder-Zentrums")
|
y: float = Field(description="Y-Koordinate des Foerder-Zentrums")
|
||||||
laenge:float = Field(description = "Länge des Förderers")
|
laenge:float = Field(description = "Länge des Förderers")
|
||||||
winkel: float = Field(description = "Winkel des Färderers")
|
h0: float = Field(description="Höhe Unten in Merkmale")
|
||||||
h0: float = Field(description="Höhe Anfang in Merkmale")
|
h1: float = Field(description="Höhe Oben in Merkmale")
|
||||||
h1: float = Field(description="Höhe Ende in Merkmale")
|
drehung: float = Field(default=0.0, description="Drehung an z achse")
|
||||||
hat_motor: bool = Field(description="Überprüft ob der Vörderer ein Motor hat")
|
anzahl_scanner: int = Field(default=0, description="Anzahl der Scanner")
|
||||||
hat_umlenk: bool = Field(description="Überprüft ob der Vörderer eine Umlenkstation hat")
|
anzahl_separatoren: int = Field(default=0, description="Anzahl der Separatoren")
|
||||||
drehung: float = Field(default=0.0, description="Drehung/Winkel in Grad")
|
|
||||||
foerderer_richtung : str= Field(description="In welche richtung geförderd wird")
|
|
||||||
gefaelle_laenge: Optional [float] = Field(default=0.0,description="Länge der zusätzlichen Gefälle Strecke falls vorhanden")
|
|
||||||
gefaelle_winkel: Optional [float] = Field(default=0.0,description="Winkel der Gefällestrecke, falls diese Vorhanden ist")
|
|
||||||
anzahl_scanner: float = Field(default=0.0, description="Anzahl der Scanner")
|
|
||||||
anzahl_separatoren: float = Field(default=0.0, description="Anzahl der Separatoren")
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def hight_zwischen(self):
|
def hight_zwischen(self):
|
||||||
return ((self.h0 + self.h1) /2)
|
return ((self.h0 + self.h1) /2)
|
||||||
|
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def from_merkmale(cls, teileid: str, x: float, y: float, merkmale: dict) -> 'VarioFoerderer':
|
def from_merkmale(cls, teileid: str, x: float, y: float, merkmale: dict) -> 'VarioFoerderer':
|
||||||
|
|
||||||
h0 = float(merkmale.get("Höhe Anfang")) * 1000
|
h0 = float(merkmale.get("Höhe unten")) * 1000
|
||||||
h1 = float(merkmale.get("Höhe Ende")) * 1000
|
h1 = float(merkmale.get("Höhe oben")) * 1000
|
||||||
laenge = float(merkmale.get("Länge in Meter")) * 1000
|
laenge = float(merkmale.get("Länge in Meter")) * 1000
|
||||||
return cls(
|
return cls(
|
||||||
teileid = teileid,
|
teileid = teileid,
|
||||||
laenge = laenge,
|
laenge = laenge,
|
||||||
x = x,
|
x = x,
|
||||||
y = y,
|
y = y,
|
||||||
foerderer_richtung =merkmale.get("Förderrichtung"),
|
|
||||||
winkel = float(merkmale.get("Winkel")),
|
|
||||||
hat_motor = bool(merkmale.get("hatMotor")),
|
|
||||||
hat_umlenk = bool(merkmale.get("hatUmlenkung")),
|
|
||||||
h0 = h0,
|
h0 = h0,
|
||||||
h1 =h1,
|
h1 =h1,
|
||||||
drehung = float(merkmale.get("Drehung")),
|
drehung = float(merkmale.get("Drehung")),
|
||||||
gefaelle_laenge = float(merkmale.get("Laenge_Gefaellestrecke")),
|
anzahl_scanner = int(merkmale.get("Anzahl der Scanner")),
|
||||||
gefalle_winkel = float(merkmale.get("Winkel_Gefaellestrecke"))
|
anzahl_separatoren = int(merkmale.get("Anzahl der Separatoren"))
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
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"))
|
|
||||||
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 = foerderer.hat_motor
|
|
||||||
umlenk_vorhanden = foerderer.hat_umlenk
|
|
||||||
gefahellewinkel =foerderer.gefaelle_winkel
|
|
||||||
gefaelle = foerderer.gefaelle_laenge
|
|
||||||
x = foerderer.x
|
|
||||||
y = foerderer.y
|
|
||||||
hoehe_vario = foerderer.hight_zwischen
|
|
||||||
winkel = int(foerderer.winkel)
|
|
||||||
# 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)
|
|
||||||
|
|
||||||
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 - motor_offset_x
|
|
||||||
if umlenk_vorhanden == True:
|
|
||||||
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":
|
|
||||||
# erstellung des gefälles falls es nicht null ist (also keins angegeben ist oder es durch andere Sachen wie Motor ersetzt wird)
|
|
||||||
if gefaelle > 0:
|
|
||||||
# Setzng die hälfte des Gefälles auf beide seiten falls dieser nicht mit einem anderen Förder verbunden ist was durch die abwesenheit eines motors/umlenkung gezeigt wird
|
|
||||||
halbesgefaelle = gefaelle/2
|
|
||||||
if motor_vorhanden == True and umlenk_vorhanden == True:
|
|
||||||
halbesgefaelle = gefaelle/2
|
|
||||||
gefaelle_ende = ende[0], ende[1] +halbesgefaelle, ende[2] -math.sin(math.radians(gefahellewinkel))* halbesgefaelle
|
|
||||||
line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
|
|
||||||
line_ende_gefaelle.dxf.layer = "6-SP"
|
|
||||||
copy_ende = line_ende_gefaelle.copy()
|
|
||||||
copy_ende.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_ende)
|
|
||||||
ende = gefaelle_ende
|
|
||||||
|
|
||||||
gefaelle_start = start[0], start[1] -halbesgefaelle, start[2] +math.sin(math.radians(gefahellewinkel)) * halbesgefaelle
|
|
||||||
line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
|
|
||||||
line_start_gefaelle.dxf.layer = "6-SP"
|
|
||||||
copy_start = line_start_gefaelle.copy()
|
|
||||||
copy_start.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_start)
|
|
||||||
start = gefaelle_start
|
|
||||||
|
|
||||||
elif motor_vorhanden== True:
|
|
||||||
gefaelle_start = start[0], start[1] -gefaelle, start[2] +math.sin(math.radians(gefahellewinkel)) * gefaelle
|
|
||||||
line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
|
|
||||||
line_start_gefaelle.dxf.layer = "6-SP"
|
|
||||||
copy_start = line_start_gefaelle.copy()
|
|
||||||
copy_start.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_start)
|
|
||||||
start = gefaelle_start
|
|
||||||
|
|
||||||
elif umlenk_vorhanden== True:
|
|
||||||
gefaelle_ende = ende[0], ende[1] +gefaelle, ende[2] -math.sin(math.radians(gefahellewinkel))* gefaelle
|
|
||||||
line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
|
|
||||||
line_ende_gefaelle.dxf.layer = "6-SP"
|
|
||||||
copy_ende = line_ende_gefaelle.copy()
|
|
||||||
copy_ende.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_ende)
|
|
||||||
ende = gefaelle_ende
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
import_block(block_Vario_Motorstation_500mm, lib_doc, doc)
|
|
||||||
import_block(block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
|
||||||
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_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] - 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 = winkel + winkel_core
|
|
||||||
block_Vario_Bogen_auf = (f"Vario_Bogen_auf_{winkel_plus}°")
|
|
||||||
block_Vario_Bogen_ab = (f"Vario_Bogen_ab_{winkel_plus}°")
|
|
||||||
|
|
||||||
auf_attrib =import_block(block_Vario_Bogen_auf, lib_doc, doc)
|
|
||||||
ab_attrib =import_block(block_Vario_Bogen_ab, lib_doc, doc)
|
|
||||||
block_Vario_Bogen_auf = dreh_block(block_Vario_Bogen_auf, doc,math.radians(winkel_core))
|
|
||||||
block_Vario_Bogen_ab = dreh_block(block_Vario_Bogen_ab, 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"]))
|
|
||||||
Vario_Bogen_ab_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_1"]))
|
|
||||||
Vario_Bogen_auf_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_VP_1"]))
|
|
||||||
Vario_Bogen_ab_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_VP_0"]))
|
|
||||||
|
|
||||||
Vario_Bogen_auf_Delta_SP_0 = [Vario_Bogen_auf_Delta_SP_0 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_SP_0[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_auf_Delta_SP_0[1],-Vario_Bogen_auf_Delta_SP_0[0] * math.sin(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_SP_0[2] * math.cos(math.radians(winkel_core)) ]
|
|
||||||
Vario_Bogen_auf_Delta_SP_1 = [Vario_Bogen_auf_Delta_SP_1 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_SP_1[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_auf_Delta_SP_1[1],-Vario_Bogen_auf_Delta_SP_1[0] * math.sin(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_SP_1[2] * math.cos(math.radians(winkel_core)) ]
|
|
||||||
Vario_Bogen_ab_Delta_SP_0 = [Vario_Bogen_ab_Delta_SP_0 [0] * math.cos(math.radians(-winkel))+ Vario_Bogen_ab_Delta_SP_0[2]* math.sin(math.radians(-winkel)) ,Vario_Bogen_ab_Delta_SP_0[1],-Vario_Bogen_ab_Delta_SP_0[0] * math.sin(math.radians(-winkel))+ Vario_Bogen_ab_Delta_SP_0[2] * math.cos(math.radians(-winkel)) ]
|
|
||||||
Vario_Bogen_ab_Delta_SP_1 =[ Vario_Bogen_ab_Delta_SP_1 [0] * math.cos(math.radians(-winkel))+ Vario_Bogen_ab_Delta_SP_1[2]* math.sin(math.radians(-winkel)) ,Vario_Bogen_ab_Delta_SP_1[1],-Vario_Bogen_ab_Delta_SP_1[0] * math.sin(math.radians(-winkel))+ Vario_Bogen_ab_Delta_SP_1[2] * math.cos(math.radians(-winkel)) ]
|
|
||||||
Vario_Bogen_auf_Delta_VP_1 = [Vario_Bogen_auf_Delta_VP_1 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_VP_1[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_auf_Delta_VP_1[1],-Vario_Bogen_auf_Delta_VP_1[0] * math.sin(math.radians(winkel_core))+ Vario_Bogen_auf_Delta_VP_1[2] * math.cos(math.radians(winkel_core)) ]
|
|
||||||
Vario_Bogen_ab_Delta_VP_0 = [Vario_Bogen_ab_Delta_VP_0 [0] * math.cos(math.radians(-winkel))+ Vario_Bogen_ab_Delta_VP_0[2]* math.sin(math.radians(-winkel)) ,Vario_Bogen_ab_Delta_VP_0[1],-Vario_Bogen_ab_Delta_VP_0[0] * math.sin(math.radians(-winkel))+ Vario_Bogen_ab_Delta_VP_0[2] * math.cos(math.radians(-winkel)) ]
|
|
||||||
|
|
||||||
# negative Zahlen für x und y positive setzen, damit man weniger nachdenken muss (theoretisch ist SP0 x immer negative und SP1 immer positive aber dies vereinfacht die konsistenz der Werte wann ich was addieren oder subtrahieren muss)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_0):
|
|
||||||
if i< 2 and wert < 0:
|
|
||||||
Vario_Bogen_auf_Delta_SP_0[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_1):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_auf_Delta_SP_1[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_0):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_ab_Delta_SP_0[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_1):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_ab_Delta_SP_1[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_VP_1):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_auf_Delta_VP_1[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_VP_0):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_ab_Delta_VP_0[i] = abs(wert)
|
|
||||||
|
|
||||||
#einfügen des auf blockes und veränderund der ende Punktes dementsprechend und erstellung von endeVP für die VARIO linie
|
|
||||||
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_vario ),dxfattribs={"rotation": 90})
|
|
||||||
ende_VP = (ende[0] +Vario_Bogen_auf_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_Delta_VP_1[0]+Vario_Bogen_auf_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_Delta_VP_1[2]- Vario_Bogen_auf_Delta_SP_0[2])
|
|
||||||
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_Delta_SP_1[0] + Vario_Bogen_auf_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_Delta_SP_1[2] - Vario_Bogen_auf_Delta_SP_0[2])
|
|
||||||
#einfügen des auf blockes und veränderund der start Punktes dementsprechend und erstellung von startVP für die VARIO linie
|
|
||||||
block.add_blockref(block_Vario_Bogen_ab ,(start[0]-x,start[1] - Vario_Bogen_ab_Delta_SP_1[0] -y ,start[2] - hoehe_vario-Vario_Bogen_ab_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
|
||||||
|
|
||||||
start_VP = start[0] +Vario_Bogen_ab_Delta_VP_0[1],start[1]-Vario_Bogen_ab_Delta_VP_0[0] - Vario_Bogen_ab_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_Delta_VP_0[2] - Vario_Bogen_ab_Delta_SP_1[2]
|
|
||||||
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_1[2]+ Vario_Bogen_ab_Delta_SP_0[2]
|
|
||||||
|
|
||||||
# Erstellung der VARIO Line
|
|
||||||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
|
||||||
line_VP.dxf.layer = "VARIO"
|
|
||||||
copy_VP = line_VP.copy()
|
|
||||||
|
|
||||||
copy_VP.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_VP)
|
|
||||||
# Erstellung der zwischen Line
|
|
||||||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
|
||||||
line.dxf.layer = "6-SP"
|
|
||||||
|
|
||||||
copy= line.copy()
|
|
||||||
|
|
||||||
copy.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy)
|
|
||||||
|
|
||||||
else:
|
|
||||||
# Einfügen der 3 grad Bogen und deren notwendigen Werten von den attributen des bogens in den block
|
|
||||||
|
|
||||||
block_Vario_Bogen_auf_3 = str(config.get("ILS 2.0 Variofoerderer_Bogen_block_namen","bogen_3_auf"))
|
|
||||||
block_Vario_Bogen_ab_3 = str(config.get("ILS 2.0 Variofoerderer_Bogen_block_namen","bogen_3_ab"))
|
|
||||||
auf_3_attrib =import_block(block_Vario_Bogen_auf_3, lib_doc, doc)
|
|
||||||
ab_3_attrib = import_block(block_Vario_Bogen_ab_3, lib_doc, doc)
|
|
||||||
block_Vario_Bogen_auf_3= dreh_block(block_Vario_Bogen_auf_3, doc,math.radians(3))
|
|
||||||
block_Vario_Bogen_ab_3 = dreh_block(block_Vario_Bogen_ab_3, doc,math.radians(0))
|
|
||||||
Vario_Bogen_auf_3_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_3_attrib["DELTA_SP_0"]))
|
|
||||||
Vario_Bogen_auf_3_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_3_attrib["DELTA_SP_1"]))
|
|
||||||
Vario_Bogen_ab_3_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_3_attrib["DELTA_SP_0"]))
|
|
||||||
Vario_Bogen_ab_3_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_3_attrib["DELTA_SP_1"]))
|
|
||||||
Vario_Bogen_auf_3_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_3_attrib["DELTA_VP_1"]))
|
|
||||||
Vario_Bogen_ab_3_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_3_attrib["DELTA_VP_0"]))
|
|
||||||
|
|
||||||
Vario_Bogen_auf_3_Delta_SP_0 = [Vario_Bogen_auf_3_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_3_Delta_SP_0[1],-Vario_Bogen_auf_3_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
|
||||||
Vario_Bogen_auf_3_Delta_SP_1 = [Vario_Bogen_auf_3_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_3_Delta_SP_1[1],-Vario_Bogen_auf_3_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
|
||||||
Vario_Bogen_ab_3_Delta_SP_0 = [Vario_Bogen_ab_3_Delta_SP_0 [0] ,Vario_Bogen_ab_3_Delta_SP_0[1],Vario_Bogen_ab_3_Delta_SP_0[2] ]
|
|
||||||
Vario_Bogen_ab_3_Delta_SP_1 =[ Vario_Bogen_ab_3_Delta_SP_1 [0] ,Vario_Bogen_ab_3_Delta_SP_1[1],Vario_Bogen_ab_3_Delta_SP_1[2] ]
|
|
||||||
Vario_Bogen_auf_3_Delta_VP_1 = [Vario_Bogen_auf_3_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_3_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_3_Delta_VP_1[1],-Vario_Bogen_auf_3_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_3_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
|
||||||
Vario_Bogen_ab_3_Delta_VP_0 = [Vario_Bogen_ab_3_Delta_VP_0 [0],Vario_Bogen_ab_3_Delta_VP_0[1],Vario_Bogen_ab_3_Delta_VP_0[2] ]
|
|
||||||
|
|
||||||
# negative Zahlen für x und y positive setzen, damit man weniger nachdenken muss (theoretisch ist SP0 x immer negative und SP1 immer positive aber dies vereinfacht die konsistenz der Werte wann ich was addieren oder subtrahieren muss)
|
|
||||||
|
|
||||||
for i, wert in enumerate(Vario_Bogen_auf_3_Delta_SP_0):
|
|
||||||
if i< 2 and wert < 0:
|
|
||||||
Vario_Bogen_auf_3_Delta_SP_0[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_auf_3_Delta_SP_1):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_auf_3_Delta_SP_1[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_ab_3_Delta_SP_0):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_ab_3_Delta_SP_0[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_ab_3_Delta_SP_1):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_ab_3_Delta_SP_1[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_auf_3_Delta_VP_1):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_auf_3_Delta_VP_1[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_ab_3_Delta_VP_0):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_ab_3_Delta_VP_0[i] = abs(wert)
|
|
||||||
|
|
||||||
#einfügen des auf blockes und veränderund der ende Punktes dementsprechend und erstellung von endeVP für die VARIO linie
|
|
||||||
if motor_vorhanden == True:
|
|
||||||
block.add_blockref(block_Vario_Bogen_auf_3,(ende[0] -x ,ende[1] +Vario_Bogen_auf_3_Delta_SP_0[0] -y ,ende[2] - Vario_Bogen_auf_3_Delta_SP_0[2]- hoehe_vario ),dxfattribs={"rotation": 90})
|
|
||||||
ende_VP = (ende[0] +Vario_Bogen_auf_3_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_3_Delta_VP_1[0]+Vario_Bogen_auf_3_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_3_Delta_VP_1[2]- Vario_Bogen_auf_3_Delta_SP_0[2])
|
|
||||||
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_3_Delta_SP_1[0] + Vario_Bogen_auf_3_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_3_Delta_SP_1[2] - Vario_Bogen_auf_3_Delta_SP_0[2])
|
|
||||||
else:
|
|
||||||
ende_VP = ende[0] +Vario_Bogen_auf_3_Delta_VP_1[1] ,ende[1] , ende[2]
|
|
||||||
|
|
||||||
#einfügen des auf blockes und veränderund der start Punktes dementsprechend und erstellung von startVP für die VARIO linie
|
|
||||||
if umlenk_vorhanden == True:
|
|
||||||
block.add_blockref(block_Vario_Bogen_ab_3 ,(start[0]-x,start[1] - Vario_Bogen_ab_3_Delta_SP_1[0] -y ,start[2] - hoehe_vario - Vario_Bogen_ab_3_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
|
||||||
start_VP = start[0] +Vario_Bogen_ab_3_Delta_VP_0[1],start[1]-Vario_Bogen_ab_3_Delta_VP_0[0] - Vario_Bogen_ab_3_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_3_Delta_VP_0[2] - Vario_Bogen_ab_3_Delta_SP_1[2]
|
|
||||||
start = start[0] ,start[1] - Vario_Bogen_ab_3_Delta_SP_0[0] - Vario_Bogen_ab_3_Delta_SP_1[0],start[2] +Vario_Bogen_ab_3_Delta_SP_0[2] - Vario_Bogen_ab_3_Delta_SP_1[2]
|
|
||||||
else:
|
|
||||||
start_VP = start[0] +Vario_Bogen_ab_3_Delta_VP_0[1],start[1] , start[2]
|
|
||||||
# Erstellung der VARIO Line
|
|
||||||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
|
||||||
line_VP.dxf.layer = "VARIO"
|
|
||||||
copy_VP = line_VP.copy()
|
|
||||||
|
|
||||||
copy_VP.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_VP)
|
|
||||||
|
|
||||||
# Erstellung der zwischen Line
|
|
||||||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
|
||||||
line.dxf.layer = "6-SP"
|
|
||||||
|
|
||||||
copy= line.copy()
|
|
||||||
|
|
||||||
copy.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy)
|
|
||||||
|
|
||||||
elif voerder_richtung == "Ab":
|
|
||||||
# Setzng die hälfte des Gefälles auf beide seiten falls dieser nicht mit einem anderen Förder verbunden ist was durch die abwesenheit eines motors/umlenkung gezeigt wird
|
|
||||||
|
|
||||||
if gefaelle > 0:
|
|
||||||
if motor_vorhanden == True and umlenk_vorhanden == True:
|
|
||||||
halbesgefaelle = gefaelle/2
|
|
||||||
gefaelle_ende = ende[0], ende[1] +halbesgefaelle, ende[2] +math.sin(math.radians(gefahellewinkel))* halbesgefaelle
|
|
||||||
line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
|
|
||||||
line_ende_gefaelle.dxf.layer = "6-SP"
|
|
||||||
copy_ende = line_ende_gefaelle.copy()
|
|
||||||
copy_ende.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_ende)
|
|
||||||
ende = gefaelle_ende
|
|
||||||
|
|
||||||
gefaelle_start = start[0], start[1] -halbesgefaelle, start[2] -math.sin(math.radians(gefahellewinkel)) * halbesgefaelle
|
|
||||||
line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
|
|
||||||
line_start_gefaelle.dxf.layer = "6-SP"
|
|
||||||
copy_start = line_start_gefaelle.copy()
|
|
||||||
copy_start.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_start)
|
|
||||||
start = gefaelle_start
|
|
||||||
elif motor_vorhanden == True:
|
|
||||||
gefaelle_ende = ende[0], ende[1] +gefaelle, ende[2] +math.sin(math.radians(gefahellewinkel))* gefaelle
|
|
||||||
line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
|
|
||||||
line_ende_gefaelle.dxf.layer = "6-SP"
|
|
||||||
copy_ende = line_ende_gefaelle.copy()
|
|
||||||
copy_ende.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_ende)
|
|
||||||
ende = gefaelle_ende
|
|
||||||
elif umlenk_vorhanden == True:
|
|
||||||
gefaelle_start = start[0], start[1] -gefaelle, start[2] -math.sin(math.radians(gefahellewinkel)) * gefaelle
|
|
||||||
line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
|
|
||||||
line_start_gefaelle.dxf.layer = "6-SP"
|
|
||||||
copy_start = line_start_gefaelle.copy()
|
|
||||||
copy_start.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_start)
|
|
||||||
start = gefaelle_start
|
|
||||||
|
|
||||||
# Importieren und setzen der UMlenkungstation oder Motorstation falls nötig
|
|
||||||
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
|
|
||||||
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
|
|
||||||
import_block( block_Vario_Motorstation_500mm, lib_doc, doc)
|
|
||||||
import_block( block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
|
||||||
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_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] - 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] + 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] + 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]
|
|
||||||
|
|
||||||
if winkel != 3:
|
|
||||||
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)
|
|
||||||
auf_attrib =import_block( block_Vario_Bogen_auf, lib_doc, doc)
|
|
||||||
block_Vario_Bogen_ab = dreh_block( block_Vario_Bogen_ab, doc, math.radians(winkel_core))
|
|
||||||
block_Vario_Bogen_auf= dreh_block( block_Vario_Bogen_auf, 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"]))
|
|
||||||
Vario_Bogen_ab_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_1"]))
|
|
||||||
Vario_Bogen_auf_Delta_VP_0 = list(float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_VP_0"]))
|
|
||||||
Vario_Bogen_ab_Delta_VP_1= list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_VP_1"]))
|
|
||||||
|
|
||||||
Vario_Bogen_auf_Delta_SP_0 = [Vario_Bogen_auf_Delta_SP_0 [0] * math.cos(math.radians(winkel))+ Vario_Bogen_auf_Delta_SP_0[2]* math.sin(math.radians(winkel)) ,Vario_Bogen_auf_Delta_SP_0[1],-Vario_Bogen_auf_Delta_SP_0[0] * math.sin(math.radians(winkel))+ Vario_Bogen_auf_Delta_SP_0[2] * math.cos(math.radians(winkel)) ]
|
|
||||||
Vario_Bogen_auf_Delta_SP_1 = [Vario_Bogen_auf_Delta_SP_1 [0] * math.cos(math.radians(winkel))+ Vario_Bogen_auf_Delta_SP_1[2]* math.sin(math.radians(winkel)) ,Vario_Bogen_auf_Delta_SP_1[1],-Vario_Bogen_auf_Delta_SP_1[0] * math.sin(math.radians(winkel))+ Vario_Bogen_auf_Delta_SP_1[2] * math.cos(math.radians(winkel)) ]
|
|
||||||
Vario_Bogen_ab_Delta_SP_0 = [Vario_Bogen_ab_Delta_SP_0 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_ab_Delta_SP_0[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_ab_Delta_SP_0[1],-Vario_Bogen_ab_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_Delta_SP_0[2] * math.cos(math.radians(winkel_core)) ]
|
|
||||||
Vario_Bogen_ab_Delta_SP_1 =[ Vario_Bogen_ab_Delta_SP_1 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_ab_Delta_SP_1[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_ab_Delta_SP_1[1],-Vario_Bogen_ab_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_Delta_SP_1[2] * math.cos(math.radians(winkel_core)) ]
|
|
||||||
Vario_Bogen_auf_Delta_VP_0 = [Vario_Bogen_auf_Delta_VP_0 [0] * math.cos(math.radians(winkel))+ Vario_Bogen_auf_Delta_VP_0[2]* math.sin(math.radians(winkel)) ,Vario_Bogen_auf_Delta_VP_0[1],-Vario_Bogen_auf_Delta_VP_0[0] * math.sin(math.radians(winkel))+ Vario_Bogen_auf_Delta_VP_0[2] * math.cos(math.radians(winkel)) ]
|
|
||||||
Vario_Bogen_ab_Delta_VP_1 = [Vario_Bogen_ab_Delta_VP_1 [0] * math.cos(math.radians(winkel_core))+ Vario_Bogen_ab_Delta_VP_1[2]* math.sin(math.radians(winkel_core)) ,Vario_Bogen_ab_Delta_VP_1[1],-Vario_Bogen_ab_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_Delta_VP_1[2] * math.cos(math.radians(winkel_core)) ]
|
|
||||||
|
|
||||||
# negative Zahlen für x und y positive setzen, damit man weniger nachdenken muss (theoretisch ist SP0 x immer negative und SP1 immer positive aber dies vereinfacht die konsistenz der Werte wann ich was addieren oder subtrahieren muss)
|
|
||||||
|
|
||||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_0):
|
|
||||||
if i< 2 and wert < 0:
|
|
||||||
Vario_Bogen_auf_Delta_SP_0[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_1):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_auf_Delta_SP_1[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_0):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_ab_Delta_SP_0[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_1):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_ab_Delta_SP_1[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_VP_0):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_auf_Delta_VP_0[i] = abs(wert)
|
|
||||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_VP_1):
|
|
||||||
if i< 2 and wert< 0:
|
|
||||||
Vario_Bogen_ab_Delta_VP_1[i] = abs(wert)
|
|
||||||
|
|
||||||
#einfügen des auf blockes und veränderund der start Punktes dementsprechend und erstellung von startVP für die VARIO linie
|
|
||||||
block.add_blockref(block_Vario_Bogen_ab, (start[0]-x,start[1]-y- Vario_Bogen_ab_Delta_SP_0[0], start[2]- hoehe_vario- Vario_Bogen_ab_Delta_SP_0[2]),dxfattribs={"rotation": 270})
|
|
||||||
start_VP = start[0] -Vario_Bogen_ab_Delta_VP_1[1],start[1]- Vario_Bogen_ab_Delta_VP_1[0]- Vario_Bogen_ab_Delta_SP_0[0] ,start[2]+Vario_Bogen_ab_Delta_VP_1[2]-Vario_Bogen_ab_Delta_SP_0[2]
|
|
||||||
|
|
||||||
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])
|
|
||||||
|
|
||||||
#einfügen des auf blockes und veränderund der ende Punktes dementsprechend und erstellung von endeVP für die VARIO linie
|
|
||||||
block.add_blockref(block_Vario_Bogen_auf, (ende[0]-x,ende[1]-y+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]-hoehe_vario -Vario_Bogen_auf_Delta_SP_1[2]),dxfattribs={"rotation": 270})
|
|
||||||
ende_VP = (ende[0] -Vario_Bogen_auf_Delta_VP_0[1], ende[1] + Vario_Bogen_auf_Delta_VP_0[0]+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_Delta_VP_0[2]- Vario_Bogen_auf_Delta_SP_1[2])
|
|
||||||
ende = (ende[0],ende[1]+ Vario_Bogen_auf_Delta_SP_1[0]+ Vario_Bogen_auf_Delta_SP_0[0],ende[2]- Vario_Bogen_auf_Delta_SP_1[2]+ Vario_Bogen_auf_Delta_SP_0[2])
|
|
||||||
|
|
||||||
# Erstellung der VARIO Line
|
|
||||||
|
|
||||||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
|
||||||
line_VP.dxf.layer = "VARIO"
|
|
||||||
copy_VP = line_VP.copy()
|
|
||||||
|
|
||||||
copy_VP.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_VP)
|
|
||||||
# Erstellung der zwischen Line
|
|
||||||
|
|
||||||
line = Line.new(dxfattribs={"start":start,"end":ende })
|
|
||||||
line.dxf.layer = "6-SP"
|
|
||||||
copy = line.copy()
|
|
||||||
copy.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy)
|
|
||||||
|
|
||||||
elif winkel == 3:
|
|
||||||
# Nur erstellung der zwischen und Vario linie weil der Bogen hier nicht nötig ist
|
|
||||||
line_VP = Line.new(dxfattribs={"start": start_Umlenkstation_VP,"end": ende_Motor_VP})
|
|
||||||
line_VP.dxf.layer = "VARIO"
|
|
||||||
copy_VP = line_VP.copy()
|
|
||||||
copy_VP.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy_VP)
|
|
||||||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
|
||||||
line.dxf.layer = "6-SP"
|
|
||||||
|
|
||||||
copy= line.copy()
|
|
||||||
|
|
||||||
copy.translate(-x,-y,-hoehe_vario)
|
|
||||||
block.add_entity(copy)
|
|
||||||
|
|
||||||
# Erstellung einer Spiegelung an der y achse (hier wird es ausgeführt durch -x) für die erstellung des Förderers mit den vario stationen links
|
|
||||||
matrix = Matrix44.scale(-1,1,1)
|
|
||||||
block_links = doc.blocks.new(block_name_links, base_point=(0,0,0))
|
|
||||||
#spiegelung aller elemente außer es und as elemente falls diese vorhanden sind um die logik wie die platziert werden nicht zu zerstören
|
|
||||||
for entity in block:
|
|
||||||
clone= entity.copy()
|
|
||||||
if entity.dxftype() == "INSERT":
|
|
||||||
if (entity.dxf.name.startswith("400102632_ES-Element_90_links") or entity.dxf.name.startswith("200000146_ES-Element_90_rechts") or
|
|
||||||
entity.dxf.name.startswith("200000241_AS-Element_90_rechts") or entity.dxf.name.startswith("200000217_AS-Element_90_links")
|
|
||||||
):
|
|
||||||
block_links.add_entity(clone)
|
|
||||||
else:
|
|
||||||
clone.transform(matrix)
|
|
||||||
block_links.add_entity(clone)
|
|
||||||
else:
|
|
||||||
clone.transform(matrix)
|
|
||||||
block_links.add_entity(clone)
|
|
||||||
|
|
||||||
# --------------------------------------------------------- Hilfsfunktionen
|
# --------------------------------------------------------- Hilfsfunktionen
|
||||||
def extract_coords(planquadrat: str) -> tuple[float, float]:
|
def extract_coords(planquadrat: str) -> tuple[float, float]:
|
||||||
@@ -762,7 +128,7 @@ def import_block(block_name: str, from_doc, to_doc, winkel = None) -> None:
|
|||||||
- Stellt sicher, dass benutzte Layer im Ziel existieren (mit Eigenschaften)
|
- Stellt sicher, dass benutzte Layer im Ziel existieren (mit Eigenschaften)
|
||||||
- Übernimmt Basispunkt und Block-Layer, falls vorhanden
|
- Übernimmt Basispunkt und Block-Layer, falls vorhanden
|
||||||
"""
|
"""
|
||||||
|
msp2 = from_doc.modelspace()
|
||||||
src = from_doc.blocks[block_name]
|
src = from_doc.blocks[block_name]
|
||||||
att_def = {}
|
att_def = {}
|
||||||
if block_name == "Pinbereich":
|
if block_name == "Pinbereich":
|
||||||
@@ -816,15 +182,16 @@ def import_block(block_name: str, from_doc, to_doc, winkel = None) -> None:
|
|||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
# kopiert die elemente von dem element aus dem block und speichert diese in den block für dass Modelspace auf und # speichern der attdef elemente in eine Liste falks diese verhanden sind und gibt diese zurück
|
# kopiert die elemente von dem element aus dem block und speichert diese in den block für dass Modelspace auf und # speichern der attdef elemente in eine Liste falks diese verhanden sind und gibt diese zurück
|
||||||
|
|
||||||
for ent in src:
|
for ent in src:
|
||||||
copy = ent.copy()
|
copy = ent.copy()
|
||||||
|
|
||||||
if ent.dxftype() == "ATTDEF":
|
if ent.dxftype() == "ATTDEF":
|
||||||
att_def[ent.dxf.tag] =ent.dxf.text
|
att_def[ent.dxf.tag] =ent.dxf.text
|
||||||
if ent.dxftype() == "INSERT":
|
if ent.dxftype() == "INSERT":
|
||||||
|
|
||||||
import_block(ent.dxf.name,from_doc, to_doc,None)
|
import_block(ent.dxf.name,from_doc, to_doc,None)
|
||||||
tgt.add_entity(copy)
|
tgt.add_entity(copy)
|
||||||
|
|
||||||
if att_def != {}:
|
if att_def != {}:
|
||||||
return att_def
|
return att_def
|
||||||
|
|
||||||
@@ -880,8 +247,7 @@ def berechne_hoehe(csv_path, logger=None):
|
|||||||
|
|
||||||
def handle_ils_2_0_kreisel(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols,strecken_nachbarn,config,config_allgemein):
|
def handle_ils_2_0_kreisel(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols,strecken_nachbarn,config,config_allgemein):
|
||||||
# Erstelle Kreisel-Objekt aus merkmale
|
# Erstelle Kreisel-Objekt aus merkmale
|
||||||
kreisel = Kreisel.from_merkmale(teileid, x, y, merkmale)
|
kreisel = Kreisel.Kreisel.from_merkmale(teileid, x, y, merkmale)
|
||||||
|
|
||||||
block_scanner = "SCAN"
|
block_scanner = "SCAN"
|
||||||
block_separatoren = "S-LP"
|
block_separatoren = "S-LP"
|
||||||
scanner_x = kreisel.x
|
scanner_x = kreisel.x
|
||||||
@@ -921,8 +287,8 @@ def handle_ils_2_0_kreisel(msp, teileid, merkmale, x, y, doc, lib_doc, verbose,
|
|||||||
f"({pos[0]:.1f}, {pos[1]:.1f}), rot={rotation}")
|
f"({pos[0]:.1f}, {pos[1]:.1f}), rot={rotation}")
|
||||||
# Linien zeichnen
|
# Linien zeichnen
|
||||||
import_block("Pinbereich",lib_doc,doc)
|
import_block("Pinbereich",lib_doc,doc)
|
||||||
Kreisel.draw_kreisel_lines(msp, pos1, pos2, kreisel)
|
Kreisel.Kreisel.draw_kreisel_lines(msp, pos1, pos2, kreisel)
|
||||||
Kreisel.draw_kreisel_drehrichtung_markierung(msp, pos1, pos2, kreisel, lib_doc, doc, verbose)
|
Kreisel.Kreisel.draw_kreisel_drehrichtung_markierung(msp, pos1, pos2, kreisel, lib_doc, doc, verbose)
|
||||||
|
|
||||||
def handle_standard(msp, blocknames, teileid, x, y, lib_doc, doc, verbose):
|
def handle_standard(msp, blocknames, teileid, x, y, lib_doc, doc, verbose):
|
||||||
for blockname in blocknames:
|
for blockname in blocknames:
|
||||||
@@ -959,19 +325,21 @@ def handle_ils_2_0_eckrad(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, s
|
|||||||
|
|
||||||
def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config,config_allgemein):
|
def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config,config_allgemein):
|
||||||
#Vorbereitung der attributen
|
#Vorbereitung der attributen
|
||||||
|
|
||||||
|
gefaelle_objekt = Gefaellestrecke.from_merkmale(teileid,x,y,merkmale)
|
||||||
asoffset = float(config.get("ILS 2.0 Gefällestrecke", "asoffset"))
|
asoffset = float(config.get("ILS 2.0 Gefällestrecke", "asoffset"))
|
||||||
esoffset = float(config.get("ILS 2.0 Gefällestrecke", "esoffset"))
|
esoffset = float(config.get("ILS 2.0 Gefällestrecke", "esoffset"))
|
||||||
upper_hoehe_gefaehlle= float(merkmale.get("Höhe oben")) *1000
|
upper_hoehe_gefaehlle= gefaelle_objekt.h1
|
||||||
lower_hoehe_gefaehlle = float(merkmale.get("Höhe unten")) * 1000
|
lower_hoehe_gefaehlle = gefaelle_objekt.h0
|
||||||
hoehe_gefaehlle = (upper_hoehe_gefaehlle + lower_hoehe_gefaehlle)/2
|
hoehe_gefaehlle = gefaelle_objekt.hight_zwischen
|
||||||
laenge_m = merkmale.get("Länge in Meter", "10").replace(",", ".")
|
laenge = gefaelle_objekt.laenge
|
||||||
try:
|
|
||||||
laenge = float(laenge_m) * 1000 # Meter → mm
|
|
||||||
except ValueError:
|
|
||||||
laenge = 10000
|
|
||||||
halbe_laenge = laenge / 2
|
halbe_laenge = laenge / 2
|
||||||
rotation= float(merkmale.get("Drehung"))
|
rotation= gefaelle_objekt.drehung
|
||||||
|
winkel = math.radians(float(rotation))
|
||||||
|
dx = halbe_laenge *math.sin(winkel * -1)
|
||||||
|
dy = halbe_laenge * math.cos(winkel)
|
||||||
|
start = x +dx, y + dy,upper_hoehe_gefaehlle
|
||||||
if "6-SP" not in doc.layers:
|
if "6-SP" not in doc.layers:
|
||||||
doc.layers.add(name="6-SP", color=7)
|
doc.layers.add(name="6-SP", color=7)
|
||||||
verbunden_am_einen = False
|
verbunden_am_einen = False
|
||||||
@@ -984,13 +352,10 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
|||||||
richtung2 ="DEFAULT"
|
richtung2 ="DEFAULT"
|
||||||
unterschiedlich = False
|
unterschiedlich = False
|
||||||
|
|
||||||
winkel = math.radians(float(rotation))
|
|
||||||
dx = halbe_laenge *math.sin(winkel * -1)
|
|
||||||
dy = halbe_laenge * math.cos(winkel)
|
|
||||||
start = x +dx, y + dy,upper_hoehe_gefaehlle
|
|
||||||
|
|
||||||
separatoren =float(merkmale.get("Anzahl der Separatoren"))
|
separatoren = gefaelle_objekt.anzahl_separatoren
|
||||||
scanner = float(merkmale.get("Anzahl der Scanner"))
|
scanner = gefaelle_objekt.anzahl_scanner
|
||||||
if rotation == 0 or rotation == -180:
|
if rotation == 0 or rotation == -180:
|
||||||
ausrichtung = "V"
|
ausrichtung = "V"
|
||||||
else:
|
else:
|
||||||
@@ -1185,8 +550,6 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
|||||||
a.is_invisible = True
|
a.is_invisible = True
|
||||||
|
|
||||||
elif "Drehung0" in gefaellestrecke_nachbarn and "Drehung1" in gefaellestrecke_nachbarn:
|
elif "Drehung0" in gefaellestrecke_nachbarn and "Drehung1" in gefaellestrecke_nachbarn:
|
||||||
winkel = math.radians(float(merkmale.get("Drehung")))
|
|
||||||
halbe_laenge = laenge / 2
|
|
||||||
dx = halbe_laenge *math.sin(winkel * -1)
|
dx = halbe_laenge *math.sin(winkel * -1)
|
||||||
dy = halbe_laenge * math.cos(winkel)
|
dy = halbe_laenge * math.cos(winkel)
|
||||||
drehung0 =gefaellestrecke_nachbarn.get("Drehung0")
|
drehung0 =gefaellestrecke_nachbarn.get("Drehung0")
|
||||||
@@ -1397,18 +760,10 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
|||||||
else:
|
else:
|
||||||
hat_umlenk_1 = True
|
hat_umlenk_1 = True
|
||||||
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{hoehe_gefaehlle}_{hat_motor_0}_{hat_umlenk_0}_{tefkurve_0}_{hat_motor_1}_{hat_umlenk_1}_{tefkurve_1}"
|
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{hoehe_gefaehlle}_{hat_motor_0}_{hat_umlenk_0}_{tefkurve_0}_{hat_motor_1}_{hat_umlenk_1}_{tefkurve_1}"
|
||||||
halbe_laenge = laenge / 2
|
|
||||||
dy = halbe_laenge * math.cos(0)
|
dy = halbe_laenge * math.cos(0)
|
||||||
start = [x , y + dy ,upper_hoehe_gefaehlle]
|
start = [x , y + dy ,upper_hoehe_gefaehlle]
|
||||||
ende = [x , y - dy ,lower_hoehe_gefaehlle]
|
ende = [x , y - dy ,lower_hoehe_gefaehlle]
|
||||||
if hat_motor_0 == False and hat_umlenk_0 == False and hat_motor_1 == False and hat_umlenk_1 == False:
|
if hat_motor_0 == False and hat_umlenk_0 == False and hat_motor_1 == False and hat_umlenk_1 == False:
|
||||||
laenge_m = merkmale.get("Länge in Meter", "10").replace(",", ".")
|
|
||||||
try:
|
|
||||||
laenge = float(laenge_m) * 1000 # Meter → mm
|
|
||||||
except ValueError:
|
|
||||||
laenge = 10000
|
|
||||||
winkel = math.radians(float(merkmale.get("Drehung")))
|
|
||||||
halbe_laenge = laenge / 2
|
|
||||||
dx = halbe_laenge *math.sin(winkel * -1)
|
dx = halbe_laenge *math.sin(winkel * -1)
|
||||||
dy = halbe_laenge * math.cos(winkel)
|
dy = halbe_laenge * math.cos(winkel)
|
||||||
start = x +dx, y + dy,upper_hoehe_gefaehlle
|
start = x +dx, y + dy,upper_hoehe_gefaehlle
|
||||||
@@ -1477,7 +832,7 @@ def add_attributes_to_block(block, attributes):
|
|||||||
a.is_invisible = True
|
a.is_invisible = True
|
||||||
|
|
||||||
def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config,config_allgemein):
|
def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config,config_allgemein):
|
||||||
foerderer = VarioFoerderer.from_merkmale(teileid,x,y,merkmale)
|
foerderer = VarioFoerderer.VarioFoerderer.from_merkmale(teileid,x,y,merkmale)
|
||||||
# für spätere Namens benenung der Vario forderer
|
# für spätere Namens benenung der Vario forderer
|
||||||
motor_vorhanden = foerderer.hat_motor
|
motor_vorhanden = foerderer.hat_motor
|
||||||
umlenk_vorhanden = foerderer.hat_umlenk
|
umlenk_vorhanden = foerderer.hat_umlenk
|
||||||
@@ -1508,7 +863,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
|
|||||||
hoehe_vario= foerderer.hight_zwischen
|
hoehe_vario= foerderer.hight_zwischen
|
||||||
separatoren = foerderer.anzahl_separatoren
|
separatoren = foerderer.anzahl_separatoren
|
||||||
scanner = foerderer.anzahl_scanner
|
scanner = foerderer.anzahl_scanner
|
||||||
if rotation == 0 or rotation == -180:
|
if rotation == 0.0 or rotation == -180.0:
|
||||||
ausrichtung = "V"
|
ausrichtung = "V"
|
||||||
else:
|
else:
|
||||||
ausrichtung = "H"
|
ausrichtung = "H"
|
||||||
@@ -1790,7 +1145,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
|
|||||||
block_vario.add_entity(copy)
|
block_vario.add_entity(copy)
|
||||||
|
|
||||||
# Erstellung des Vario_förderes selber
|
# Erstellung des Vario_förderes selber
|
||||||
VarioFoerderer.vario_erstellung(foerderer, doc, lib_doc, config, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
VarioFoerderer.VarioFoerderer.vario_erstellung(foerderer, doc, lib_doc, config, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
||||||
# reintuen des förderes in den Modelspace
|
# reintuen des förderes in den Modelspace
|
||||||
if merkmale.get("Motorseite")== "links":
|
if merkmale.get("Motorseite")== "links":
|
||||||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||||||
@@ -1819,7 +1174,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
|
|||||||
|
|
||||||
start, ende =erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario, drehung0, laenge, blockname,config,None ,block_vario, voerder_richtung, ein_kreisel_höher,None,None,None,mit_horizontal_verbunden)
|
start, ende =erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario, drehung0, laenge, blockname,config,None ,block_vario, voerder_richtung, ein_kreisel_höher,None,None,None,mit_horizontal_verbunden)
|
||||||
# Erstellung des Varios selber
|
# Erstellung des Varios selber
|
||||||
VarioFoerderer.vario_erstellung(foerderer, doc, lib_doc, config, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
VarioFoerderer.VarioFoerderer.vario_erstellung(foerderer, doc, lib_doc, config, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
||||||
# reintuen des förderes in den Modelspace
|
# reintuen des förderes in den Modelspace
|
||||||
if merkmale.get("Motorseite")== "links":
|
if merkmale.get("Motorseite")== "links":
|
||||||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||||||
@@ -1912,7 +1267,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
|
|||||||
copy.translate(-x,-y,-hoehe_vario)
|
copy.translate(-x,-y,-hoehe_vario)
|
||||||
block_vario.add_entity(copy)
|
block_vario.add_entity(copy)
|
||||||
# Die Vario erstellung selber
|
# Die Vario erstellung selber
|
||||||
VarioFoerderer.vario_erstellung(foerderer,doc, lib_doc, config, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
VarioFoerderer.VarioFoerderer.vario_erstellung(foerderer,doc, lib_doc, config, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
||||||
# reintuen des förderes in den Modelspace
|
# reintuen des förderes in den Modelspace
|
||||||
if merkmale.get("Motorseite")== "links":
|
if merkmale.get("Motorseite")== "links":
|
||||||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||||||
@@ -1991,7 +1346,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
|
|||||||
# Entnehmen von start und end Werte für spätere vario erstellung
|
# Entnehmen von start und end Werte für spätere vario erstellung
|
||||||
start, ende =gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario,richtung2, drehung0, drehung1, laenge, None, blockname,config,block_vario,voerder_richtung, am_kreisel,erster_kreisel_höher,y1,z1)
|
start, ende =gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario,richtung2, drehung0, drehung1, laenge, None, blockname,config,block_vario,voerder_richtung, am_kreisel,erster_kreisel_höher,y1,z1)
|
||||||
# Erstellung der Vario gefälle selber
|
# Erstellung der Vario gefälle selber
|
||||||
VarioFoerderer.vario_erstellung(foerderer, doc, lib_doc, config, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
VarioFoerderer.VarioFoerderer.vario_erstellung(foerderer, doc, lib_doc, config, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
||||||
# Reintuen des endblockes in den Modelspace
|
# Reintuen des endblockes in den Modelspace
|
||||||
if merkmale.get("Motorseite")== "links":
|
if merkmale.get("Motorseite")== "links":
|
||||||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||||||
@@ -2020,7 +1375,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
|
|||||||
|
|
||||||
start, ende =gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario,richtung2, drehung0, drehung1, laenge, None, blockname,config,block_vario,voerder_richtung)
|
start, ende =gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario,richtung2, drehung0, drehung1, laenge, None, blockname,config,block_vario,voerder_richtung)
|
||||||
# Erstellung des Vario selber
|
# Erstellung des Vario selber
|
||||||
VarioFoerderer.vario_erstellung(foerderer, doc, lib_doc, config, block_vario,block_name_links, start, ende,voerder_richtung,winkel_VP_offset_vorne,winkel_VP_offset_hinten )
|
VarioFoerderer.VarioFoerderer.vario_erstellung(foerderer, doc, lib_doc, config, block_vario,block_name_links, start, ende,voerder_richtung,winkel_VP_offset_vorne,winkel_VP_offset_hinten )
|
||||||
# Reintuen des endblockes in den Modelspace
|
# Reintuen des endblockes in den Modelspace
|
||||||
if merkmale.get("Motorseite")== "links":
|
if merkmale.get("Motorseite")== "links":
|
||||||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||||||
@@ -2051,7 +1406,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
|
|||||||
ende = (x ,y -dy, lower_hoehe_vario)
|
ende = (x ,y -dy, lower_hoehe_vario)
|
||||||
# Erstellung des Förderes selber
|
# Erstellung des Förderes selber
|
||||||
|
|
||||||
VarioFoerderer.vario_erstellung(foerderer, doc, lib_doc, config, block,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
VarioFoerderer.VarioFoerderer.vario_erstellung(foerderer, doc, lib_doc, config, block,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
||||||
# Reintuen des endblockes in den Modelspace
|
# Reintuen des endblockes in den Modelspace
|
||||||
if merkmale.get("Motorseite")== "links":
|
if merkmale.get("Motorseite")== "links":
|
||||||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||||||
@@ -2065,16 +1420,10 @@ def handle_ils_2_0_kurve_angetrieben(msp, teileid, merkmale, x, y, doc, lib_doc,
|
|||||||
h1 = float(merkmale.get("Höhe Ende")) * 1000
|
h1 = float(merkmale.get("Höhe Ende")) * 1000
|
||||||
h_zwischen = (h0 +h1)/2
|
h_zwischen = (h0 +h1)/2
|
||||||
antriebNebenStrecke = merkmale.get("AntriebNebenStrecke")
|
antriebNebenStrecke = merkmale.get("AntriebNebenStrecke")
|
||||||
if antriebNebenStrecke == "links":
|
if antriebNebenStrecke == "Aussen":
|
||||||
if kurvenrichtung == "links":
|
antriebstecke = "außen"
|
||||||
antriebstecke = "innen"
|
else:
|
||||||
else:
|
antriebstecke = "innen"
|
||||||
antriebstecke = "außen"
|
|
||||||
else:
|
|
||||||
if kurvenrichtung == "links":
|
|
||||||
antriebstecke = "außen"
|
|
||||||
else:
|
|
||||||
antriebstecke = "innen"
|
|
||||||
|
|
||||||
|
|
||||||
rotation = float(merkmale.get("Drehung"))
|
rotation = float(merkmale.get("Drehung"))
|
||||||
@@ -2729,7 +2078,7 @@ def get_rotations_of_strecken(csv_path:Path) -> dict:
|
|||||||
x, y = extract_coords(planquadrat)
|
x, y = extract_coords(planquadrat)
|
||||||
merkmale = parse_merkmale(row.get("Merkmale", ""))
|
merkmale = parse_merkmale(row.get("Merkmale", ""))
|
||||||
# Erstelle Kreisel-Objekt
|
# Erstelle Kreisel-Objekt
|
||||||
kreisel_obj = Kreisel.from_merkmale(Id, x, y, merkmale)
|
kreisel_obj = Kreisel.Kreisel.from_merkmale(Id, x, y, merkmale)
|
||||||
# Für Kompatibilität auch als Dict speichern (für bestehende Code-Stellen)
|
# Für Kompatibilität auch als Dict speichern (für bestehende Code-Stellen)
|
||||||
kreisel.append({
|
kreisel.append({
|
||||||
"Id": Id,
|
"Id": Id,
|
||||||
@@ -2744,10 +2093,13 @@ def get_rotations_of_strecken(csv_path:Path) -> dict:
|
|||||||
Id = row["TeileId"].strip()
|
Id = row["TeileId"].strip()
|
||||||
NachbarIds = row["NachbarIds"].strip()
|
NachbarIds = row["NachbarIds"].strip()
|
||||||
merkmale = parse_merkmale(row.get("Merkmale", ""))
|
merkmale = parse_merkmale(row.get("Merkmale", ""))
|
||||||
winkel = merkmale.get("Winkel")
|
planquadrat = row["Planquadrat"]
|
||||||
h0 = float(merkmale.get("Höhe Anfang")) * 1000
|
x, y = extract_coords(planquadrat)
|
||||||
h1 = float(merkmale.get("Höhe Ende")) * 1000
|
foerderer_objekt = VarioFoerderer.VarioFoerderer.from_merkmale(Id, x,y,merkmale)
|
||||||
foerderrichtung = merkmale.get("Förderrichtung")
|
winkel = foerderer_objekt.winkel
|
||||||
|
h0 = foerderer_objekt.h0
|
||||||
|
h1 = foerderer_objekt.h1
|
||||||
|
foerderrichtung = foerderer_objekt.foerderer_richtung
|
||||||
geraden.append({"Id": Id,"NachbarIds":NachbarIds, "Winkel":winkel, "h0": h0,"h1": h1,"Foerderrichtung":foerderrichtung })
|
geraden.append({"Id": Id,"NachbarIds":NachbarIds, "Winkel":winkel, "h0": h0,"h1": h1,"Foerderrichtung":foerderrichtung })
|
||||||
if bezeichner =="ILS 2.0 Kurve angetrieben":
|
if bezeichner =="ILS 2.0 Kurve angetrieben":
|
||||||
Id = row["TeileId"].strip()
|
Id = row["TeileId"].strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user