Refactor eckrad

This commit is contained in:
2026-01-23 10:57:56 +01:00
parent a2fc823341
commit 4c071362a1
4 changed files with 22 additions and 20 deletions
+20 -2
View File
@@ -1,6 +1,7 @@
from pydantic import BaseModel, Field, field_validator from pydantic import BaseModel, Field, field_validator
from typing import Optional from typing import Optional
import block_methoden
RADIUS = 400
class Eckrad(BaseModel): class Eckrad(BaseModel):
teileid: str teileid: str
drehung: Optional [float] = Field(default=0.0,description="Rotation des Elements") drehung: Optional [float] = Field(default=0.0,description="Rotation des Elements")
@@ -27,4 +28,21 @@ class Eckrad(BaseModel):
y = y, y = y,
hoehe = hoehe, hoehe = hoehe,
drehrichtung = drehrichtung drehrichtung = drehrichtung
) )
def erstellung_eckrad_richtung(merkmale, doc, lib_doc):
block_methoden.import_block("AN8",lib_doc,doc)
block_methoden.import_block("Richtungspfeil",lib_doc,doc)
eckrad_rechts = "eckrad_UZS"
eckrad_links = "eckrad_GUZS"
hight = float(merkmale.get("Höhe in m")) * 1000
# Erstellung der Richtungung Blöcke der Eckrads
if eckrad_rechts not in doc.blocks:
block_rechts = doc.blocks.new(name= eckrad_rechts,base_point=(0,0,0))
block_links = doc.blocks.new(name= eckrad_links,base_point=(0,0,0))
block_rechts.add_blockref("AN8",(0,0,0))
block_links.add_blockref("AN8",(0,0,0))
block_rechts.add_blockref("Richtungspfeil",(0+200,0+ RADIUS,0))
block_rechts.add_blockref("Richtungspfeil",(0-200,0- RADIUS,0),dxfattribs={"rotation": 180})
block_links.add_blockref("Richtungspfeil",(0+200,0- RADIUS,0))
block_links.add_blockref("Richtungspfeil",(0-200,0+ RADIUS,0),dxfattribs={"rotation": 180})
return eckrad_rechts,eckrad_links,hight
-1
View File
@@ -605,7 +605,6 @@ class VarioFoerderer(BaseModel):
elif voerder_richtung == "Ab": 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 # 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 gefaelle > 0:
if motor_vorhanden == True and umlenk_vorhanden == True: if motor_vorhanden == True and umlenk_vorhanden == True:
halbesgefaelle = gefaelle/2 halbesgefaelle = gefaelle/2
-1
View File
@@ -162,7 +162,6 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
layer, color = block_methoden.get_insert_color_layer(lib_doc,block_es) layer, color = block_methoden.get_insert_color_layer(lib_doc,block_es)
elif (((drehung0 == "UZS" and drehung1 == "UZS")or elif (((drehung0 == "UZS" and drehung1 == "UZS")or
(am_kreisel!= None and drehung0 == "UZS" and drehung1 == "UZS")) or (am_kreisel!= None and drehung0 == "UZS" and drehung1 == "UZS")) or
(drehung0 == "GUZS" and drehung1 == "UZS" and hight_position == "lower")or (drehung0 == "GUZS" and drehung1 == "UZS" and hight_position == "lower")or
+2 -16
View File
@@ -68,22 +68,7 @@ def handle_ils_2_0_kreisel(msp, teileid, merkmale, x, y, doc, lib_doc, verbose,
def handle_ils_2_0_eckrad(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config,config_allgemein): def handle_ils_2_0_eckrad(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config,config_allgemein):
"""Erstellt ein Eckrad in der neuen Dxf""" """Erstellt ein Eckrad in der neuen Dxf"""
block_methoden.import_block("AN8",lib_doc,doc) eckrad_rechts, eckrad_links, hight = Eckrad.Eckrad.erstellung_eckrad_richtung(merkmale, doc, lib_doc)
block_methoden.import_block("Richtungspfeil",lib_doc,doc)
eckrad_rechts = "eckrad_UZS"
eckrad_links = "eckrad_GUZS"
hight = float(merkmale.get("Höhe in m")) * 1000
# Erstellung der Richtungung Blöcke der Eckrads
if eckrad_rechts not in doc.blocks:
block_rechts = doc.blocks.new(name= eckrad_rechts,base_point=(0,0,0))
block_links = doc.blocks.new(name= eckrad_links,base_point=(0,0,0))
block_rechts.add_blockref("AN8",(0,0,0))
block_links.add_blockref("AN8",(0,0,0))
block_rechts.add_blockref("Richtungspfeil",(0+200,0+ RADIUS,0))
block_rechts.add_blockref("Richtungspfeil",(0-200,0- RADIUS,0),dxfattribs={"rotation": 180})
block_links.add_blockref("Richtungspfeil",(0+200,0- RADIUS,0))
block_links.add_blockref("Richtungspfeil",(0-200,0+ RADIUS,0),dxfattribs={"rotation": 180})
if merkmale.get("Drehrichtung") == "UZS": if merkmale.get("Drehrichtung") == "UZS":
msp.add_blockref(eckrad_rechts,(x,y,hight)) msp.add_blockref(eckrad_rechts,(x,y,hight))
elif merkmale.get("Drehrichtung") == "GUZS": elif merkmale.get("Drehrichtung") == "GUZS":
@@ -91,6 +76,7 @@ def handle_ils_2_0_eckrad(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, s
else: else:
msp.add_blockref("AN8",(x,y,hight)) msp.add_blockref("AN8",(x,y,hight))
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):
"""Erstellt eine Gefällestrecke in der neuen Dxf""" """Erstellt eine Gefällestrecke in der neuen Dxf"""
#Vorbereitung der attributen #Vorbereitung der attributen