Block_methoden in einen eigen File refactored
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
import math
|
||||
import re
|
||||
import plant2dxf
|
||||
import math
|
||||
from ezdxf.math import Matrix44
|
||||
import block_methoden
|
||||
|
||||
|
||||
class Gefaellestrecke(BaseModel):
|
||||
@@ -22,7 +24,6 @@ class Gefaellestrecke(BaseModel):
|
||||
|
||||
@classmethod
|
||||
def from_merkmale(cls, teileid: str, x: float, y: float, merkmale: dict) -> 'Gefaellestrecke':
|
||||
|
||||
h0 = float(merkmale.get("Höhe unten")) * 1000
|
||||
h1 = float(merkmale.get("Höhe oben")) * 1000
|
||||
laenge = float(merkmale.get("Länge in Meter")) * 1000
|
||||
@@ -37,6 +38,79 @@ class Gefaellestrecke(BaseModel):
|
||||
anzahl_scanner = int(merkmale.get("Anzahl der Scanner")),
|
||||
anzahl_separatoren = int(merkmale.get("Anzahl der Separatoren"))
|
||||
)
|
||||
|
||||
def ein_motor_oder_eine_umlenk(x, y,start,ende, doc, lib_doc, hoehe_gefaehlle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_0, hat_umlenk_0, tefkurve_0, block,umlenk_gerade,motor_gerade):
|
||||
|
||||
block_Vario_Bogen_auf = (f"Vario_Bogen_auf_3°")
|
||||
block_Vario_Bogen_ab = (f"Vario_Bogen_ab_3°")
|
||||
block_Vario_Bogen_auf_links = (f"Vario_Bogen_auf_3°") + "_links"
|
||||
block_Vario_Bogen_ab_links = (f"Vario_Bogen_ab_3°") + "_links"
|
||||
auf_attrib = block_methoden.import_block(block_Vario_Bogen_auf,lib_doc,doc)
|
||||
ab_attrib = block_methoden.import_block(block_Vario_Bogen_ab,lib_doc,doc)
|
||||
Vario_Bogen_auf_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_attrib["DELTA_SP_0"]))
|
||||
Vario_Bogen_auf_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_SP_1"]))
|
||||
Vario_Bogen_ab_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_0"]))
|
||||
Vario_Bogen_ab_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_1"]))
|
||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_0):
|
||||
if wert < 0:
|
||||
Vario_Bogen_auf_Delta_SP_0[i] = abs(wert)
|
||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_1):
|
||||
if wert< 0:
|
||||
Vario_Bogen_auf_Delta_SP_1[i] = abs(wert)
|
||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_0):
|
||||
if wert< 0:
|
||||
Vario_Bogen_ab_Delta_SP_0[i] = abs(wert)
|
||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_1):
|
||||
if wert< 0:
|
||||
Vario_Bogen_ab_Delta_SP_1[i] = abs(wert)
|
||||
block_methoden.turn_two_blocks_left(doc, block_Vario_Bogen_auf, block_Vario_Bogen_ab, block_Vario_Bogen_ab_links, block_Vario_Bogen_auf_links)
|
||||
if hat_motor_0 == True:
|
||||
if tefkurve_0 == "rechts":
|
||||
if motor_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_ab,(start[0]-x,start[1]-Vario_Bogen_ab_Delta_SP_0[0]-y,start[2]- Vario_Bogen_ab_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start = [start[0],start[1]-Vario_Bogen_ab_Delta_SP_0[0]- Vario_Bogen_ab_Delta_SP_1[0],start[2]-Vario_Bogen_ab_Delta_SP_0[2]- Vario_Bogen_ab_Delta_SP_1[2]]
|
||||
block.add_blockref(blockname_motor_links, (start[0]-x,start[1] - 250* math.cos(math.radians(3))-y,start[2] - 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500* math.cos(math.radians(3))
|
||||
start[2] = start[2] - 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Motorstation_500mm", (start[0]-x,start[1] -y,start[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500
|
||||
|
||||
else:
|
||||
if motor_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_ab_links,(start[0]-x,start[1]-Vario_Bogen_ab_Delta_SP_0[0]-y,start[2]- Vario_Bogen_ab_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start = [start[0],start[1]-Vario_Bogen_ab_Delta_SP_0[0]- Vario_Bogen_ab_Delta_SP_1[0],start[2]-Vario_Bogen_ab_Delta_SP_0[2]- Vario_Bogen_ab_Delta_SP_1[2]]
|
||||
block.add_blockref(block_Vario_Motorstation_500mm, (start[0]-x,start[1] - 250* math.cos(math.radians(3))-y,start[2] - 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500* math.cos(math.radians(3))
|
||||
start[2] = start[2] - 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Motorstation_500mm_links", (start[0]-x,start[1] -y,start[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500
|
||||
|
||||
if hat_umlenk_0 == True:
|
||||
if tefkurve_0 == "rechts":
|
||||
if umlenk_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_auf_links,(ende[0]-x,ende[1]+Vario_Bogen_auf_Delta_SP_0[0]-y,ende[2] + Vario_Bogen_auf_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 90})
|
||||
ende = [ende[0],ende[1]+ Vario_Bogen_auf_Delta_SP_0[0]+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]+Vario_Bogen_auf_Delta_SP_0[2]+ Vario_Bogen_auf_Delta_SP_1[2]]
|
||||
block.add_blockref(blockname_umlenk_links, (ende[0]-x,ende[1] + 250* math.cos(math.radians(3))-y,ende[2] + 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
|
||||
ende [1]= ende[1] + 500* math.cos(math.radians(3))
|
||||
ende[2] = ende[2] + 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Umlenkstation_500mm", (ende[0]-x,ende[1] + 250-y,ende[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
ende [1]= ende[1] + 500
|
||||
|
||||
else:
|
||||
if umlenk_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_auf,(ende[0]-x,ende[1]+Vario_Bogen_auf_Delta_SP_0[0]-y,ende[2] + Vario_Bogen_auf_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 90})
|
||||
ende = [ende[0],ende[1]+ Vario_Bogen_auf_Delta_SP_0[0]+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]+Vario_Bogen_auf_Delta_SP_0[2]+ Vario_Bogen_auf_Delta_SP_1[2]]
|
||||
block.add_blockref(block_Vario_Umlenkstation_500mm, (ende[0]-x,ende[1] + 250* math.cos(math.radians(3))-y,ende[2] + 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
ende [1]= ende[1] + 500* math.cos(math.radians(3))
|
||||
ende[2] = ende[2] + 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Umlenkstation_500mm", (ende[0]-x,ende[1] + 250-y,ende[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
ende [1]= ende[1] + 500
|
||||
return start,ende
|
||||
def hat_motor_umlenk_station (gefaelle_objekt, gefaellestrecke_nachbarn):
|
||||
hat_motor_0 = None
|
||||
hat_motor_1 = None
|
||||
@@ -52,7 +126,6 @@ class Gefaellestrecke(BaseModel):
|
||||
x = gefaelle_objekt.x
|
||||
y = gefaelle_objekt.y
|
||||
|
||||
|
||||
if "Kurvenrichtung" in gefaellestrecke_nachbarn:
|
||||
vario_hoehe_0 = float(gefaellestrecke_nachbarn.get("vario_hoehe_0"))
|
||||
vario_hoehe_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_1"))
|
||||
|
||||
@@ -4,6 +4,7 @@ import math
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
from typing import Optional
|
||||
import plant2dxf
|
||||
import block_methoden
|
||||
|
||||
|
||||
ATTR_TAG = "TeileId" # Attributtag im Block
|
||||
@@ -218,8 +219,8 @@ class Kreisel(BaseModel):
|
||||
rotation = math.degrees(math.atan2(p2_oben[1] - p1_oben[1], p2_oben[0] - p1_oben[0]))
|
||||
if drehrichtung == "GUZS":
|
||||
rotation += 180
|
||||
plant2dxf.import_block("Richtungspfeil", lib_doc, doc)
|
||||
blockref_layer, color = plant2dxf.get_insert_color_layer(lib_doc, "Richtungspfeil")
|
||||
block_methoden.import_block("Richtungspfeil", lib_doc, doc)
|
||||
blockref_layer, color = block_methoden.get_insert_color_layer(lib_doc, "Richtungspfeil")
|
||||
bref = msp.add_blockref("Richtungspfeil", (px, py,z1), dxfattribs={"rotation": rotation,"layer": blockref_layer})
|
||||
if verbose:
|
||||
print(f"[INFO] Drehrichtung '{drehrichtung}': Richtungspfeil oben bei ({px:.1f}, {py:.1f}), rot={rotation:.1f}")
|
||||
@@ -231,8 +232,8 @@ class Kreisel(BaseModel):
|
||||
rotation = math.degrees(math.atan2(p2_unten[1] - p1_unten[1], p2_unten[0] - p1_unten[0]))
|
||||
if drehrichtung == "UZS":
|
||||
rotation += 180
|
||||
plant2dxf.import_block("Richtungspfeil", lib_doc, doc)
|
||||
blockref_layer, color = plant2dxf.get_insert_color_layer( lib_doc, "Richtungspfeil")
|
||||
block_methoden.import_block("Richtungspfeil", lib_doc, doc)
|
||||
blockref_layer, color = block_methoden.get_insert_color_layer( lib_doc, "Richtungspfeil")
|
||||
bref = msp.add_blockref("Richtungspfeil", (px, py, z1), dxfattribs={"rotation": rotation , "layer": blockref_layer})
|
||||
if verbose:
|
||||
print(f"[INFO] Drehrichtung '{drehrichtung}':Richtungspfeil unten bei ({px:.1f}, {py:.1f}), rot={rotation:.1f}")
|
||||
@@ -4,6 +4,7 @@ import math
|
||||
from pydantic import BaseModel, Field, field_validator
|
||||
from typing import Optional
|
||||
import plant2dxf
|
||||
import block_methoden
|
||||
class Omniflo(BaseModel):
|
||||
teileid:str
|
||||
x:float
|
||||
@@ -68,8 +69,8 @@ class Omniflo(BaseModel):
|
||||
else:
|
||||
linie.dxf.layer = "A-2"
|
||||
def omniflo_foerdererstellung(msp, x, y, doc, lib_doc, omniflo_objekt, rotation):
|
||||
plant2dxf.import_block("bogen1",lib_doc,doc)
|
||||
plant2dxf.import_block("bogen2",lib_doc,doc)
|
||||
block_methoden.import_block("bogen1",lib_doc,doc)
|
||||
block_methoden.import_block("bogen2",lib_doc,doc)
|
||||
|
||||
laenge = omniflo_objekt.laenge
|
||||
h0 = omniflo_objekt.h0
|
||||
|
||||
@@ -5,6 +5,8 @@ from typing import Optional
|
||||
import plant2dxf
|
||||
from ezdxf.math import Matrix44
|
||||
import re
|
||||
import block_methoden
|
||||
|
||||
|
||||
class VarioFoerderer(BaseModel):
|
||||
teileid: str
|
||||
@@ -77,7 +79,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel")) +3
|
||||
winkel_vorne = int(gefaellestrecke_vario.get("Winkel"))
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
|
||||
VP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_0"]))
|
||||
# Ausrechnen des Offsets
|
||||
@@ -89,7 +91,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_vorne = int(gefaellestrecke_vario.get("Winkel"))
|
||||
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_vorne_minusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
|
||||
VP_0_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_0"]))
|
||||
# Ausrechnung des Offsets
|
||||
@@ -102,7 +104,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
|
||||
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_hinten_plusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_hinten =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_1"]))
|
||||
VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
|
||||
# Ausrechnung des Offsets
|
||||
@@ -114,7 +116,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
|
||||
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_hinten_minusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_hinten =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_1_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_1"]))
|
||||
VP_1_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
|
||||
# Ausrechnung des Offsets
|
||||
@@ -123,7 +125,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel")) +3
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_1"]))
|
||||
VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_1"]))
|
||||
SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
|
||||
@@ -139,13 +141,13 @@ class VarioFoerderer(BaseModel):
|
||||
((-270.0< rotation_zwischen< -90.0)and y < y_foerderer) or
|
||||
(rotation == -90.0 and x < x_foerderer) or ((rotation == -270.0)and x<x_foerderer)):
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
|
||||
VP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_0"]))
|
||||
winkel_VP_offset_vorne = (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.cos(math.radians(3)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.sin(math.radians(3)), VP_1_nachbar_vorne[1],- (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.sin(math.radians(3)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.cos(math.radians(3))
|
||||
else:
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_vorne_plusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_hinten =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_1"]))
|
||||
VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
|
||||
winkel_VP_offset_hinten = (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.cos(math.radians(-winkel_hinten)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.sin(math.radians(-winkel_hinten)), VP_0_nachbar_hinten[1],- (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.sin(math.radians(-winkel_hinten)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.cos(math.radians(-winkel_hinten))
|
||||
@@ -153,7 +155,7 @@ class VarioFoerderer(BaseModel):
|
||||
|
||||
else:
|
||||
blockname = (f"Vario_Kurve_{gefaellestrecke_vario.get("Kurvenrichtung")}_{gefaellestrecke_vario.get("Kurvenwinkel")}°_TEF_{gefaellestrecke_vario.get("Tefkurve")}")
|
||||
att_kurve = plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_kurve = block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_SP_0"]))
|
||||
VP_0_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_VP_0"]))
|
||||
SP_1_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_SP_1"]))
|
||||
@@ -197,7 +199,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel_2")) +3
|
||||
winkel_vorne = int(gefaellestrecke_vario.get("Winkel_2"))
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
|
||||
VP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_0"]))
|
||||
# Ausrechnen des Offsets
|
||||
@@ -209,7 +211,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_vorne = int(gefaellestrecke_vario.get("Winkel_2"))
|
||||
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_vorne_minusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
|
||||
VP_0_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_0"]))
|
||||
# Ausrechnung des Offsets
|
||||
@@ -222,7 +224,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel_2"))
|
||||
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_hinten_plusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_hinten =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_1"]))
|
||||
VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
|
||||
# Ausrechnung des Offsets
|
||||
@@ -234,7 +236,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel_2"))
|
||||
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_hinten_minusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_hinten =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_1_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_1"]))
|
||||
VP_1_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
|
||||
# Ausrechnung des Offsets
|
||||
@@ -243,7 +245,7 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel_2")) +3
|
||||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel_2"))
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_1"]))
|
||||
VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_1"]))
|
||||
SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
|
||||
@@ -259,19 +261,19 @@ class VarioFoerderer(BaseModel):
|
||||
((-270.0< rotation_zwischen< -90.0)and y < y_foerderer) or
|
||||
(rotation == -90.0 and x < x_foerderer) or ((rotation == -270.0)and x<x_foerderer)):
|
||||
blockname = (f"Vario_Bogen_auf_{winkel_vorne_plusbogen}°")
|
||||
att_vorne =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_vorne =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_0"]))
|
||||
VP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_0"]))
|
||||
winkel_VP_offset_vorne = (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.cos(math.radians(3)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.sin(math.radians(3)), VP_1_nachbar_vorne[1],- (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.sin(math.radians(3)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.cos(math.radians(3))
|
||||
else:
|
||||
blockname = (f"Vario_Bogen_ab_{winkel_vorne_plusbogen}°")
|
||||
att_hinten =plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_hinten =block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_1"]))
|
||||
VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_1"]))
|
||||
winkel_VP_offset_hinten = (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.cos(math.radians(-winkel_hinten)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.sin(math.radians(-winkel_hinten)), VP_0_nachbar_hinten[1],- (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.sin(math.radians(-winkel_hinten)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.cos(math.radians(-winkel_hinten))
|
||||
else:
|
||||
blockname = (f"Vario_Kurve_{gefaellestrecke_vario.get("Kurvenrichtung_1")}_{gefaellestrecke_vario.get("Kurvenwinkel_1")}°_TEF_{gefaellestrecke_vario.get("Tefkurve_1")}")
|
||||
att_kurve = plant2dxf.import_block(blockname,lib_doc,doc)
|
||||
att_kurve = block_methoden.import_block(blockname,lib_doc,doc)
|
||||
SP_0_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_SP_0"]))
|
||||
VP_0_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_VP_0"]))
|
||||
SP_1_nachbar = list(float(att)for att in re.split(r"[;,]", att_kurve["DELTA_SP_1"]))
|
||||
@@ -376,12 +378,12 @@ class VarioFoerderer(BaseModel):
|
||||
# Den Motorstaton und Umlenkstation auf die richtige position in block einfügen falls nötig
|
||||
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
|
||||
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
|
||||
plant2dxf.import_block(block_Vario_Motorstation_500mm, lib_doc, doc)
|
||||
plant2dxf.import_block(block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
||||
layer_motor, color_motor = plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Motorstation_500mm)
|
||||
layer_umlenk, color_umlenk = plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Umlenkstation_500mm)
|
||||
block_Vario_Motorstation_500mm = plant2dxf.dreh_block(block_Vario_Motorstation_500mm,doc,lib_doc,math.radians(winkel_motor))
|
||||
block_Vario_Umlenkstation_500mm = plant2dxf.dreh_block( block_Vario_Umlenkstation_500mm, doc,lib_doc,math.radians(winkel_umlenk))
|
||||
block_methoden.import_block(block_Vario_Motorstation_500mm, lib_doc, doc)
|
||||
block_methoden.import_block(block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
||||
layer_motor, color_motor = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Motorstation_500mm)
|
||||
layer_umlenk, color_umlenk = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Umlenkstation_500mm)
|
||||
block_Vario_Motorstation_500mm = block_methoden.dreh_block(block_Vario_Motorstation_500mm,doc,lib_doc,math.radians(winkel_motor))
|
||||
block_Vario_Umlenkstation_500mm = block_methoden.dreh_block( block_Vario_Umlenkstation_500mm, doc,lib_doc,math.radians(winkel_umlenk))
|
||||
if umlenk_vorhanden == True:
|
||||
block.add_blockref(block_Vario_Umlenkstation_500mm,(ende[0] -x,ende[1] -y + umlenk_offset_x/2,ende[2] - hoehe_vario -umlenk_offset_z/2 ),dxfattribs={"rotation": 90, "layer":layer_umlenk,"color": color_umlenk})
|
||||
ende = (ende[0] ,ende[1] + umlenk_offset_x,ende[2] - umlenk_offset_z)
|
||||
@@ -395,12 +397,12 @@ class VarioFoerderer(BaseModel):
|
||||
block_Vario_Bogen_auf = (f"Vario_Bogen_auf_{winkel_plus}°")
|
||||
block_Vario_Bogen_ab = (f"Vario_Bogen_ab_{winkel_plus}°")
|
||||
|
||||
auf_attrib =plant2dxf.import_block(block_Vario_Bogen_auf, lib_doc, doc)
|
||||
ab_attrib =plant2dxf.import_block(block_Vario_Bogen_ab, lib_doc, doc)
|
||||
layer_auf,color_auf = plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Bogen_auf)
|
||||
layer_ab,color_ab =plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Bogen_ab)
|
||||
block_Vario_Bogen_auf = plant2dxf.dreh_block(block_Vario_Bogen_auf, doc,lib_doc,math.radians(winkel_core))
|
||||
block_Vario_Bogen_ab = plant2dxf.dreh_block(block_Vario_Bogen_ab, doc,lib_doc,math.radians(-winkel))
|
||||
auf_attrib =block_methoden.import_block(block_Vario_Bogen_auf, lib_doc, doc)
|
||||
ab_attrib =block_methoden.import_block(block_Vario_Bogen_ab, lib_doc, doc)
|
||||
layer_auf,color_auf = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Bogen_auf)
|
||||
layer_ab,color_ab =block_methoden.get_insert_color_layer(lib_doc,block_Vario_Bogen_ab)
|
||||
block_Vario_Bogen_auf = block_methoden.dreh_block(block_Vario_Bogen_auf, doc,lib_doc,math.radians(winkel_core))
|
||||
block_Vario_Bogen_ab = block_methoden.dreh_block(block_Vario_Bogen_ab, doc,lib_doc,math.radians(-winkel))
|
||||
|
||||
|
||||
Vario_Bogen_auf_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_attrib["DELTA_SP_0"]))
|
||||
@@ -538,12 +540,12 @@ class VarioFoerderer(BaseModel):
|
||||
# Importieren und setzen der UMlenkungstation oder Motorstation falls nötig
|
||||
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
|
||||
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
|
||||
plant2dxf.import_block( block_Vario_Motorstation_500mm, lib_doc, doc)
|
||||
plant2dxf.import_block( block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
||||
layer_motor, color_motor = plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Motorstation_500mm)
|
||||
layer_umlenk, color_umlenk = plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Umlenkstation_500mm)
|
||||
block_Vario_Motorstation_500mm = plant2dxf.dreh_block( block_Vario_Motorstation_500mm, doc,lib_doc,math.radians(winkel_motor))
|
||||
block_Vario_Umlenkstation_500mm = plant2dxf.dreh_block( block_Vario_Umlenkstation_500mm , doc,lib_doc,math.radians(winkel_umlenk))
|
||||
block_methoden.import_block( block_Vario_Motorstation_500mm, lib_doc, doc)
|
||||
block_methoden.import_block( block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
||||
layer_motor, color_motor = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Motorstation_500mm)
|
||||
layer_umlenk, color_umlenk = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Umlenkstation_500mm)
|
||||
block_Vario_Motorstation_500mm = block_methoden.dreh_block( block_Vario_Motorstation_500mm, doc,lib_doc,math.radians(winkel_motor))
|
||||
block_Vario_Umlenkstation_500mm = block_methoden.dreh_block( block_Vario_Umlenkstation_500mm , doc,lib_doc,math.radians(winkel_umlenk))
|
||||
if umlenk_vorhanden == True:
|
||||
block.add_blockref(block_Vario_Umlenkstation_500mm,(start[0] -x,start[1] -y - umlenk_offset_x/2, start[2] - hoehe_vario -umlenk_offset_z/2 ),dxfattribs={"rotation": 270,"layer": layer_umlenk,"color": color_umlenk})
|
||||
start_Umlenkstation_VP = start[0] - vario_abstand, start[1] -500 *math.cos(math.radians(-winkel_umlenk))+ math.sin(math.radians(-winkel_umlenk))* -45,start[2] + math.sin(math.radians(-winkel_umlenk))*500+ math.cos(math.radians(-winkel_umlenk))*-45
|
||||
@@ -562,12 +564,12 @@ class VarioFoerderer(BaseModel):
|
||||
winkel_minus = winkel - winkel_core
|
||||
block_Vario_Bogen_auf = (f"Vario_Bogen_auf_{winkel_minus}°")
|
||||
block_Vario_Bogen_ab = (f"Vario_Bogen_ab_{winkel_minus}°")
|
||||
ab_attrib =plant2dxf.import_block( block_Vario_Bogen_ab , lib_doc, doc)
|
||||
auf_attrib =plant2dxf.import_block( block_Vario_Bogen_auf, lib_doc, doc)
|
||||
layer_auf,color_auf = plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Bogen_auf)
|
||||
layer_ab,color_ab =plant2dxf.get_insert_color_layer(lib_doc,block_Vario_Bogen_ab)
|
||||
block_Vario_Bogen_ab = plant2dxf.dreh_block( block_Vario_Bogen_ab, doc,lib_doc, math.radians(winkel_core))
|
||||
block_Vario_Bogen_auf= plant2dxf.dreh_block( block_Vario_Bogen_auf, doc,lib_doc, math.radians(winkel))
|
||||
ab_attrib =block_methoden.import_block( block_Vario_Bogen_ab , lib_doc, doc)
|
||||
auf_attrib =block_methoden.import_block( block_Vario_Bogen_auf, lib_doc, doc)
|
||||
layer_auf,color_auf = block_methoden.get_insert_color_layer(lib_doc,block_Vario_Bogen_auf)
|
||||
layer_ab,color_ab =block_methoden.get_insert_color_layer(lib_doc,block_Vario_Bogen_ab)
|
||||
block_Vario_Bogen_ab = block_methoden.dreh_block( block_Vario_Bogen_ab, doc,lib_doc, math.radians(winkel_core))
|
||||
block_Vario_Bogen_auf= block_methoden.dreh_block( block_Vario_Bogen_auf, doc,lib_doc, math.radians(winkel))
|
||||
Vario_Bogen_auf_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_attrib["DELTA_SP_0"]))
|
||||
Vario_Bogen_auf_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_SP_1"]))
|
||||
Vario_Bogen_ab_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_0"]))
|
||||
|
||||
+39
-38
@@ -1,6 +1,7 @@
|
||||
from ezdxf.entities import Line
|
||||
import math
|
||||
import plant2dxf
|
||||
import block_methoden
|
||||
|
||||
RADIUS = 400
|
||||
def erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle, drehung0, laenge,blockname,config, hight = None, block_vario = None, vario_richtung = None, verbungden_höher = None,gefaelle_block=None,start = None,ende = None,mit_horizontal_verbunden = None):
|
||||
@@ -19,29 +20,29 @@ def erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, upper
|
||||
if (( hight == "higher" and drehung0 == "GUZS" )or (vario_richtung == "Auf"and verbungden_höher == False and drehung0 == "GUZS")or
|
||||
(vario_richtung == "Ab" and verbungden_höher == True and drehung0 == "GUZS")or (vario_richtung == "Horizontal" and drehung0 == "GUZS" and (mit_horizontal_verbunden == "unten_drehung_0_or_-90" or mit_horizontal_verbunden == "oben_drehung_-180_or_-270"))):
|
||||
block_as = "200000241_AS-Element_90_rechts"
|
||||
plant2dxf.import_block(block_as,lib_doc,doc)
|
||||
layer, color = plant2dxf.get_insert_color_layer(lib_doc, block_as)
|
||||
block_methoden.import_block(block_as,lib_doc,doc)
|
||||
layer, color = block_methoden.get_insert_color_layer(lib_doc, block_as)
|
||||
|
||||
elif ((hight == "lower" and drehung0 == "GUZS") or (vario_richtung == "Auf"and verbungden_höher == True and drehung0 == "GUZS") or
|
||||
(vario_richtung == "Ab" and verbungden_höher == False and drehung0 == "GUZS")or (vario_richtung == "Horizontal" and drehung0 == "GUZS" and (mit_horizontal_verbunden == "oben_drehung_0_or_-90" or mit_horizontal_verbunden == "unten_drehung_-180_or_-270"))):
|
||||
block_es = "200000146_ES-Element_90_rechts"
|
||||
plant2dxf.import_block(block_es,lib_doc,doc)
|
||||
layer, color = plant2dxf.get_insert_color_layer(lib_doc, block_es)
|
||||
block_methoden.import_block(block_es,lib_doc,doc)
|
||||
layer, color = block_methoden.get_insert_color_layer(lib_doc, block_es)
|
||||
|
||||
elif ((hight == "higher" and drehung0 == "UZS")or (vario_richtung == "Auf"and verbungden_höher == False and drehung0 == "UZS") or
|
||||
(vario_richtung == "Ab" and verbungden_höher == True and drehung0 == "UZS")or (vario_richtung == "Horizontal" and drehung0 == "UZS" and (mit_horizontal_verbunden == "unten_drehung_0_or_-90" or mit_horizontal_verbunden == "oben_drehung_-180_or_-270"))):
|
||||
block_as = "200000217_AS-Element_90_links"
|
||||
plant2dxf.import_block(block_as,lib_doc,doc)
|
||||
layer, color = plant2dxf.get_insert_color_layer(lib_doc, block_as)
|
||||
block_methoden.import_block(block_as,lib_doc,doc)
|
||||
layer, color = block_methoden.get_insert_color_layer(lib_doc, block_as)
|
||||
|
||||
elif (( hight == "lower" and drehung0 == "UZS") or (vario_richtung == "Auf" and verbungden_höher == True and drehung0 == "UZS") or
|
||||
(vario_richtung == "Ab" and verbungden_höher == False and drehung0 == "UZS")or (vario_richtung == "Horizontal" and drehung0 == "UZS" and (mit_horizontal_verbunden == "oben_drehung_0_or_-90" or mit_horizontal_verbunden == "unten_drehung_-180_or_-270"))):
|
||||
block_es = "400102632_ES-Element_90_links"
|
||||
plant2dxf.import_block(block_es,lib_doc,doc)
|
||||
layer, color = plant2dxf.get_insert_color_layer(lib_doc, block_es)
|
||||
block_methoden.import_block(block_es,lib_doc,doc)
|
||||
layer, color = block_methoden.get_insert_color_layer(lib_doc, block_es)
|
||||
|
||||
if block_as != None:
|
||||
block_as = plant2dxf.dreh_block(block_as,doc,lib_doc,math.radians(winkel_as))
|
||||
block_as = block_methoden.dreh_block(block_as,doc,lib_doc,math.radians(winkel_as))
|
||||
if vario_richtung == "Auf" or vario_richtung =="Horizontal":
|
||||
start = (x , y + dy ,upper_hoehe_gefaehlle)
|
||||
ende = (x , y - dy + asoffset_y ,lower_hoehe_gefaehlle - asoffset_z)
|
||||
@@ -67,7 +68,7 @@ def erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, upper
|
||||
msp.add_blockref(block_as,(x,y,upper_hoehe_gefaehlle),dxfattribs={"layer":layer,"color":color})
|
||||
return True
|
||||
elif block_es != None:
|
||||
block_es = plant2dxf.dreh_block(block_es,doc,lib_doc,math.radians(winkel_es))
|
||||
block_es = block_methoden.dreh_block(block_es,doc,lib_doc,math.radians(winkel_es))
|
||||
if vario_richtung == "Auf" or vario_richtung =="Horizontal":
|
||||
start = (x , y + dy-esoffset_y ,upper_hoehe_gefaehlle + esoffset_z)
|
||||
ende = (x , y - dy,lower_hoehe_gefaehlle)
|
||||
@@ -123,8 +124,8 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
|
||||
(voerder_richtung == "Auf"and ((am_kreisel == 1 and erster_kreisel_höher == False) or (am_kreisel ==2 and erster_kreisel_höher ==True))and (drehung0 == "GUZS" and drehung1 == "UZS")) or
|
||||
(voerder_richtung == "Ab" and((am_kreisel == 1 and erster_kreisel_höher == True)or (am_kreisel == 2 and erster_kreisel_höher == False))and (drehung0 == "UZS" and drehung1 == "GUZS"))):
|
||||
block_es = "200000146_ES-Element_90_rechts"
|
||||
plant2dxf.import_block(block_es,lib_doc,doc)
|
||||
layer, color = plant2dxf.get_insert_color_layer(lib_doc,block_es)
|
||||
block_methoden.import_block(block_es,lib_doc,doc)
|
||||
layer, color = block_methoden.get_insert_color_layer(lib_doc,block_es)
|
||||
|
||||
elif ((drehung0 == "GUZS" and drehung1 == "GUZS") or
|
||||
(am_kreisel != None and drehung0 == "GUZS" and drehung1 == "GUZS") or
|
||||
@@ -132,8 +133,8 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
|
||||
(voerder_richtung == "Auf" and((am_kreisel == 1 and erster_kreisel_höher == True)or (am_kreisel == 2 and erster_kreisel_höher == False))and (drehung0 == "UZS" and drehung1 == "GUZS")) or
|
||||
(voerder_richtung == "Ab"and ((am_kreisel == 1 and erster_kreisel_höher == False)or (am_kreisel == 2 and erster_kreisel_höher == True))and (drehung0 == "GUZS" and drehung1 == "UZS"))):
|
||||
block_as = "200000241_AS-Element_90_rechts"
|
||||
plant2dxf.import_block(block_as,lib_doc,doc)
|
||||
layer, color = plant2dxf.get_insert_color_layer(lib_doc,block_as)
|
||||
block_methoden.import_block(block_as,lib_doc,doc)
|
||||
layer, color = block_methoden.get_insert_color_layer(lib_doc,block_as)
|
||||
|
||||
elif ((drehung0 == "UZS" and drehung1 == "UZS" and hight_position == "higher")or
|
||||
(voerder_richtung == "Auf" and((am_kreisel == 1 and erster_kreisel_höher == False)or (am_kreisel== 2 and erster_kreisel_höher == True)) and drehung0 == "UZS" and drehung1== "UZS")or
|
||||
@@ -144,8 +145,8 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
|
||||
(voerder_richtung == "Ab" and((am_kreisel == 1 and erster_kreisel_höher == True) or (am_kreisel ==2 and erster_kreisel_höher ==False))and (drehung0 == "GUZS" and drehung1 == "UZS"))):
|
||||
|
||||
block_es = "400102632_ES-Element_90_links"
|
||||
plant2dxf.import_block(block_es,lib_doc,doc)
|
||||
layer, color = plant2dxf.get_insert_color_layer(lib_doc,block_es)
|
||||
block_methoden.import_block(block_es,lib_doc,doc)
|
||||
layer, color = block_methoden.get_insert_color_layer(lib_doc,block_es)
|
||||
|
||||
|
||||
|
||||
@@ -155,12 +156,12 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
|
||||
(voerder_richtung == "Auf"and((am_kreisel == 1 and erster_kreisel_höher == True)or (am_kreisel == 2 and erster_kreisel_höher == False))and (drehung0 == "GUZS" and drehung1 == "UZS")) or
|
||||
(voerder_richtung == "Ab" and((am_kreisel == 1 and erster_kreisel_höher == False)or (am_kreisel == 2 and erster_kreisel_höher == True))and (drehung0 == "UZS" and drehung1 == "GUZS"))):
|
||||
block_as = "200000217_AS-Element_90_links"
|
||||
plant2dxf.import_block(block_as,lib_doc,doc)
|
||||
layer, color = plant2dxf.get_insert_color_layer(lib_doc,block_as)
|
||||
block_methoden.import_block(block_as,lib_doc,doc)
|
||||
layer, color = block_methoden.get_insert_color_layer(lib_doc,block_as)
|
||||
|
||||
|
||||
if block_es != None:
|
||||
block_es = plant2dxf.dreh_block(block_es,doc,lib_doc,math.radians(winkel_es))
|
||||
block_es = block_methoden.dreh_block(block_es,doc,lib_doc,math.radians(winkel_es))
|
||||
if voerder_richtung == "Auf":
|
||||
start = (x , y+ dy - esoffset_y,upper_hoehe_gefaehlle + esoffset_z)
|
||||
ende = (x , y1 ,z1)
|
||||
@@ -182,7 +183,7 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
|
||||
block.add_entity(copy)
|
||||
block.add_blockref(block_es, (ende[0]-x ,ende[1]- esoffset_y -y ,ende[2] -hoehe_gefaehlle ),dxfattribs={"layer": layer,"color": color})
|
||||
if block_as != None:
|
||||
block_as = plant2dxf.dreh_block(block_as,doc,lib_doc,math.radians(winkel_as))
|
||||
block_as = block_methoden.dreh_block(block_as,doc,lib_doc,math.radians(winkel_as))
|
||||
if voerder_richtung == "Auf":
|
||||
start = (x , y1,z1)
|
||||
ende = (x , y - dy + asoffset_y ,lower_hoehe_gefaehlle)
|
||||
@@ -208,39 +209,39 @@ def gefaellegerade_erstellung(x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_h
|
||||
else:
|
||||
if (( drehung0 == "GUZS" and drehung1 == "GUZS") or (voerder_richtung != None and drehung0 == "GUZS" and drehung1 == "GUZS")):
|
||||
block_as = "200000241_AS-Element_90_rechts"
|
||||
plant2dxf.import_block(block_as,lib_doc,doc)
|
||||
block_methoden.import_block(block_as,lib_doc,doc)
|
||||
block_es = "200000146_ES-Element_90_rechts"
|
||||
plant2dxf.import_block(block_es,lib_doc,doc)
|
||||
as_layer, as_color = plant2dxf.get_insert_color_layer(lib_doc,block_as)
|
||||
es_layer, es_color = plant2dxf.get_insert_color_layer(lib_doc,block_es)
|
||||
block_methoden.import_block(block_es,lib_doc,doc)
|
||||
as_layer, as_color = block_methoden.get_insert_color_layer(lib_doc,block_as)
|
||||
es_layer, es_color = block_methoden.get_insert_color_layer(lib_doc,block_es)
|
||||
elif (((drehung0 == "GUZS" and drehung1 == "UZS" and hight_position == "higher")or (drehung0 == "UZS" and drehung1 == "GUZS" and hight_position == "lower")) or
|
||||
(voerder_richtung == "Auf" and drehung0 == "UZS"and drehung1 == "GUZS") or
|
||||
(voerder_richtung == "Ab" and drehung0 == "GUZS" and drehung1 == "UZS")) :
|
||||
block_as = "200000241_AS-Element_90_rechts"
|
||||
plant2dxf.import_block(block_as,lib_doc,doc)
|
||||
block_methoden.import_block(block_as,lib_doc,doc)
|
||||
block_es = "400102632_ES-Element_90_links"
|
||||
plant2dxf.import_block(block_es,lib_doc,doc)
|
||||
as_layer, as_color = plant2dxf.get_insert_color_layer(lib_doc,block_as)
|
||||
es_layer, es_color = plant2dxf.get_insert_color_layer(lib_doc,block_es)
|
||||
block_methoden.import_block(block_es,lib_doc,doc)
|
||||
as_layer, as_color = block_methoden.get_insert_color_layer(lib_doc,block_as)
|
||||
es_layer, es_color = block_methoden.get_insert_color_layer(lib_doc,block_es)
|
||||
elif (( drehung0 == "UZS" and drehung1 == "UZS") or (voerder_richtung != None and drehung0 == "UZS" and drehung1 == "UZS")):
|
||||
block_as = "200000217_AS-Element_90_links"
|
||||
plant2dxf.import_block(block_as,lib_doc,doc)
|
||||
block_methoden.import_block(block_as,lib_doc,doc)
|
||||
block_es = "400102632_ES-Element_90_links"
|
||||
plant2dxf.import_block(block_es,lib_doc,doc)
|
||||
as_layer, as_color = plant2dxf.get_insert_color_layer(lib_doc,block_as)
|
||||
es_layer, es_color = plant2dxf.get_insert_color_layer(lib_doc,block_es)
|
||||
block_methoden.import_block(block_es,lib_doc,doc)
|
||||
as_layer, as_color = block_methoden.get_insert_color_layer(lib_doc,block_as)
|
||||
es_layer, es_color = block_methoden.get_insert_color_layer(lib_doc,block_es)
|
||||
elif ((((drehung0 == "UZS" and drehung1 == "GUZS" and hight_position== "higher")or (drehung0 == "GUZS" and drehung1 == "UZS" and hight_position == "lower")))or
|
||||
(voerder_richtung == "Auf" and drehung0 == "GUZS" and drehung1 == "UZS") or
|
||||
(voerder_richtung == "Ab" and drehung0 == "UZS"and drehung1 == "GUZS")) :
|
||||
|
||||
block_as = "200000217_AS-Element_90_links"
|
||||
plant2dxf.import_block(block_as,lib_doc,doc)
|
||||
block_methoden.import_block(block_as,lib_doc,doc)
|
||||
block_es = "200000146_ES-Element_90_rechts"
|
||||
plant2dxf.import_block(block_es,lib_doc,doc)
|
||||
as_layer, as_color = plant2dxf.get_insert_color_layer(lib_doc,block_as)
|
||||
es_layer, es_color = plant2dxf.get_insert_color_layer(lib_doc,block_es)
|
||||
block_as = plant2dxf.dreh_block(block_as,doc,lib_doc,math.radians(winkel_as))
|
||||
block_es = plant2dxf.dreh_block(block_es,doc,lib_doc,math.radians(winkel_es))
|
||||
block_methoden.import_block(block_es,lib_doc,doc)
|
||||
as_layer, as_color = block_methoden.get_insert_color_layer(lib_doc,block_as)
|
||||
es_layer, es_color = block_methoden.get_insert_color_layer(lib_doc,block_es)
|
||||
block_as = block_methoden.dreh_block(block_as,doc,lib_doc,math.radians(winkel_as))
|
||||
block_es = block_methoden.dreh_block(block_es,doc,lib_doc,math.radians(winkel_es))
|
||||
halbe_laenge = laenge / 2
|
||||
|
||||
dy = halbe_laenge * math.cos(0)
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
import math
|
||||
import plant2dxf
|
||||
from ezdxf import units
|
||||
from ezdxf.entities import Line
|
||||
from ezdxf.addons import importer
|
||||
from ezdxf.math import Matrix44, X_AXIS,Y_AXIS,Z_AXIS
|
||||
def dreh_block(block_name: str, to_doc,lib_doc, winkel) :
|
||||
"""Nimmt ein schon importierten Block und erstellt einen neuen der an der y_axis oder x_axis gedreht wird
|
||||
"""
|
||||
dreh_block_name = block_name +f"_{math.degrees(winkel)}"
|
||||
layer, color = get_insert_color_layer(lib_doc,block_name)
|
||||
if (dreh_block_name in to_doc.blocks):
|
||||
return dreh_block_name
|
||||
block_zwischen = to_doc.blocks.new(name=block_name + f"zwischenschrit_{winkel}", base_point=(0,0,0))
|
||||
block = to_doc.blocks.new(name=dreh_block_name, base_point=(0,0,0))
|
||||
if block_name == "200000146_ES-Element_90_rechts" or block_name =="400102632_ES-Element_90_links" or block_name =="200000241_AS-Element_90_rechts" or block_name =="200000217_AS-Element_90_links":
|
||||
rotation_matrix = Matrix44.axis_rotate(X_AXIS, winkel)
|
||||
else:
|
||||
rotation_matrix = Matrix44.axis_rotate(Y_AXIS, winkel)
|
||||
|
||||
block_zwischen.add_blockref(block_name,(0,0,0),dxfattribs={"layer":layer,"color": color})
|
||||
for e in block_zwischen:
|
||||
copy = e.copy()
|
||||
copy.transform(rotation_matrix)
|
||||
block.add_entity(copy)
|
||||
return dreh_block_name
|
||||
|
||||
|
||||
def import_block(block_name: str, from_doc, to_doc, winkel = None) -> None:
|
||||
"""Importiert Blockdefinition block_name von from_doc nach to_doc.
|
||||
|
||||
- Kopiert alle Entities des Blocks
|
||||
- Stellt sicher, dass benutzte Layer im Ziel existieren (mit Eigenschaften)
|
||||
- Übernimmt Basispunkt und Block-Layer, falls vorhanden
|
||||
"""
|
||||
msp2 = from_doc.modelspace()
|
||||
src = from_doc.blocks[block_name]
|
||||
att_def = {}
|
||||
if block_name == "Pinbereich":
|
||||
imp = importer.Importer(from_doc, to_doc)
|
||||
|
||||
# Alle Linientypen importieren
|
||||
imp.import_table("linetypes")
|
||||
if ((block_name in to_doc.blocks)):
|
||||
# speichern der attdef elemente in eine Liste falks diese verhanden sind und gibt diese zurück
|
||||
for ent in src:
|
||||
copy = ent.copy()
|
||||
|
||||
if ent.dxftype() == "ATTDEF":
|
||||
att_def[ent.dxf.tag] =ent.dxf.text
|
||||
if ent.dxftype() == "INSERT":
|
||||
|
||||
import_block(ent.dxf.name,from_doc, to_doc,None)
|
||||
|
||||
if att_def != {}:
|
||||
return att_def
|
||||
return
|
||||
|
||||
if block_name not in from_doc.blocks:
|
||||
raise ValueError(f"Block '{block_name}' nicht in Bibliothek gefunden.")
|
||||
# Sicherstellen, dass alle verwendeten Layer existieren
|
||||
try:
|
||||
used_layer_names = {e.dxf.layer for e in src if hasattr(e.dxf, "layer")}
|
||||
for layer_name in used_layer_names:
|
||||
if layer_name and layer_name not in to_doc.layers:
|
||||
try:
|
||||
src_layer = from_doc.layers.get(layer_name)
|
||||
to_doc.layers.add(
|
||||
name=layer_name,
|
||||
color=getattr(src_layer.dxf, "color", None),
|
||||
linetype=getattr(src_layer.dxf, "linetype", None),
|
||||
lineweight=getattr(src_layer.dxf, "lineweight", None),
|
||||
)
|
||||
except Exception:
|
||||
# Fallback: Layer mit Standardwerten anlegen
|
||||
to_doc.layers.add(name=layer_name)
|
||||
except Exception:
|
||||
pass
|
||||
tgt = to_doc.blocks.new(name=block_name)
|
||||
# Basispunkt/Layer des Blocks übernehmen, wenn vorhanden
|
||||
try:
|
||||
tgt.block.dxf.base_point = src.block.dxf.base_point
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
tgt.block.dxf.layer = src.block.dxf.layer
|
||||
except Exception:
|
||||
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
|
||||
|
||||
for ent in src:
|
||||
copy = ent.copy()
|
||||
|
||||
if ent.dxftype() == "ATTDEF":
|
||||
att_def[ent.dxf.tag] =ent.dxf.text
|
||||
if ent.dxftype() == "INSERT":
|
||||
import_block(ent.dxf.name,from_doc, to_doc,None)
|
||||
tgt.add_entity(copy)
|
||||
|
||||
if att_def != {}:
|
||||
return att_def
|
||||
|
||||
def get_insert_color_layer(lib_doc, blockname):
|
||||
"""Gibt den Layer und die Color für den Jeweiligen block in der Libary datei zurück"""
|
||||
msp_lib = lib_doc.modelspace()
|
||||
color = 0
|
||||
layer = 0
|
||||
for insert in msp_lib.query("INSERT"):
|
||||
if insert.dxf.name == blockname:
|
||||
color = insert.dxf.color
|
||||
layer = insert.dxf.layer
|
||||
return layer, color
|
||||
def rotatate_and_left_motor_umlenk(doc, lib_doc,config):
|
||||
motor_rotation = float(config.get("Ils 2.0 core winkel","winkel_motor"))
|
||||
umlenk_rotation = float(config.get("Ils 2.0 core winkel","winkel_umlenk"))
|
||||
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
|
||||
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
|
||||
blockname_motor_links = block_Vario_Motorstation_500mm +"_links"
|
||||
blockname_umlenk_links = block_Vario_Umlenkstation_500mm + "_links"
|
||||
import_block(block_Vario_Umlenkstation_500mm,lib_doc,doc)
|
||||
import_block(block_Vario_Motorstation_500mm,lib_doc,doc)
|
||||
turn_two_blocks_left(doc, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links)
|
||||
|
||||
block_Vario_Umlenkstation_500mm =dreh_block(block_Vario_Umlenkstation_500mm,doc,lib_doc,math.radians(umlenk_rotation))
|
||||
block_Vario_Motorstation_500mm =dreh_block(block_Vario_Motorstation_500mm,doc,lib_doc,math.radians(motor_rotation))
|
||||
blockname_motor_links =dreh_block(blockname_motor_links,doc,lib_doc,math.radians(umlenk_rotation))
|
||||
blockname_umlenk_links =dreh_block(blockname_umlenk_links,doc,lib_doc,math.radians(motor_rotation))
|
||||
return block_Vario_Umlenkstation_500mm,block_Vario_Motorstation_500mm,blockname_motor_links,blockname_umlenk_links
|
||||
|
||||
def turn_two_blocks_left(doc, block_1_name_zwischen, block_2_name, block_2_left_name, block_1_left_name):
|
||||
if block_2_left_name not in doc.blocks:
|
||||
matrix = Matrix44.scale(1,-1,1)
|
||||
block_2 = doc.blocks.new(name=block_2_left_name,base_point=(0,0,0))
|
||||
block_1_left_name = doc.blocks.new(name=block_1_left_name,base_point=(0,0,0))
|
||||
block_2_zwischen = doc.blocks[block_2_name]
|
||||
block_1_name_zwischen = doc.blocks[block_1_name_zwischen]
|
||||
for e in block_2_zwischen:
|
||||
copy = e.copy()
|
||||
copy.transform(matrix)
|
||||
block_2.add_entity(copy)
|
||||
|
||||
for e in block_1_name_zwischen:
|
||||
copy = e.copy()
|
||||
copy.transform(matrix)
|
||||
block_1_left_name.add_entity(copy)
|
||||
+25
-234
@@ -20,6 +20,7 @@ import math
|
||||
from utils import check_environment_var, setup_logger
|
||||
from Elemente import Kreisel, VarioFoerderer,Gefaehllestrecke,Angetriebene_Kurve,Bt_element,Omniflo
|
||||
import as_es_methoden
|
||||
import block_methoden
|
||||
|
||||
|
||||
|
||||
@@ -84,100 +85,6 @@ def parse_merkmale(merkmale_str: str) -> dict:
|
||||
except json.JSONDecodeError:
|
||||
return {}
|
||||
|
||||
def import_block(block_name: str, from_doc, to_doc, winkel = None) -> None:
|
||||
"""Importiert Blockdefinition block_name von from_doc nach to_doc.
|
||||
|
||||
- Kopiert alle Entities des Blocks
|
||||
- Stellt sicher, dass benutzte Layer im Ziel existieren (mit Eigenschaften)
|
||||
- Übernimmt Basispunkt und Block-Layer, falls vorhanden
|
||||
"""
|
||||
msp2 = from_doc.modelspace()
|
||||
src = from_doc.blocks[block_name]
|
||||
att_def = {}
|
||||
if block_name == "Pinbereich":
|
||||
imp = importer.Importer(from_doc, to_doc)
|
||||
|
||||
# Alle Linientypen importieren
|
||||
imp.import_table("linetypes")
|
||||
if ((block_name in to_doc.blocks)):
|
||||
# speichern der attdef elemente in eine Liste falks diese verhanden sind und gibt diese zurück
|
||||
for ent in src:
|
||||
copy = ent.copy()
|
||||
|
||||
if ent.dxftype() == "ATTDEF":
|
||||
att_def[ent.dxf.tag] =ent.dxf.text
|
||||
if ent.dxftype() == "INSERT":
|
||||
|
||||
import_block(ent.dxf.name,from_doc, to_doc,None)
|
||||
|
||||
if att_def != {}:
|
||||
return att_def
|
||||
return
|
||||
|
||||
if block_name not in from_doc.blocks:
|
||||
raise ValueError(f"Block '{block_name}' nicht in Bibliothek gefunden.")
|
||||
# Sicherstellen, dass alle verwendeten Layer existieren
|
||||
try:
|
||||
used_layer_names = {e.dxf.layer for e in src if hasattr(e.dxf, "layer")}
|
||||
for layer_name in used_layer_names:
|
||||
if layer_name and layer_name not in to_doc.layers:
|
||||
try:
|
||||
src_layer = from_doc.layers.get(layer_name)
|
||||
to_doc.layers.add(
|
||||
name=layer_name,
|
||||
color=getattr(src_layer.dxf, "color", None),
|
||||
linetype=getattr(src_layer.dxf, "linetype", None),
|
||||
lineweight=getattr(src_layer.dxf, "lineweight", None),
|
||||
)
|
||||
except Exception:
|
||||
# Fallback: Layer mit Standardwerten anlegen
|
||||
to_doc.layers.add(name=layer_name)
|
||||
except Exception:
|
||||
pass
|
||||
tgt = to_doc.blocks.new(name=block_name)
|
||||
# Basispunkt/Layer des Blocks übernehmen, wenn vorhanden
|
||||
try:
|
||||
tgt.block.dxf.base_point = src.block.dxf.base_point
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
tgt.block.dxf.layer = src.block.dxf.layer
|
||||
except Exception:
|
||||
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
|
||||
|
||||
for ent in src:
|
||||
copy = ent.copy()
|
||||
|
||||
if ent.dxftype() == "ATTDEF":
|
||||
att_def[ent.dxf.tag] =ent.dxf.text
|
||||
if ent.dxftype() == "INSERT":
|
||||
import_block(ent.dxf.name,from_doc, to_doc,None)
|
||||
tgt.add_entity(copy)
|
||||
|
||||
if att_def != {}:
|
||||
return att_def
|
||||
|
||||
def dreh_block(block_name: str, to_doc,lib_doc, winkel) :
|
||||
"""Nimmt ein schon importierten Block und erstellt einen neuen der an der y_axis oder x_axis gedreht wird
|
||||
"""
|
||||
dreh_block_name = block_name +f"_{math.degrees(winkel)}"
|
||||
layer, color = get_insert_color_layer(lib_doc,block_name)
|
||||
if (dreh_block_name in to_doc.blocks):
|
||||
return dreh_block_name
|
||||
block_zwischen = to_doc.blocks.new(name=block_name + f"zwischenschrit_{winkel}", base_point=(0,0,0))
|
||||
block = to_doc.blocks.new(name=dreh_block_name, base_point=(0,0,0))
|
||||
if block_name == "200000146_ES-Element_90_rechts" or block_name =="400102632_ES-Element_90_links" or block_name =="200000241_AS-Element_90_rechts" or block_name =="200000217_AS-Element_90_links":
|
||||
rotation_matrix = Matrix44.axis_rotate(X_AXIS, winkel)
|
||||
else:
|
||||
rotation_matrix = Matrix44.axis_rotate(Y_AXIS, winkel)
|
||||
|
||||
block_zwischen.add_blockref(block_name,(0,0,0),dxfattribs={"layer":layer,"color": color})
|
||||
for e in block_zwischen:
|
||||
copy = e.copy()
|
||||
copy.transform(rotation_matrix)
|
||||
block.add_entity(copy)
|
||||
return dreh_block_name
|
||||
|
||||
def handle_ils_2_0_kreisel(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols,strecken_nachbarn,config,config_allgemein):
|
||||
"""Erstellt ein Kreisel in der neuen Dxf"""
|
||||
@@ -188,8 +95,8 @@ def handle_ils_2_0_kreisel(msp, teileid, merkmale, x, y, doc, lib_doc, verbose,
|
||||
scanner_y = kreisel.y
|
||||
separatoren_x = kreisel.x
|
||||
separatoren_y = kreisel.y + 160
|
||||
import_block(block_scanner,lib_doc,doc)
|
||||
import_block(block_separatoren,lib_doc,doc)
|
||||
block_methoden.import_block(block_scanner,lib_doc,doc)
|
||||
block_methoden.import_block(block_separatoren,lib_doc,doc)
|
||||
i = 0
|
||||
while i < kreisel.anzahl_scanner:
|
||||
msp.add_blockref(block_scanner, (scanner_x,scanner_y, kreisel.hoehe))
|
||||
@@ -212,22 +119,22 @@ def handle_ils_2_0_kreisel(msp, teileid, merkmale, x, y, doc, lib_doc, verbose,
|
||||
rotation = sym["rotation"]
|
||||
if i < len(positions):
|
||||
pos = (positions[i][0] + offset[0], positions[i][1] + offset[1], kreisel.hoehe)
|
||||
import_block(blockname, lib_doc, doc)
|
||||
blockref_layer, color = get_insert_color_layer(lib_doc, blockname)
|
||||
block_methoden.import_block(blockname, lib_doc, doc)
|
||||
blockref_layer, color = block_methoden.get_insert_color_layer(lib_doc, blockname)
|
||||
bref = msp.add_blockref(blockname, pos, dxfattribs={"layer" : blockref_layer})
|
||||
bref.add_auto_attribs({ATTR_TAG: teileid})
|
||||
if verbose:
|
||||
print(f"[INFO] Block '{blockname}' (Kreisel) → {teileid} "
|
||||
f"({pos[0]:.1f}, {pos[1]:.1f}), rot={rotation}")
|
||||
# Linien zeichnen
|
||||
import_block("Pinbereich",lib_doc,doc)
|
||||
block_methoden.import_block("Pinbereich",lib_doc,doc)
|
||||
Kreisel.Kreisel.draw_kreisel_lines(msp, pos1, pos2, kreisel)
|
||||
Kreisel.Kreisel.draw_kreisel_drehrichtung_markierung(msp, pos1, pos2, kreisel, lib_doc, doc, verbose)
|
||||
|
||||
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"""
|
||||
import_block("AN8",lib_doc,doc)
|
||||
import_block("Richtungspfeil",lib_doc,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"))
|
||||
@@ -299,7 +206,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
||||
rotation = rotation -180
|
||||
gefaelle_objekt.drehung = rotation
|
||||
|
||||
block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links = rotatate_and_left_motor_umlenk(doc, lib_doc,config)
|
||||
block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links = block_methoden.rotatate_and_left_motor_umlenk(doc, lib_doc,config)
|
||||
hat_zusatz = Gefaehllestrecke.Gefaellestrecke.hat_motor_umlenk_station (gefaelle_objekt, gefaellestrecke_nachbarn)
|
||||
hat_motor_0 = hat_zusatz.get("hat_motor_0")
|
||||
hat_umlenk_0 = hat_zusatz.get("hat_umlenk_0")
|
||||
@@ -331,7 +238,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
||||
dy = halbe_laenge * math.cos(0)
|
||||
start = [x , y + dy ,upper_hoehe_gefaehlle]
|
||||
ende = [x , y - dy ,lower_hoehe_gefaehlle]
|
||||
start, ende = ein_motor_oder_eine_umlenk(x, y,start,ende, doc, lib_doc, hoehe_gefaehlle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_0, hat_umlenk_0, tefkurve_0, block,umlenk_gerade,motor_gerade)
|
||||
start, ende = Gefaehllestrecke.Gefaellestrecke.ein_motor_oder_eine_umlenk(x, y,start,ende, doc, lib_doc, hoehe_gefaehlle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_0, hat_umlenk_0, tefkurve_0, block,umlenk_gerade,motor_gerade)
|
||||
|
||||
line = Line.new(dxfattribs={"start":start,"end":ende})
|
||||
line.translate(-x,-y,-hoehe_gefaehlle)
|
||||
@@ -364,7 +271,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
||||
dy = halbe_laenge * math.cos(0)
|
||||
start = [x , y + dy ,upper_hoehe_gefaehlle]
|
||||
ende = [x , y - dy ,lower_hoehe_gefaehlle]
|
||||
start, ende = ein_motor_oder_eine_umlenk(x, y, start,ende,doc, lib_doc, hoehe_gefaehlle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_0, hat_umlenk_0, tefkurve_0, block,umlenk_gerade,motor_gerade)
|
||||
start, ende = Gefaehllestrecke.Gefaellestrecke.ein_motor_oder_eine_umlenk(x, y, start,ende,doc, lib_doc, hoehe_gefaehlle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_0, hat_umlenk_0, tefkurve_0, block,umlenk_gerade,motor_gerade)
|
||||
|
||||
only_es_or_as = as_es_methoden.erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle, drehung0, laenge, blockname,config,hight,None,None,None,block,start,ende)
|
||||
|
||||
@@ -534,7 +441,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
||||
rotation = rotation -180
|
||||
gefaelle_objekt.drehung = rotation
|
||||
|
||||
block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links = rotatate_and_left_motor_umlenk(doc, lib_doc,config)
|
||||
block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links = block_methoden.rotatate_and_left_motor_umlenk(doc, lib_doc,config)
|
||||
hat_zusatz = Gefaehllestrecke.Gefaellestrecke.hat_motor_umlenk_station(gefaelle_objekt, gefaellestrecke_nachbarn)
|
||||
hat_motor_0 = hat_zusatz.get("hat_motor_0")
|
||||
hat_umlenk_0 = hat_zusatz.get("hat_umlenk_0")
|
||||
@@ -560,120 +467,14 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
||||
dy = halbe_laenge * math.cos(0)
|
||||
start = [x , y + dy ,upper_hoehe_gefaehlle]
|
||||
ende = [x , y - dy ,lower_hoehe_gefaehlle]
|
||||
start, ende = ein_motor_oder_eine_umlenk(x, y,start,ende, doc, lib_doc, hoehe_gefaehlle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_0, hat_umlenk_0, tefkurve_0, block,umlenk_gerade,motor_gerade)
|
||||
start, ende = ein_motor_oder_eine_umlenk(x, y,start,ende, doc, lib_doc, hoehe_gefaehlle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_1, hat_umlenk_1, tefkurve_1, block,umlenk_gerade,motor_gerade)
|
||||
start, ende = Gefaehllestrecke.Gefaellestrecke.ein_motor_oder_eine_umlenk(x, y,start,ende, doc, lib_doc, hoehe_gefaehlle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_0, hat_umlenk_0, tefkurve_0, block,umlenk_gerade,motor_gerade)
|
||||
start, ende = Gefaehllestrecke.Gefaellestrecke.ein_motor_oder_eine_umlenk(x, y,start,ende, doc, lib_doc, hoehe_gefaehlle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_1, hat_umlenk_1, tefkurve_1, block,umlenk_gerade,motor_gerade)
|
||||
line = Line.new(dxfattribs={"start":start,"end":ende})
|
||||
line.dxf.layer = "6-SP"
|
||||
line.translate(-x,-y,-hoehe_gefaehlle)
|
||||
block.add_entity(line)
|
||||
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
|
||||
|
||||
def ein_motor_oder_eine_umlenk(x, y,start,ende, doc, lib_doc, hoehe_gefaehlle, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links, hat_motor_0, hat_umlenk_0, tefkurve_0, block,umlenk_gerade,motor_gerade):
|
||||
|
||||
block_Vario_Bogen_auf = (f"Vario_Bogen_auf_3°")
|
||||
block_Vario_Bogen_ab = (f"Vario_Bogen_ab_3°")
|
||||
block_Vario_Bogen_auf_links = (f"Vario_Bogen_auf_3°") + "_links"
|
||||
block_Vario_Bogen_ab_links = (f"Vario_Bogen_ab_3°") + "_links"
|
||||
auf_attrib = import_block(block_Vario_Bogen_auf,lib_doc,doc)
|
||||
ab_attrib = import_block(block_Vario_Bogen_ab,lib_doc,doc)
|
||||
Vario_Bogen_auf_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_attrib["DELTA_SP_0"]))
|
||||
Vario_Bogen_auf_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_attrib["DELTA_SP_1"]))
|
||||
Vario_Bogen_ab_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_0"]))
|
||||
Vario_Bogen_ab_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_attrib["DELTA_SP_1"]))
|
||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_0):
|
||||
if wert < 0:
|
||||
Vario_Bogen_auf_Delta_SP_0[i] = abs(wert)
|
||||
for i, wert in enumerate(Vario_Bogen_auf_Delta_SP_1):
|
||||
if wert< 0:
|
||||
Vario_Bogen_auf_Delta_SP_1[i] = abs(wert)
|
||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_0):
|
||||
if wert< 0:
|
||||
Vario_Bogen_ab_Delta_SP_0[i] = abs(wert)
|
||||
for i, wert in enumerate(Vario_Bogen_ab_Delta_SP_1):
|
||||
if wert< 0:
|
||||
Vario_Bogen_ab_Delta_SP_1[i] = abs(wert)
|
||||
turn_two_blocks_left(doc, block_Vario_Bogen_auf, block_Vario_Bogen_ab, block_Vario_Bogen_ab_links, block_Vario_Bogen_auf_links)
|
||||
if hat_motor_0 == True:
|
||||
if tefkurve_0 == "rechts":
|
||||
if motor_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_ab,(start[0]-x,start[1]-Vario_Bogen_ab_Delta_SP_0[0]-y,start[2]- Vario_Bogen_ab_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start = [start[0],start[1]-Vario_Bogen_ab_Delta_SP_0[0]- Vario_Bogen_ab_Delta_SP_1[0],start[2]-Vario_Bogen_ab_Delta_SP_0[2]- Vario_Bogen_ab_Delta_SP_1[2]]
|
||||
block.add_blockref(blockname_motor_links, (start[0]-x,start[1] - 250* math.cos(math.radians(3))-y,start[2] - 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500* math.cos(math.radians(3))
|
||||
start[2] = start[2] - 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Motorstation_500mm", (start[0]-x,start[1] -y,start[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500
|
||||
|
||||
else:
|
||||
if motor_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_ab_links,(start[0]-x,start[1]-Vario_Bogen_ab_Delta_SP_0[0]-y,start[2]- Vario_Bogen_ab_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start = [start[0],start[1]-Vario_Bogen_ab_Delta_SP_0[0]- Vario_Bogen_ab_Delta_SP_1[0],start[2]-Vario_Bogen_ab_Delta_SP_0[2]- Vario_Bogen_ab_Delta_SP_1[2]]
|
||||
block.add_blockref(block_Vario_Motorstation_500mm, (start[0]-x,start[1] - 250* math.cos(math.radians(3))-y,start[2] - 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500* math.cos(math.radians(3))
|
||||
start[2] = start[2] - 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Motorstation_500mm_links", (start[0]-x,start[1] -y,start[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
start[1]= start[1] - 500
|
||||
|
||||
if hat_umlenk_0 == True:
|
||||
if tefkurve_0 == "rechts":
|
||||
if umlenk_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_auf_links,(ende[0]-x,ende[1]+Vario_Bogen_auf_Delta_SP_0[0]-y,ende[2] + Vario_Bogen_auf_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 90})
|
||||
ende = [ende[0],ende[1]+ Vario_Bogen_auf_Delta_SP_0[0]+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]+Vario_Bogen_auf_Delta_SP_0[2]+ Vario_Bogen_auf_Delta_SP_1[2]]
|
||||
block.add_blockref(blockname_umlenk_links, (ende[0]-x,ende[1] + 250* math.cos(math.radians(3))-y,ende[2] + 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
|
||||
ende [1]= ende[1] + 500* math.cos(math.radians(3))
|
||||
ende[2] = ende[2] + 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Umlenkstation_500mm", (ende[0]-x,ende[1] + 250-y,ende[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
ende [1]= ende[1] + 500
|
||||
|
||||
else:
|
||||
if umlenk_gerade == False:
|
||||
block.add_blockref(block_Vario_Bogen_auf,(ende[0]-x,ende[1]+Vario_Bogen_auf_Delta_SP_0[0]-y,ende[2] + Vario_Bogen_auf_Delta_SP_0[2]-hoehe_gefaehlle),dxfattribs={"rotation": 90})
|
||||
ende = [ende[0],ende[1]+ Vario_Bogen_auf_Delta_SP_0[0]+ Vario_Bogen_auf_Delta_SP_1[0],ende[2]+Vario_Bogen_auf_Delta_SP_0[2]+ Vario_Bogen_auf_Delta_SP_1[2]]
|
||||
block.add_blockref(block_Vario_Umlenkstation_500mm, (ende[0]-x,ende[1] + 250* math.cos(math.radians(3))-y,ende[2] + 250* math.sin(math.radians(3))-hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
ende [1]= ende[1] + 500* math.cos(math.radians(3))
|
||||
ende[2] = ende[2] + 500* math.sin(math.radians(3))
|
||||
else:
|
||||
block.add_blockref("Vario_Umlenkstation_500mm", (ende[0]-x,ende[1] + 250-y,ende[2] -hoehe_gefaehlle),dxfattribs={"rotation": 270})
|
||||
ende [1]= ende[1] + 500
|
||||
return start,ende
|
||||
|
||||
def rotatate_and_left_motor_umlenk(doc, lib_doc,config):
|
||||
motor_rotation = float(config.get("Ils 2.0 core winkel","winkel_motor"))
|
||||
umlenk_rotation = float(config.get("Ils 2.0 core winkel","winkel_umlenk"))
|
||||
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
|
||||
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
|
||||
blockname_motor_links = block_Vario_Motorstation_500mm +"_links"
|
||||
blockname_umlenk_links = block_Vario_Umlenkstation_500mm + "_links"
|
||||
import_block(block_Vario_Umlenkstation_500mm,lib_doc,doc)
|
||||
import_block(block_Vario_Motorstation_500mm,lib_doc,doc)
|
||||
turn_two_blocks_left(doc, block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links)
|
||||
|
||||
block_Vario_Umlenkstation_500mm =dreh_block(block_Vario_Umlenkstation_500mm,doc,lib_doc,math.radians(umlenk_rotation))
|
||||
block_Vario_Motorstation_500mm =dreh_block(block_Vario_Motorstation_500mm,doc,lib_doc,math.radians(motor_rotation))
|
||||
blockname_motor_links =dreh_block(blockname_motor_links,doc,lib_doc,math.radians(umlenk_rotation))
|
||||
blockname_umlenk_links =dreh_block(blockname_umlenk_links,doc,lib_doc,math.radians(motor_rotation))
|
||||
return block_Vario_Umlenkstation_500mm,block_Vario_Motorstation_500mm,blockname_motor_links,blockname_umlenk_links
|
||||
|
||||
def turn_two_blocks_left(doc, block_1_name_zwischen, block_2_name, block_2_left_name, block_1_left_name):
|
||||
if block_2_left_name not in doc.blocks:
|
||||
matrix = Matrix44.scale(1,-1,1)
|
||||
block_2 = doc.blocks.new(name=block_2_left_name,base_point=(0,0,0))
|
||||
block_1_left_name = doc.blocks.new(name=block_1_left_name,base_point=(0,0,0))
|
||||
block_2_zwischen = doc.blocks[block_2_name]
|
||||
block_1_name_zwischen = doc.blocks[block_1_name_zwischen]
|
||||
for e in block_2_zwischen:
|
||||
copy = e.copy()
|
||||
copy.transform(matrix)
|
||||
block_2.add_entity(copy)
|
||||
|
||||
for e in block_1_name_zwischen:
|
||||
copy = e.copy()
|
||||
copy.transform(matrix)
|
||||
block_1_left_name.add_entity(copy)
|
||||
def anzahl_seperatoren_oder_scan(msp, x, y, doc, lib_doc, klassen_objekt, hoehe, rotation):
|
||||
"""Importiert alle seperatoren und/oder scanner für das nötige objekt"""
|
||||
separatoren = klassen_objekt.anzahl_separatoren
|
||||
@@ -690,10 +491,10 @@ def anzahl_seperatoren_oder_scan(msp, x, y, doc, lib_doc, klassen_objekt, hoehe,
|
||||
modular = 3
|
||||
block_scanner = "SCAN"
|
||||
block_separatoren = "S-LP"
|
||||
import_block(block_scanner,lib_doc,doc)
|
||||
import_block(block_separatoren,lib_doc,doc)
|
||||
layer_scan, color_scan = get_insert_color_layer(lib_doc, block_scanner)
|
||||
layer_separatioren, color_separatioren = get_insert_color_layer(lib_doc, block_separatoren)
|
||||
block_methoden.import_block(block_scanner,lib_doc,doc)
|
||||
block_methoden.import_block(block_separatoren,lib_doc,doc)
|
||||
layer_scan, color_scan = block_methoden.get_insert_color_layer(lib_doc, block_scanner)
|
||||
layer_separatioren, color_separatioren = block_methoden.get_insert_color_layer(lib_doc, block_separatoren)
|
||||
einsatz_zwischen =[ einsatz_fest[0],einsatz_fest[1],einsatz_fest[2]]
|
||||
anzahl =0
|
||||
while anzahl < separatoren:
|
||||
@@ -1187,8 +988,8 @@ def handle_ils_2_0_kurve_angetrieben(msp, teileid, merkmale, x, y, doc, lib_doc,
|
||||
kurvenrichtung = voerder_kurve.kurvenrichtung
|
||||
rotation = voerder_kurve.drehung
|
||||
blockname = (f"Vario_Kurve_{kurvenrichtung}_{kurvenwinkel}°_TEF_{antriebNebenStrecke}")
|
||||
import_block(blockname,lib_doc,doc)
|
||||
layer, color = get_insert_color_layer(lib_doc, blockname)
|
||||
block_methoden.import_block(blockname,lib_doc,doc)
|
||||
layer, color = block_methoden.get_insert_color_layer(lib_doc, blockname)
|
||||
msp.add_blockref(blockname,(x,y,h_zwischen),dxfattribs={"rotation": rotation,"layer": layer, "color":color})
|
||||
|
||||
|
||||
@@ -1201,7 +1002,7 @@ def handle_ils_2_0_kurve(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, sy
|
||||
kurvenrichtung = merkmale.get("Kurvenrichtung")
|
||||
kurvenwinkel =int(merkmale.get("Kurvenwinkel"))
|
||||
blockname = (f"Kurve_{kurvenrichtung}_{kurvenwinkel}°_R500_Gefälle")
|
||||
import_block(blockname,lib_doc,doc)
|
||||
block_methoden.import_block(blockname,lib_doc,doc)
|
||||
msp.add_blockref(blockname,(x,y,hz),dxfattribs={"rotation": rotation})
|
||||
|
||||
def handle_bt___beladung(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config,config_allgemein):
|
||||
@@ -1210,7 +1011,7 @@ def handle_bt___beladung(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, sy
|
||||
rotation = bt_element.drehung
|
||||
hight = bt_element.hoehe
|
||||
blockname = "AN8"
|
||||
import_block(blockname,lib_doc,doc)
|
||||
block_methoden.import_block(blockname,lib_doc,doc)
|
||||
msp.add_blockref(blockname,(x,y,hight),dxfattribs={"rotation": rotation})
|
||||
|
||||
def handle_bt___entladung(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config,config_allgemein):
|
||||
@@ -1219,7 +1020,7 @@ def handle_bt___entladung(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, s
|
||||
rotation = bt_element.drehung
|
||||
hight = bt_element.hoehe
|
||||
blockname = "AN8"
|
||||
import_block(blockname,lib_doc,doc)
|
||||
block_methoden.import_block(blockname,lib_doc,doc)
|
||||
msp.add_blockref(blockname,(x,y,hight),dxfattribs={"rotation": rotation})
|
||||
|
||||
|
||||
@@ -1252,21 +1053,11 @@ def handle_omniflo(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols,
|
||||
print(f"[WARN] Omniflo-Block '{blockname}' nicht in Bibliothek {lib_doc.filename}. Überspringe {teileid}.")
|
||||
return
|
||||
blockname = blockname
|
||||
import_block(blockname, lib_doc, doc)
|
||||
layer, color = get_insert_color_layer(lib_doc, omniflo_objekt.sivasnummer)
|
||||
block_methoden.import_block(blockname, lib_doc, doc)
|
||||
layer, color = block_methoden.get_insert_color_layer(lib_doc, omniflo_objekt.sivasnummer)
|
||||
msp.add_blockref(blockname, (x, y,omniflo_objekt.hoehe), dxfattribs={"rotation": rotation,"layer": layer, "color": color})
|
||||
|
||||
|
||||
def get_insert_color_layer(lib_doc, blockname):
|
||||
"""Gibt den Layer und die Color für den Jeweiligen block in der Libary datei zurück"""
|
||||
msp_lib = lib_doc.modelspace()
|
||||
color = 0
|
||||
layer = 0
|
||||
for insert in msp_lib.query("INSERT"):
|
||||
if insert.dxf.name == blockname:
|
||||
color = insert.dxf.color
|
||||
layer = insert.dxf.layer
|
||||
return layer, color
|
||||
|
||||
|
||||
def normalize_func_name(name):
|
||||
|
||||
Reference in New Issue
Block a user