Vario Kurve mit Gefällestrecke verbunden verbessert, Sonderfall horinzonal und 3 grad bogen hinzugefügt
This commit is contained in:
@@ -37,73 +37,95 @@ class Gefaellestrecke(BaseModel):
|
||||
anzahl_scanner = int(merkmale.get("Anzahl der Scanner")),
|
||||
anzahl_separatoren = int(merkmale.get("Anzahl der Separatoren"))
|
||||
)
|
||||
def hat_motor_umlenk_station (doc, lib_doc, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, gefaellestrecke_nachbarn):
|
||||
def hat_motor_umlenk_station (gefaelle_objekt, gefaellestrecke_nachbarn):
|
||||
hat_motor_0 = None
|
||||
hat_motor_1 = None
|
||||
hat_umlenk_0 = None
|
||||
hat_umlenk_1 = None
|
||||
tefkurve_0 = None
|
||||
tefkurve_1 = None
|
||||
umlenk_gerade = False
|
||||
motor_gerade = False
|
||||
upper_hoehe_gefaehlle = gefaelle_objekt.h1
|
||||
lower_hoehe_gefaehlle = gefaelle_objekt.h0
|
||||
rotation = gefaelle_objekt.drehung
|
||||
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"))
|
||||
kurvenrichtung = gefaellestrecke_nachbarn.get("Kurvenrichtung")
|
||||
tefkurve_0 = gefaellestrecke_nachbarn.get("Tefkurve")
|
||||
if (kurvenrichtung == "links" and tefkurve_0 == "Aussen") or kurvenrichtung == "rechts" and tefkurve_0 == "Innen":
|
||||
tefkurve_0 = "links"
|
||||
else:
|
||||
x_angetrieben = gefaellestrecke_nachbarn.get("X_angetrieben")
|
||||
y_angetrieben = gefaellestrecke_nachbarn.get("Y_angetrieben")
|
||||
if (kurvenrichtung == "links" and tefkurve_0 == "außen") or kurvenrichtung == "rechts" and tefkurve_0 == "innen":
|
||||
tefkurve_0 = "rechts"
|
||||
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"
|
||||
plant2dxf.import_block(block_Vario_Umlenkstation_500mm,lib_doc,doc)
|
||||
plant2dxf.import_block(block_Vario_Motorstation_500mm,lib_doc,doc)
|
||||
block_Vario_Umlenkstation_500mm =plant2dxf.dreh_block(block_Vario_Umlenkstation_500mm,doc,lib_doc,math.radians(3))
|
||||
block_Vario_Motorstation_500mm =plant2dxf.dreh_block(block_Vario_Motorstation_500mm,doc,lib_doc,math.radians(3))
|
||||
if blockname_motor_links not in doc.blocks:
|
||||
matrix = Matrix44.scale(1,-1,1)
|
||||
block_motor_links = doc.blocks.new(name=blockname_motor_links,base_point=(0,0,0))
|
||||
block_umlenk_links = doc.blocks.new(name=blockname_umlenk_links,base_point=(0,0,0))
|
||||
block_motor_rechts = doc.blocks[block_Vario_Motorstation_500mm]
|
||||
block_umlenk_rechts = doc.blocks[block_Vario_Umlenkstation_500mm]
|
||||
for e in block_motor_rechts:
|
||||
copy = e.copy()
|
||||
copy.transform(matrix)
|
||||
block_motor_links.add_entity(copy)
|
||||
|
||||
for e in block_umlenk_rechts:
|
||||
copy = e.copy()
|
||||
copy.transform(matrix)
|
||||
block_umlenk_links.add_entity(copy)
|
||||
else:
|
||||
tefkurve_0 = "links"
|
||||
|
||||
if upper_hoehe_gefaehlle > lower_hoehe_gefaehlle:
|
||||
if vario_hoehe_0 == upper_hoehe_gefaehlle or vario_hoehe_1 == upper_hoehe_gefaehlle:
|
||||
hat_motor_0 = True
|
||||
else:
|
||||
hat_umlenk_0 = True
|
||||
if upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
|
||||
elif upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
|
||||
if vario_hoehe_0 == lower_hoehe_gefaehlle or vario_hoehe_1 == lower_hoehe_gefaehlle:
|
||||
hat_motor_0 = True
|
||||
else:
|
||||
hat_umlenk_0 = True
|
||||
else:
|
||||
rotation_zwischen = rotation
|
||||
if rotation_zwischen == 0.0:
|
||||
rotation_zwischen = -360.0
|
||||
if (((-360.0<= rotation_zwischen< -270.0)and y > y_angetrieben) or ((-90.0< rotation< 0.0)and y > y_angetrieben) or
|
||||
((-270.0< rotation_zwischen< -90.0)and y < y_angetrieben) or
|
||||
(rotation == -90.0 and x < x_angetrieben) or ((rotation == -270.0)and x<x_angetrieben)):
|
||||
hat_umlenk_0 = True
|
||||
umlenk_gerade = True
|
||||
else:
|
||||
hat_motor_0 = True
|
||||
motor_gerade = True
|
||||
|
||||
if "Kurvenrichtung_1" in gefaellestrecke_nachbarn:
|
||||
vario_hoehe_0_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_0_1")) * 1000
|
||||
vario_hoehe_1_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_1_1")) * 1000
|
||||
vario_hoehe_0_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_0_1"))
|
||||
vario_hoehe_1_1 = float(gefaellestrecke_nachbarn.get("vario_hoehe_1_1"))
|
||||
kurvenrichtung_1 = gefaellestrecke_nachbarn.get("Kurvenrichtung_1")
|
||||
tefkurve_1 = gefaellestrecke_nachbarn.get("Tefkurve_1")
|
||||
if (kurvenrichtung_1 == "links" and tefkurve_1 == "Aussen") or kurvenrichtung_1 == "rechts" and tefkurve_1 == "Innen":
|
||||
tefkurve_0 = "links"
|
||||
if (kurvenrichtung_1 == "links" and tefkurve_1 == "außen") or kurvenrichtung_1 == "rechts" and tefkurve_1 == "innen":
|
||||
tefkurve_1 = "rechts"
|
||||
else:
|
||||
tefkurve_0 = "rechts"
|
||||
tefkurve_1 = "links"
|
||||
if upper_hoehe_gefaehlle > lower_hoehe_gefaehlle:
|
||||
if vario_hoehe_0_1 == upper_hoehe_gefaehlle or vario_hoehe_1_1 == upper_hoehe_gefaehlle:
|
||||
hat_motor_1 = True
|
||||
else:
|
||||
hat_umlenk_1 = True
|
||||
if upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
|
||||
elif upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
|
||||
if vario_hoehe_0_1 == lower_hoehe_gefaehlle or vario_hoehe_1_1 == lower_hoehe_gefaehlle:
|
||||
hat_motor_1 = True
|
||||
else:
|
||||
hat_umlenk_1 = True
|
||||
return hat_motor_0,hat_umlenk_0,hat_motor_1,hat_umlenk_1, tefkurve_0, tefkurve_1
|
||||
else:
|
||||
rotation_zwischen = rotation
|
||||
if rotation_zwischen == 0.0:
|
||||
rotation_zwischen = -360.0
|
||||
if (((-360.0<= rotation_zwischen< -270.0)and y > y_angetrieben) or ((-90.0< rotation< 0.0)and y > y_angetrieben) or
|
||||
((-270.0< rotation_zwischen< -90.0)and y < y_angetrieben) or
|
||||
(rotation == -90.0 and x < x_angetrieben) or ((rotation == -270.0)and x<x_angetrieben)):
|
||||
hat_umlenk_1 = True
|
||||
umlenk_gerade = True
|
||||
else:
|
||||
hat_motor_1 = True
|
||||
motor_gerade = True
|
||||
hat_zusatz ={}
|
||||
hat_zusatz["hat_motor_0"] = hat_motor_0
|
||||
hat_zusatz["hat_motor_1"] = hat_motor_1
|
||||
hat_zusatz["hat_umlenk_0"] = hat_umlenk_0
|
||||
hat_zusatz["hat_umlenk_1"] = hat_umlenk_1
|
||||
hat_zusatz["tefkurve_0"] = tefkurve_0
|
||||
hat_zusatz["tefkurve_1"] = tefkurve_1
|
||||
hat_zusatz["umlenk_gerade"] = umlenk_gerade
|
||||
hat_zusatz["motor_gerade"] = motor_gerade
|
||||
return hat_zusatz
|
||||
+150
-83
@@ -251,6 +251,7 @@ 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):
|
||||
"""Erstellt eine Gefällestrecke in der neuen Dxf"""
|
||||
#Vorbereitung der attributen
|
||||
|
||||
gefaelle_objekt = Gefaehllestrecke.Gefaellestrecke.from_merkmale(teileid,x,y,merkmale)
|
||||
asoffset = float(config.get("ILS 2.0 Gefällestrecke", "asoffset"))
|
||||
esoffset = float(config.get("ILS 2.0 Gefällestrecke", "esoffset"))
|
||||
@@ -292,11 +293,22 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
||||
if upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
|
||||
hoehe2 = upper_hoehe_gefaehlle
|
||||
upper_hoehe_gefaehlle = lower_hoehe_gefaehlle
|
||||
gefaelle_objekt.h1 = upper_hoehe_gefaehlle
|
||||
lower_hoehe_gefaehlle = hoehe2
|
||||
gefaelle_objekt.h0 = lower_hoehe_gefaehlle
|
||||
rotation = rotation -180
|
||||
gefaelle_objekt.drehung = rotation
|
||||
|
||||
hat_motor_0, hat_umlenk_0, hat_motor_1, hat_umlenk_1, tefkurve_0, tefkurve_1 = Gefaehllestrecke.Gefaellestrecke.hat_motor_umlenk_station (doc, lib_doc, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, gefaellestrecke_nachbarn)
|
||||
|
||||
block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links = 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")
|
||||
tefkurve_0 = hat_zusatz.get("tefkurve_0")
|
||||
hat_motor_1 = hat_zusatz.get("hat_motor_1")
|
||||
hat_umlenk_1 = hat_zusatz.get("hat_umlenk_1")
|
||||
tefkurve_1 = hat_zusatz.get("tefkurve_1")
|
||||
umlenk_gerade = hat_zusatz.get("umlenk_gerade")
|
||||
motor_gerade = hat_zusatz.get("motor_gerade")
|
||||
verbunden_am_einen = True
|
||||
am_kreisel, kreisel_verbunden =as_es_methoden.am_kreisel_direct_verbunden(x, y, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, x0_kreisel, y0_kreisel, richtung_rad0, abstand0, dx, dy, None, None, None, None)
|
||||
if am_kreisel == 1:
|
||||
@@ -307,32 +319,20 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
||||
ende = x -dx, y - dy,lower_hoehe_gefaehlle
|
||||
line =msp.add_line(start,ende)
|
||||
line.dxf.layer = "6-SP"
|
||||
|
||||
return
|
||||
else:
|
||||
|
||||
dy = halbe_laenge * math.cos(0)
|
||||
start = [x , y + dy ,upper_hoehe_gefaehlle]
|
||||
ende = [x , y - dy ,lower_hoehe_gefaehlle]
|
||||
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{hoehe_gefaehlle}_{hat_umlenk_0}_{hat_motor_0}_{tefkurve_0}"
|
||||
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{hoehe_gefaehlle}_{hat_umlenk_0}_{hat_motor_0}_{tefkurve_0}_{umlenk_gerade}_{motor_gerade}"
|
||||
if blockname not in doc.blocks:
|
||||
block = doc.blocks.new(name=blockname,base_point= (0,0,0))
|
||||
if hat_motor_0 == True:
|
||||
if tefkurve_0 == "rechts":
|
||||
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})
|
||||
else:
|
||||
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})
|
||||
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 [1]= start[1] - 500* math.cos(math.radians(3))
|
||||
start[2] = start[2] - 500* math.sin(math.radians(3))
|
||||
if hat_umlenk_0 == True:
|
||||
if tefkurve_0 == "rechts":
|
||||
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})
|
||||
else:
|
||||
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))
|
||||
line = Line.new(dxfattribs={"start":start,"end":ende})
|
||||
line.translate(-x,-y,-hoehe_gefaehlle)
|
||||
block.add_entity(line)
|
||||
@@ -345,7 +345,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
||||
if hat_motor_0 == False and hat_umlenk_0 == False:
|
||||
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{drehung0}_{hoehe_gefaehlle}_{verbunden_am_einen}_{hight}"
|
||||
else:
|
||||
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{drehung0}_{hoehe_gefaehlle}_{verbunden_am_einen}_{hight}_{hat_umlenk_0}_{hat_motor_0}_{tefkurve_0}"
|
||||
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{drehung0}_{hoehe_gefaehlle}_{verbunden_am_einen}_{hight}_{hat_umlenk_0}_{hat_motor_0}_{tefkurve_0}_{umlenk_gerade}_{motor_gerade}"
|
||||
|
||||
if blockname in doc.blocks:
|
||||
bref =msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
|
||||
@@ -364,22 +364,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]
|
||||
if hat_motor_0 == True:
|
||||
if tefkurve_0 == "rechts":
|
||||
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})
|
||||
else:
|
||||
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))
|
||||
if hat_umlenk_0 == True:
|
||||
if tefkurve_0 == "rechts":
|
||||
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})
|
||||
else:
|
||||
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))
|
||||
|
||||
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)
|
||||
|
||||
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)
|
||||
|
||||
@@ -543,70 +528,152 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
||||
if upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
|
||||
hoehe2 = upper_hoehe_gefaehlle
|
||||
upper_hoehe_gefaehlle = lower_hoehe_gefaehlle
|
||||
gefaelle_objekt.h1 = upper_hoehe_gefaehlle
|
||||
lower_hoehe_gefaehlle = hoehe2
|
||||
gefaelle_objekt.h0 = lower_hoehe_gefaehlle
|
||||
rotation = rotation -180
|
||||
gefaelle_objekt.drehung = rotation
|
||||
|
||||
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"
|
||||
hat_motor_0, hat_umlenk_0, hat_motor_1, hat_umlenk_1, tefkurve_0, tefkurve_1 = Gefaehllestrecke.Gefaellestrecke.hat_motor_umlenk_station(doc, lib_doc, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, gefaellestrecke_nachbarn)
|
||||
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}"
|
||||
block_Vario_Umlenkstation_500mm, block_Vario_Motorstation_500mm, blockname_motor_links, blockname_umlenk_links = 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")
|
||||
tefkurve_0 = hat_zusatz.get("tefkurve_0")
|
||||
hat_motor_1 = hat_zusatz.get("hat_motor_1")
|
||||
hat_umlenk_1 = hat_zusatz.get("hat_umlenk_1")
|
||||
tefkurve_1 = hat_zusatz.get("tefkurve_1")
|
||||
umlenk_gerade = hat_zusatz.get("umlenk_gerade")
|
||||
motor_gerade = hat_zusatz.get("motor_gerade")
|
||||
|
||||
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}_{umlenk_gerade}_{motor_gerade}"
|
||||
|
||||
if hat_motor_0 == False or hat_umlenk_0 == False or hat_motor_1 == False or hat_umlenk_1 == False:
|
||||
dx = halbe_laenge *math.sin(winkel * -1)
|
||||
dy = halbe_laenge * math.cos(winkel)
|
||||
start = [x , y + dy ,upper_hoehe_gefaehlle]
|
||||
ende = [x , y - dy ,lower_hoehe_gefaehlle]
|
||||
a= msp.add_line(start,ende)
|
||||
a.dxf.layer = "6-SP"
|
||||
return
|
||||
if blockname not in doc.blocks:
|
||||
block = doc.blocks.new(name=blockname,base_point = (0,0,0))
|
||||
dy = halbe_laenge * math.cos(0)
|
||||
start = [x , y + dy ,upper_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:
|
||||
dx = halbe_laenge *math.sin(winkel * -1)
|
||||
dy = halbe_laenge * math.cos(winkel)
|
||||
start = x +dx, y + dy,upper_hoehe_gefaehlle
|
||||
ende = x -dx, y - dy,lower_hoehe_gefaehlle
|
||||
line = msp.add_line(start,ende)
|
||||
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)
|
||||
line = Line.new(dxfattribs={"start":start,"end":ende})
|
||||
line.dxf.layer = "6-SP"
|
||||
elif (hat_motor_0 == True and hat_umlenk_0 == None) and tefkurve_1 == None:
|
||||
if blockname not in doc.blocks:
|
||||
block = doc.blocks.new(name=blockname,base_point = (0,0,0))
|
||||
if (hat_motor_0 == True and tefkurve_0 == "rechts") or (hat_motor_1 == True and tefkurve_1 == "rechts"):
|
||||
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})
|
||||
else:
|
||||
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))
|
||||
line = Line.new(dxfattribs={"start":start,"end":ende})
|
||||
line.translate(-x,-y,-hoehe_gefaehlle)
|
||||
block.add_entity(line)
|
||||
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
|
||||
elif hat_motor_0 == None and hat_umlenk_0 == True and tefkurve_1 == None:
|
||||
if blockname not in doc.blocks:
|
||||
block = doc.blocks.new(name=blockname,base_point = (0,0,0))
|
||||
if (hat_umlenk_0 == True and tefkurve_0 == "rechts") or (hat_umlenk_1 == True and tefkurve_1 == "rechts"):
|
||||
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})
|
||||
else:
|
||||
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[2] = ende[2] + 500* math.sin(math.radians(3))
|
||||
line = Line.new(dxfattribs={"start":start,"end":ende})
|
||||
line.translate(-x,-y,-hoehe_gefaehlle)
|
||||
block.add_entity(line)
|
||||
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
|
||||
elif hat_motor_0 == True or hat_motor_1 == True or hat_umlenk_0 == True or hat_umlenk_1 == True:
|
||||
if blockname not in doc.blocks:
|
||||
block = doc.blocks.new(name=blockname,base_point = (0,0,0))
|
||||
if (hat_motor_0 == True and tefkurve_0 == "rechts") or (hat_motor_1 == True and tefkurve_1 == "rechts"):
|
||||
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})
|
||||
else:
|
||||
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))
|
||||
if (hat_umlenk_0 == True and tefkurve_0 == "rechts") or (hat_umlenk_1 == True and tefkurve_1 == "rechts"):
|
||||
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})
|
||||
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))
|
||||
line = Line.new(dxfattribs={"start":start,"end":ende})
|
||||
line.translate(-x,-y,-hoehe_gefaehlle)
|
||||
block.add_entity(line)
|
||||
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
|
||||
else:
|
||||
a= msp.add_line(start,ende)
|
||||
a.dxf.layer = "6-SP"
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user