3755 lines
215 KiB
Python
3755 lines
215 KiB
Python
"""
|
||
placeblocks.py
|
||
Erzeugt DXF-Elemente aus einer RuleDesigner-CSV.
|
||
"""
|
||
|
||
import os
|
||
import sys
|
||
import csv
|
||
import json
|
||
import re
|
||
import argparse
|
||
import configparser
|
||
import ezdxf
|
||
from ezdxf import units
|
||
from ezdxf.entities import Line
|
||
from ezdxf.math import Matrix44, X_AXIS,Y_AXIS,Z_AXIS
|
||
from pathlib import Path
|
||
import math
|
||
import re
|
||
from utils import check_environment_var, setup_logger
|
||
|
||
|
||
|
||
# --------------------------------------------------------- CFG-Leser für shapes.cfg
|
||
def get_shape_cfg(teileart, cfg_path, logger=None):
|
||
parser = configparser.ConfigParser()
|
||
try:
|
||
with open(cfg_path, encoding='utf-8') as f:
|
||
parser.read_file(f)
|
||
except Exception as e:
|
||
msg = f"Fehler beim Lesen der Config-Datei {cfg_path}: {e}"
|
||
if logger:
|
||
logger.error(msg)
|
||
else:
|
||
print(msg)
|
||
return []
|
||
section = teileart
|
||
if section not in parser:
|
||
return []
|
||
# Blöcke
|
||
items = parser.get(section, "items", fallback="").replace('"', '').split(",")
|
||
blocks = [item.strip() for item in items if item.strip()]
|
||
symbols = []
|
||
for i, name in enumerate(blocks):
|
||
# Offset
|
||
offset_key = f"offset_symb{i+1}"
|
||
offset_str = parser.get(section, offset_key, fallback="0,0")
|
||
try:
|
||
ox, oy = [float(x) for x in offset_str.split(",")]
|
||
except Exception:
|
||
ox, oy = 0.0, 0.0
|
||
# Rotation
|
||
rot_key = f"rot_symb{i+1}"
|
||
rot_str = parser.get(section, rot_key, fallback="0.0")
|
||
try:
|
||
rot = float(rot_str)
|
||
except Exception:
|
||
rot = 0.0
|
||
symbols.append({
|
||
"name": name,
|
||
"offset": (ox, oy),
|
||
"rotation": rot
|
||
})
|
||
return symbols
|
||
|
||
# --------------------------------------------------------- Konstante Parameter
|
||
ATTR_TAG = "TeileId" # Attributtag im Block
|
||
RADIUS = 400 # Radius der Kreiselkreise (mm)
|
||
|
||
# --------------------------------------------------------- Hilfsfunktionen
|
||
def extract_coords(planquadrat: str) -> tuple[float, float]:
|
||
"""Extrahiert X/Y Koordinaten aus PlanquadratString."""
|
||
m = re.search(r"X:(\d+[\.,]?\d*)\s+Y:(\d+[\.,]?\d*)", planquadrat)
|
||
if not m:
|
||
raise ValueError(f"Koordinaten nicht gefunden in: '{planquadrat}'")
|
||
x, y = m.groups()
|
||
return float(x.replace(",", ".")), float(y.replace(",", "."))
|
||
|
||
def parse_merkmale(merkmale_str: str) -> dict:
|
||
"""Parst Merkmale-JSON-String in dict; bei Fehler → leeres Dict."""
|
||
try:
|
||
return json.loads(merkmale_str)
|
||
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
|
||
"""
|
||
src = from_doc.blocks[block_name]
|
||
att_def = {}
|
||
if ((block_name in to_doc.blocks)):
|
||
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
|
||
|
||
|
||
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, winkel) :
|
||
"""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
|
||
"""
|
||
|
||
dreh_block_name = block_name +f"_{math.degrees(winkel)}"
|
||
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))
|
||
rotation_matrix = Matrix44.axis_rotate(Y_AXIS, winkel)
|
||
|
||
block_zwischen.add_blockref(block_name,(0,0,0))
|
||
for e in block_zwischen:
|
||
copy = e.copy()
|
||
copy.transform(rotation_matrix)
|
||
block.add_entity(copy)
|
||
return dreh_block_name
|
||
|
||
|
||
|
||
def berechne_hoehe(csv_path, logger=None):
|
||
y_werte = []
|
||
try:
|
||
with csv_path.open(newline="", encoding="utf-8") as fh:
|
||
reader = csv.DictReader(fh, delimiter=';')
|
||
for row in reader:
|
||
planquadrat = row.get("Planquadrat", "")
|
||
try:
|
||
_, y = extract_coords(planquadrat)
|
||
y_werte.append(y)
|
||
except Exception as e:
|
||
if logger:
|
||
logger.warning(f"Fehler beim Extrahieren der Koordinate aus '{planquadrat}': {e}")
|
||
except Exception as e:
|
||
if logger:
|
||
logger.error(f"Fehler beim Lesen der CSV-Datei {csv_path}: {e}")
|
||
else:
|
||
print(f"Fehler beim Lesen der CSV-Datei {csv_path}: {e}")
|
||
return 0
|
||
if not y_werte:
|
||
msg = "Keine Y-Koordinaten in der CSV gefunden!"
|
||
if logger:
|
||
logger.error(msg)
|
||
else:
|
||
print(msg)
|
||
raise ValueError(msg)
|
||
return max(y_werte)
|
||
|
||
def transform_coords(x: float, y: float, height: float) -> tuple[float, float]:
|
||
"""Transformiert Bildschirmkoordinaten (0,0 oben links) ins DXF-KoSy (0,0 unten links)."""
|
||
return x, y
|
||
|
||
def handle_ils_2_0_kreisel(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols,strecken_nachbarn,config):
|
||
abstand_m = merkmale.get(
|
||
"Abstand (Kreiselachse A - Kreiselachse) in Meter", "20"
|
||
).replace(",", ".")
|
||
try:
|
||
abstand = float(abstand_m) * 1000 # Meter → mm
|
||
except ValueError:
|
||
abstand = 10000 # Fallback 10 m
|
||
|
||
# Drehung (Winkel in Grad, Standard 0) aus Merkmale
|
||
try:
|
||
winkel = float(merkmale.get("Drehung", 90))
|
||
except (ValueError, TypeError):
|
||
winkel = 0.0
|
||
winkel_rad = math.radians(winkel)
|
||
|
||
# Die Koordinaten (x, y) sind die Mitte zwischen den beiden Blöcken (bereits transformiert)
|
||
halbabstand = abstand / 2
|
||
dx = halbabstand * math.cos(winkel_rad)
|
||
dy = halbabstand * math.sin(winkel_rad)
|
||
pos1 = (x - dx, y - dy,float(merkmale.get("Höhe in m"))* 1000)
|
||
pos2 = (x + dx, y + dy, float(merkmale.get("Höhe in m"))* 1000)
|
||
positions = [pos1, pos2]
|
||
for i, sym in enumerate(symbols):
|
||
blockname = sym["name"]
|
||
offset = sym["offset"]
|
||
rotation = sym["rotation"]
|
||
if i < len(positions):
|
||
pos = (positions[i][0] + offset[0], positions[i][1] + offset[1],float(merkmale.get("Höhe in m"))*1000)
|
||
import_block(blockname, lib_doc, doc)
|
||
blockref_layer = get_layer(doc, lib_doc, blockname)
|
||
bref = msp.add_blockref(blockname, pos, dxfattribs={"rotation": merkmale.get("Drehung"), "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
|
||
draw_kreisel_lines(msp, pos1, pos2)
|
||
draw_kreisel_drehrichtung_markierung(msp, pos1, pos2, merkmale, lib_doc, doc, verbose)
|
||
|
||
def draw_kreisel_lines(msp, pos1, pos2):
|
||
"""Zeichnet tangentiale Linien zwischen zwei Kreiselblöcken, unabhängig vom Winkel."""
|
||
x1, y1, z1 = pos1
|
||
x2, y2, z1 = pos2
|
||
# Verbindungsvektor
|
||
dx = x2 - x1
|
||
dy = y2 - y1
|
||
# Länge
|
||
length = math.hypot(dx, dy)
|
||
if length == 0:
|
||
return # keine Linie bei identischen Punkten
|
||
# Normalenvektor (senkrecht, normiert, Länge = RADIUS)
|
||
nx = -dy / length * RADIUS
|
||
ny = dx / length * RADIUS
|
||
# Tangentialpunkte
|
||
p1a = (x1 + nx, y1 + ny,z1)
|
||
p1b = (x1 - nx, y1 - ny,z1)
|
||
p2a = (x2 + nx, y2 + ny,z1)
|
||
p2b = (x2 - nx, y2 - ny,z1)
|
||
# Linien zeichnen
|
||
msp.add_line(p1a, p2a)
|
||
msp.add_line(p1b, p2b)
|
||
|
||
def draw_kreisel_drehrichtung_markierung(msp, pos1, pos2, merkmale, lib_doc, doc, verbose):
|
||
drehrichtung = merkmale.get("Drehrichtung", "").upper()
|
||
if drehrichtung not in ("UZS", "GUZS"):
|
||
return
|
||
x1, y1,z1= pos1
|
||
x2, y2,z2 = pos2
|
||
dx = x2 - x1
|
||
dy = y2 - y1
|
||
length = math.hypot(dx, dy)
|
||
if length == 0:
|
||
return
|
||
# Normalenvektor (senkrecht, normiert, Länge = RADIUS)
|
||
nx = -dy / length * RADIUS
|
||
ny = dx / length * RADIUS
|
||
# Obere Linie
|
||
p1_oben = (x1 + nx, y1 + ny)
|
||
p2_oben = (x2 + nx, y2 + ny)
|
||
# Untere Linie
|
||
p1_unten = (x1 - nx, y1 - ny)
|
||
p2_unten = (x2 - nx, y2 - ny)
|
||
# S-LP auf oberer Linie (Drehrichtung wie angegeben)
|
||
for i in range(1, 4):
|
||
t = i / 4 # 1/4, 2/4, 3/4
|
||
px = p1_oben[0] + t * (p2_oben[0] - p1_oben[0])
|
||
py = p1_oben[1] + t * (p2_oben[1] - p1_oben[1])
|
||
rotation = math.degrees(math.atan2(p2_oben[1] - p1_oben[1], p2_oben[0] - p1_oben[0]))
|
||
if drehrichtung == "GUZS":
|
||
rotation += 180
|
||
import_block("S-LP", lib_doc, doc)
|
||
blockref_layer = get_layer(doc, lib_doc, "S-LP")
|
||
bref = msp.add_blockref("S-LP", (px, py,z1), dxfattribs={"rotation": rotation,"layer": blockref_layer})
|
||
if verbose:
|
||
print(f"[INFO] Drehrichtung '{drehrichtung}': S-LP oben bei ({px:.1f}, {py:.1f}), rot={rotation:.1f}")
|
||
# S-LP auf unterer Linie (Drehrichtung invertiert)
|
||
for i in range(1, 4):
|
||
t = i / 4
|
||
px = p1_unten[0] + t * (p2_unten[0] - p1_unten[0])
|
||
py = p1_unten[1] + t * (p2_unten[1] - p1_unten[1])
|
||
rotation = math.degrees(math.atan2(p2_unten[1] - p1_unten[1], p2_unten[0] - p1_unten[0]))
|
||
if drehrichtung == "UZS":
|
||
rotation += 180
|
||
import_block("S-LP", lib_doc, doc)
|
||
blockref_layer = get_layer(doc, lib_doc, "S-LP")
|
||
bref = msp.add_blockref("S-LP", (px, py, z1), dxfattribs={"rotation": rotation , "layer": blockref_layer})
|
||
if verbose:
|
||
print(f"[INFO] Drehrichtung '{drehrichtung}': S-LP unten bei ({px:.1f}, {py:.1f}), rot={rotation:.1f}")
|
||
|
||
def handle_standard(msp, blocknames, teileid, x, y, lib_doc, doc, verbose):
|
||
for blockname in blocknames:
|
||
import_block(blockname, lib_doc, doc)
|
||
blockref_layer = get_layer(doc, lib_doc, blockname)
|
||
bref = msp.add_blockref(blockname, (x, y), dxfattribs={"layer": blockref_layer})
|
||
bref.add_auto_attribs({ATTR_TAG: teileid})
|
||
if verbose:
|
||
print(f"[INFO] Block '{blockname}' (Standard) → {teileid} "
|
||
f"({x:.1f}, {y:.1f})")
|
||
|
||
|
||
def handle_ils_2_0_eckrad(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config):
|
||
import_block("AN8",lib_doc,doc)
|
||
hight = float(merkmale.get("Höhe in m"))* 1000
|
||
msp.add_blockref("AN8",(x,y,hight))
|
||
|
||
def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config):
|
||
#Vorbereitung der attributen
|
||
|
||
|
||
if "6-SP" not in doc.layers:
|
||
doc.layers.add(name="6-SP", color=7)
|
||
verbunden_am_einen = False
|
||
|
||
|
||
richtung2 ="DEFAULT"
|
||
unterschiedlich = False
|
||
asoffset = float(config.get("ILS 2.0 Gefällestrecke", "asoffset"))
|
||
esoffset = float(config.get("ILS 2.0 Gefällestrecke", "esoffset"))
|
||
upper_hoehe_gefaehlle= float(merkmale.get("Höhe oben")) *1000
|
||
lower_hoehe_gefaehlle = float(merkmale.get("Höhe unten")) * 1000
|
||
hoehe_gefaehlle = (upper_hoehe_gefaehlle + lower_hoehe_gefaehlle)/2
|
||
for nachbarn in strecken_nachbarn:
|
||
if teileid == nachbarn.get("Id"):
|
||
gefaellestrecke_nachbarn = nachbarn
|
||
break
|
||
if "Drehung0" in gefaellestrecke_nachbarn and "Drehung1" not in gefaellestrecke_nachbarn:
|
||
drehung0 =gefaellestrecke_nachbarn.get("Drehung0")
|
||
x0_kreisel = float(gefaellestrecke_nachbarn.get("x0"))
|
||
y0_kreisel = float(gefaellestrecke_nachbarn.get("y0"))
|
||
|
||
hoehe0 = float(gefaellestrecke_nachbarn.get("Hoehe0"))
|
||
richtung0 = float(gefaellestrecke_nachbarn.get("rotation0"))
|
||
richtung_rad0= math.radians(richtung0)
|
||
abstand0 = float(gefaellestrecke_nachbarn.get("abstand0")) * 1000
|
||
laenge_m = merkmale.get("Länge in Meter", "10").replace(",", ".")
|
||
try:
|
||
laenge = float(laenge_m) * 1000 # Meter → mm
|
||
except ValueError:
|
||
laenge = 10000
|
||
|
||
|
||
|
||
halbe_laenge = laenge / 2
|
||
rotation= float(merkmale.get("Drehung"))
|
||
winkel = math.radians(float(rotation))
|
||
dx = halbe_laenge *math.sin(winkel * -1)
|
||
dy = halbe_laenge * math.cos(winkel)
|
||
|
||
|
||
if upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
|
||
hoehe2 = upper_hoehe_gefaehlle
|
||
upper_hoehe_gefaehlle = lower_hoehe_gefaehlle
|
||
lower_hoehe_gefaehlle = hoehe2
|
||
winkel = winkel -180
|
||
|
||
|
||
am_kreisel, kreisel_verbunden =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:
|
||
start = x +dx, y + dy,upper_hoehe_gefaehlle
|
||
ende = x -dx, y - dy,lower_hoehe_gefaehlle
|
||
line =msp.add_line(start,ende)
|
||
line.dxf.layer = "6-SP"
|
||
|
||
return
|
||
|
||
verbunden_am_einen = True
|
||
if upper_hoehe_gefaehlle == hoehe0:
|
||
hight ="higher"
|
||
else:
|
||
hight = "lower"
|
||
|
||
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{drehung0}_{hoehe_gefaehlle}_{verbunden_am_einen}_{hight}"
|
||
|
||
only_es_or_as = erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle, drehung0, laenge, blockname,hight)
|
||
|
||
if only_es_or_as == False:
|
||
blockref_layer = get_layer(doc, lib_doc, blockname)
|
||
bref =msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation, "layer": blockref_layer})
|
||
a =bref.add_attrib(
|
||
tag= "NAME",
|
||
text= merkmale.get("bezeichner"),
|
||
insert = (x,y)
|
||
)
|
||
a.is_invisible = True
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
elif "Drehung0" in gefaellestrecke_nachbarn and "Drehung1" in gefaellestrecke_nachbarn:
|
||
winkel = math.radians(float(merkmale.get("Drehung")))
|
||
|
||
laenge_m = merkmale.get("Länge in Meter", "10").replace(",", ".")
|
||
try:
|
||
laenge = float(laenge_m) * 1000 # Meter → mm
|
||
except ValueError:
|
||
laenge = 10000
|
||
halbe_laenge = laenge / 2
|
||
dx = halbe_laenge *math.sin(winkel * -1)
|
||
dy = halbe_laenge * math.cos(winkel)
|
||
drehung0 =gefaellestrecke_nachbarn.get("Drehung0")
|
||
drehung1 = gefaellestrecke_nachbarn.get("Drehung1")
|
||
hoehe0 = gefaellestrecke_nachbarn.get("Hoehe0")
|
||
hoehe1 = gefaellestrecke_nachbarn.get("Hoehe1")
|
||
x0_kreisel = float(gefaellestrecke_nachbarn.get("x0"))
|
||
y0_kreisel = float(gefaellestrecke_nachbarn.get("y0"))
|
||
x1_kreisel = float(gefaellestrecke_nachbarn.get("x1"))
|
||
y1_kreisel = float(gefaellestrecke_nachbarn.get("y1"))
|
||
richtung0 = float(gefaellestrecke_nachbarn.get("rotation0"))
|
||
richtung1 = float(gefaellestrecke_nachbarn.get("rotation1"))
|
||
richtung2 ="DEFAULT"
|
||
richtung_rad0= math.radians(richtung0)
|
||
richtung_rad1 = math.radians(richtung1)
|
||
abstand0 = float(gefaellestrecke_nachbarn.get("abstand0")) * 1000
|
||
abstand1 = float(gefaellestrecke_nachbarn.get("abstand1")) * 1000
|
||
|
||
|
||
|
||
|
||
|
||
#ausrechnung position kreisel
|
||
am_kreisel, kreisel_verbunden= am_kreisel_direct_verbunden(x, y, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, x0_kreisel, y0_kreisel, richtung_rad0, abstand0, dx, dy, x1_kreisel, y1_kreisel, richtung_rad1, abstand1)
|
||
|
||
# falls gefälle strecke mit zwei kreiseln verbunden zeichne eine einfache linie (später braucht man hier auch eine logik sobald man die richtigen es und as elemente hat)
|
||
if kreisel_verbunden == 2:
|
||
start = x +dx, y + dy,upper_hoehe_gefaehlle
|
||
ende = x -dx, y - dy,lower_hoehe_gefaehlle
|
||
line = msp.add_line(start,ende)
|
||
line.dxf.layer = "6-SP"
|
||
return
|
||
|
||
|
||
#umbezeichnung von den geraden zu strings ob es Vertikal oder Horizontal ist
|
||
if richtung0 == 90.0 or richtung0 ==270:
|
||
richtung0= "Vertikal"
|
||
else:
|
||
richtung0 = "Horinzontal"
|
||
if richtung1 == 90.0 or richtung1 ==270:
|
||
richtung1= "Vertikal"
|
||
else:
|
||
richtung1 = "Horinzontal"
|
||
richtung2,unterschiedlich = am_kreisel_direct_verbunden(x, y, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, x0_kreisel, y0_kreisel, richtung_rad0, abstand0, dx, dy, x1_kreisel, y1_kreisel, richtung_rad1, abstand1,kreisel_verbunden, richtung0 , richtung1 , richtung2 )
|
||
|
||
#Berechnung des Gefälles
|
||
|
||
if hoehe0 > hoehe1:
|
||
hight_position = "higher"
|
||
else:
|
||
hight_position = "lower"
|
||
if richtung2 == "DEFAULT":
|
||
if richtung0 == "Vertikal":
|
||
if x0_kreisel < x1_kreisel:
|
||
position = hight_position + "_links"
|
||
else:
|
||
position = hight_position + "_rechts"
|
||
else:
|
||
if y0_kreisel > y1_kreisel:
|
||
position = hight_position + "_higher"
|
||
else:
|
||
position = hight_position + "_lower"
|
||
|
||
if richtung0 == "Vertikal":
|
||
if position == "lower_rechts" or position == "higher_links":
|
||
gefaelle = "links"
|
||
else:
|
||
gefaelle = "rechts"
|
||
elif richtung0 == "Horinzontal":
|
||
if position == "lower_lower" or position == "higher_higher":
|
||
gefaelle = "oben"
|
||
else:
|
||
gefaelle = "unten"
|
||
# vertausch der drehung und der höhe für die namens gebung des blockes
|
||
if (position == "higher_rechts" or position == "lower_rechts" or position=="higher_lower" or position== "lower_lower") and drehung0 != drehung1 and am_kreisel == 0:
|
||
drehung_2 = drehung0
|
||
drehung0 = drehung1
|
||
drehung1= drehung_2
|
||
if hight_position == "higher":
|
||
hight_position = "lower"
|
||
else:
|
||
hight_position = "higher"
|
||
|
||
# austausch der werte damit immer davon ausgehen dass der 1 kreisel in unserer Liste am Kreisel verbuden ist
|
||
if kreisel_verbunden == 1 and am_kreisel ==2:
|
||
am_kreisel == 1
|
||
|
||
drehung_2 = drehung0
|
||
drehung0 = drehung1
|
||
drehung1= drehung_2
|
||
if hight_position == "higher":
|
||
hight_position = "lower"
|
||
else:
|
||
hight_position = "higher"
|
||
|
||
else:
|
||
if richtung2 == "Vertikal":
|
||
if x0_kreisel < x1_kreisel:
|
||
position = hight_position + "_links"
|
||
else:
|
||
position = hight_position + "_rechts"
|
||
else:
|
||
if y0_kreisel > y1_kreisel:
|
||
position = hight_position + "_higher"
|
||
else:
|
||
position = hight_position + "_lower"
|
||
|
||
if richtung2 == "Vertikal":
|
||
if position == "lower_rechts" or position == "higher_links":
|
||
gefaelle = "links"
|
||
else:
|
||
gefaelle = "rechts"
|
||
elif richtung2 == "Horinzontal":
|
||
if position == "lower_lower" or position == "higher_higher":
|
||
gefaelle = "oben"
|
||
else:
|
||
gefaelle = "unten"
|
||
# austausch der werte damit immer davon ausgehen dass der 1 kreisel in unserer Liste am Kreisel verbuden ist
|
||
if am_kreisel == 2:
|
||
|
||
am_kreisel = 1
|
||
drehung_2 = drehung0
|
||
drehung0 = drehung1
|
||
drehung1= drehung_2
|
||
if hight_position == "higher":
|
||
hight_position = "lower"
|
||
else:
|
||
hight_position = "higher"
|
||
|
||
|
||
if gefaelle == "oben":
|
||
rotation = 0
|
||
elif gefaelle == "unten" :
|
||
rotation = 180
|
||
elif gefaelle == "links" :
|
||
rotation = 90
|
||
elif gefaelle == "rechts" :
|
||
rotation = 270
|
||
|
||
|
||
#geben der richtung2 eines wertes außer default wenn beide kreisel die gleiche richung haben
|
||
if (kreisel_verbunden == 1 and richtung2 =="DEFAULT"):
|
||
richtung2 = richtung0
|
||
|
||
if richtung2 == "DEFAULT":
|
||
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{hoehe_gefaehlle}_{drehung0}_{drehung1}_{hight_position}_{verbunden_am_einen}"
|
||
else:
|
||
blockname = f"Ils_2.0_Gefaellestrecke_{laenge}_{hoehe_gefaehlle}_{drehung0}_{drehung1}_{hight_position}_{unterschiedlich}_{richtung2}_{verbunden_am_einen}"
|
||
gefaellegerade_erstellung(x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle,richtung2,drehung0, drehung1, laenge, hight_position,blockname)
|
||
blockref_layer = get_layer(doc, lib_doc, blockname)
|
||
|
||
|
||
bref =msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation, "layer": blockref_layer })
|
||
a = bref.add_attrib(
|
||
tag= "NAME",
|
||
text= merkmale.get("bezeichner"),
|
||
insert = (x,y)
|
||
)
|
||
a.is_invisible = True
|
||
#falls eine gefällestrecke nicht mit einem kreisel verbunden ist
|
||
else:
|
||
laenge_m = merkmale.get("Länge in Meter", "10").replace(",", ".")
|
||
try:
|
||
laenge = float(laenge_m) * 1000 # Meter → mm
|
||
except ValueError:
|
||
laenge = 10000
|
||
|
||
winkel = math.radians(float(merkmale.get("Drehung")))
|
||
halbe_laenge = laenge / 2
|
||
dx = halbe_laenge *math.sin(winkel * -1)
|
||
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)
|
||
line.dxf.layer = "6-SP"
|
||
|
||
|
||
|
||
def add_attributes_to_block(block, attributes):
|
||
"""
|
||
Fügt einem bestehenden ezdxf-Block Attribut-Definitionen hinzu.
|
||
|
||
Parameter:
|
||
block – ein ezdxf.blocks.BlockLayout Objekt
|
||
attributes – Liste von Tupeln [(tag, value), ...]
|
||
"""
|
||
for tag, value in attributes.items():
|
||
test = 3
|
||
tag = tag
|
||
value = value
|
||
a =block.add_attrib(
|
||
tag=tag,
|
||
text=value,
|
||
)
|
||
a.is_invisible = True
|
||
|
||
def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config):
|
||
|
||
winkel_VP_offset_vorne = None
|
||
winkel_VP_offset_hinten = None
|
||
# erstellung des Layers falls nicht vorhanden
|
||
if "VARIO" not in doc.layers:
|
||
doc.layers.add(name="VARIO", color=3)
|
||
|
||
if "6-SP" not in doc.layers:
|
||
doc.layers.add(name="6-SP", color=7)
|
||
# Vorbereitung der Werte
|
||
voerder_richtung = merkmale.get("Förderrichtung")
|
||
winkel = int(merkmale.get("Winkel"))
|
||
|
||
erster_kreisel_höher = False
|
||
ein_kreisel_höher = False
|
||
richtung2 ="DEFAULT"
|
||
asoffset = float(config.get("ILS 2.0 Gefällestrecke", "asoffset"))
|
||
esoffset = float(config.get("ILS 2.0 Gefällestrecke", "esoffset"))
|
||
rotation = float(merkmale.get("Drehung"))
|
||
|
||
upper_hoehe_vario= float(merkmale.get("Höhe Ende")) *1000
|
||
lower_hoehe_vario = float(merkmale.get("Höhe Anfang")) *1000
|
||
|
||
# Umstellung der Höhen falls nötig für die Konsistenz der spätere Erstellung, ist nur notwendig für ab Vario Förderer
|
||
if upper_hoehe_vario< lower_hoehe_vario:
|
||
hight = upper_hoehe_vario
|
||
upper_hoehe_vario = lower_hoehe_vario
|
||
lower_hoehe_vario = hight
|
||
# Korrektur der rotation mit der Umstellung der Höhe
|
||
rotation = rotation -180
|
||
|
||
|
||
|
||
hoehe_vario= (upper_hoehe_vario + lower_hoehe_vario)/2
|
||
# Hollen der Information der Nachbarn strukturen ob diese Kreisel sind
|
||
for nachbarn in strecken_nachbarn:
|
||
if teileid == nachbarn.get("Id"):
|
||
gefaellestrecke_vario = nachbarn
|
||
break
|
||
laenge = float(merkmale.get("Länge in Meter")) *1000
|
||
|
||
if gefaellestrecke_vario.get("Winkel") != None and winkel == 3 and voerder_richtung == "Ab":
|
||
if float(gefaellestrecke_vario.get("h0")) == lower_hoehe_vario:
|
||
if (gefaellestrecke_vario.get("Foerderrichtung") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung") == "Horizontal"):
|
||
winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel")) +3
|
||
winkel_vorne = int(gefaellestrecke_vario.get("Winkel"))
|
||
|
||
blockname = (f"Vario_Bogen_ab_{winkel_vorne_plusbogen}°")
|
||
att_vorne =import_block(blockname,lib_doc,doc)
|
||
SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_1"]))
|
||
VP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_1"]))
|
||
winkel_VP_offset_vorne = (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.cos(math.radians(-winkel_vorne)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.sin(math.radians(-winkel_vorne)), VP_1_nachbar_vorne[1],- (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.sin(math.radians(-winkel_vorne)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.cos(math.radians(-winkel_vorne))
|
||
|
||
else:
|
||
winkel_vorne_minusbogen = int(gefaellestrecke_vario.get("Winkel")) -3
|
||
winkel_vorne = int(gefaellestrecke_vario.get("Winkel"))
|
||
|
||
blockname = (f"Vario_Bogen_ab_{winkel_vorne_minusbogen}°")
|
||
att_vorne =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"]))
|
||
winkel_VP_offset_vorne = (SP_0_nachbar_vorne[0] - VP_0_nachbar_vorne[0]) * math.cos(math.radians(3)) + (SP_0_nachbar_vorne[2] - VP_0_nachbar_vorne[2])*math.sin(math.radians(3)), VP_0_nachbar_vorne[1],- (SP_0_nachbar_vorne[0] - VP_0_nachbar_vorne[0]) * math.sin(math.radians(3)) + (SP_0_nachbar_vorne[2] - VP_0_nachbar_vorne[2])*math.cos(math.radians(3))
|
||
|
||
|
||
elif float(gefaellestrecke_vario.get("h1")) == upper_hoehe_vario:
|
||
if (gefaellestrecke_vario.get("Foerderrichtung") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung") == "Horizontal"):
|
||
winkel_hinten_plusbogen = int(gefaellestrecke_vario.get("Winkel")) +3
|
||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
|
||
|
||
blockname = (f"Vario_Bogen_auf_{winkel_hinten_plusbogen}°")
|
||
att_hinten =import_block(blockname,lib_doc,doc)
|
||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_0"]))
|
||
VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_0"]))
|
||
winkel_VP_offset_hinten = (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.cos(math.radians(3)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.sin(math.radians(3)), VP_0_nachbar_hinten[1],- (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.sin(math.radians(3)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.cos(math.radians(3))
|
||
|
||
else:
|
||
winkel_hinten_minusbogen = int(gefaellestrecke_vario.get("Winkel")) -3
|
||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel"))
|
||
|
||
blockname = (f"Vario_Bogen_auf_{winkel_hinten_minusbogen}°")
|
||
att_hinten =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"]))
|
||
winkel_VP_offset_hinten = (SP_1_nachbar_hinten[0] - VP_1_nachbar_hinten[0]) * math.cos(math.radians(winkel_hinten)) + (SP_1_nachbar_hinten[2] - VP_1_nachbar_hinten[2])*math.sin(math.radians(winkel_hinten)), VP_1_nachbar_hinten[1],- (SP_1_nachbar_hinten[0] - VP_1_nachbar_hinten[0]) * math.sin(math.radians(winkel_hinten)) + (SP_1_nachbar_hinten[2] - VP_1_nachbar_hinten[2])*math.cos(math.radians(winkel_hinten))
|
||
|
||
|
||
|
||
if (gefaellestrecke_vario.get("Winkel_2") != None):
|
||
if float(gefaellestrecke_vario.get("h0_2")) == lower_hoehe_vario:
|
||
if (gefaellestrecke_vario.get("Foerderrichtung_2") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung_2") == "Horizontal"):
|
||
winkel_vorne_plusbogen = int(gefaellestrecke_vario.get("Winkel_2")) +3
|
||
winkel_vorne = int(gefaellestrecke_vario.get("Winkel_2"))
|
||
|
||
blockname = (f"Vario_Bogen_ab_{winkel_vorne_plusbogen}°")
|
||
att_vorne =import_block(blockname,lib_doc,doc)
|
||
SP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_SP_1"]))
|
||
VP_1_nachbar_vorne = list(float(att)for att in re.split(r"[;,]", att_vorne["DELTA_VP_1"]))
|
||
winkel_VP_offset_vorne = (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.cos(math.radians(-winkel_vorne)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.sin(math.radians(-winkel_vorne)), VP_1_nachbar_vorne[1],- (SP_1_nachbar_vorne[0] - VP_1_nachbar_vorne[0]) * math.sin(math.radians(-winkel_vorne)) + (SP_1_nachbar_vorne[2] - VP_1_nachbar_vorne[2])*math.cos(math.radians(-winkel_vorne))
|
||
|
||
else:
|
||
winkel_vorne_minusbogen = int(gefaellestrecke_vario.get("Winkel_2")) -3
|
||
winkel_vorne = int(gefaellestrecke_vario.get("Winkel_2"))
|
||
|
||
blockname = (f"Vario_Bogen_ab_{winkel_vorne_minusbogen}°")
|
||
att_vorne =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"]))
|
||
winkel_VP_offset_vorne = (SP_0_nachbar_vorne[0] - VP_0_nachbar_vorne[0]) * math.cos(math.radians(3)) + (SP_0_nachbar_vorne[2] - VP_0_nachbar_vorne[2])*math.sin(math.radians(3)), VP_0_nachbar_vorne[1],- (SP_0_nachbar_vorne[0] - VP_0_nachbar_vorne[0]) * math.sin(math.radians(3)) + (SP_0_nachbar_vorne[2] - VP_0_nachbar_vorne[2])*math.cos(math.radians(3))
|
||
|
||
|
||
elif float(gefaellestrecke_vario.get("h1_2")) == upper_hoehe_vario:
|
||
if (gefaellestrecke_vario.get("Foerderrichtung_2") == "Auf" or gefaellestrecke_vario.get("Foerderrichtung_2") == "Horizontal"):
|
||
winkel_hinten_plusbogen = int(gefaellestrecke_vario.get("Winkel_2")) +3
|
||
|
||
|
||
blockname = (f"Vario_Bogen_auf_{winkel_hinten_plusbogen}°")
|
||
att_hinten =import_block(blockname,lib_doc,doc)
|
||
SP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_SP_0"]))
|
||
VP_0_nachbar_hinten = list(float(att)for att in re.split(r"[;,]", att_hinten["DELTA_VP_0"]))
|
||
winkel_VP_offset_hinten = (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.cos(math.radians(3)) + (SP_0_nachbar_hinten[2] - VP_0_nachbar_hinten[2])*math.sin(math.radians(3)), VP_0_nachbar_hinten[1],- (SP_0_nachbar_hinten[0] - VP_0_nachbar_hinten[0]) * math.sin(math.radians(3)) + (SP_0_nachbar_hinten[2] - VP_1_nachbar_hinten[2])*math.cos(math.radians(3))
|
||
|
||
else:
|
||
winkel_hinten_minusbogen = int(gefaellestrecke_vario.get("Winkel")) -3
|
||
winkel_hinten = int(gefaellestrecke_vario.get("Winkel_2"))
|
||
|
||
|
||
|
||
blockname = (f"Vario_Bogen_auf_{winkel_hinten_minusbogen}°")
|
||
att_hinten =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"]))
|
||
winkel_VP_offset_hinten = ((SP_1_nachbar_hinten[0] - VP_1_nachbar_hinten[0]) * math.cos(math.radians(winkel_hinten)) + (SP_1_nachbar_hinten[2] - VP_1_nachbar_hinten[2])*math.sin(math.radians(winkel_hinten))), VP_1_nachbar_hinten[1],- (SP_1_nachbar_hinten[0] - VP_1_nachbar_vorne[0]) * math.sin(math.radians(winkel_hinten)) + (SP_1_nachbar_hinten[2] - VP_1_nachbar_hinten[2])*math.cos(math.radians(winkel_hinten))
|
||
|
||
|
||
# Für spätere berechnung schauen ob der erste Kreis in der Liste höher ist
|
||
if upper_hoehe_vario == gefaellestrecke_vario.get("Hoehe0"):
|
||
ein_kreisel_höher = True
|
||
# Aufruf falls nur mit einem Kreisel verbunden
|
||
if "Drehung0" in gefaellestrecke_vario and "Drehung1" not in gefaellestrecke_vario:
|
||
# Vorbereitund der Daten des Kreisel
|
||
halbe_laenge = laenge / 2
|
||
zwischen_winkel = float(merkmale.get("Drehung"))
|
||
richtung_rad = math.radians(zwischen_winkel)
|
||
dx = halbe_laenge * math.sin(-1 *richtung_rad)
|
||
dy = halbe_laenge * math.cos(richtung_rad)
|
||
drehung0 = gefaellestrecke_vario.get("Drehung0")
|
||
|
||
abstand0 = float(gefaellestrecke_vario.get("abstand0")) * 1000
|
||
x0_kreisel = float(gefaellestrecke_vario.get("x0"))
|
||
y0_kreisel = float(gefaellestrecke_vario.get("y0"))
|
||
richtung0 = float(gefaellestrecke_vario.get("rotation0"))
|
||
richtung_rad0= math.radians(richtung0)
|
||
|
||
# Herausfinden ob der Förderere direkt mit dem Kreisel verbunden ist, die Werte für den Zweiten Kreisel wird auf None gesetzt weil diese nicht existieren
|
||
am_kreisel,kreseil_verbunden =am_kreisel_direct_verbunden(x, y, upper_hoehe_vario, lower_hoehe_vario, x0_kreisel, y0_kreisel, richtung_rad0, abstand0, dx, dy, None, None, None, None )
|
||
if am_kreisel == 1:
|
||
# Erstellung der blockname für wenn die Motorstation rechts und links
|
||
blockname = (f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_rechts_{ein_kreisel_höher}_{drehung0}_True")
|
||
block_name_links = (f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_links_{ein_kreisel_höher}_{drehung0}_True")
|
||
# Falls der Block bereits in dem doc ist platziere diesen einfach
|
||
if blockname in doc.blocks:
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
elif merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
# Erstellung des Blocks und diesen in die Modelspace tuen. Die Linke version wird bei der vario erstellung selber am ende gemacht
|
||
block_vario = doc.blocks.new(blockname, base_point=(0,0,0))
|
||
dy_true = halbe_laenge * math.cos (0)
|
||
start = (x, y + dy_true,upper_hoehe_vario)
|
||
ende = (x,y -dy_true,lower_hoehe_vario)
|
||
# Erstellung einer Gefällestrecke von 500 mm in der Vario rein, wo es verbunden ist
|
||
if ein_kreisel_höher == True :
|
||
|
||
l = (start[0],start[1],upper_hoehe_vario)
|
||
if voerder_richtung =="Auf":
|
||
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario +500* math.sin(math.radians(3)))
|
||
start = m
|
||
elif voerder_richtung == "Ab":
|
||
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario - 500* math.sin(math.radians(3)))
|
||
start = m
|
||
else:
|
||
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario)
|
||
start = m
|
||
|
||
|
||
line = Line.new(dxfattribs={"start": l,"end":m })
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block_vario.add_entity(copy)
|
||
|
||
|
||
else:
|
||
l = (ende[0],ende[1],lower_hoehe_vario)
|
||
if voerder_richtung =="Auf":
|
||
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario - 500* math.sin(math.radians(3)))
|
||
ende = m
|
||
elif voerder_richtung == "Ab":
|
||
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario + 500* math.sin(math.radians(3)))
|
||
ende = m
|
||
else:
|
||
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario )
|
||
ende = m
|
||
line = Line.new(dxfattribs={"start": l,"end":m })
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block_vario.add_entity(copy)
|
||
# Erstellung des Vario_förderes selber
|
||
vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
||
# reintuen des förderes in den Modelspace
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
elif merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
# Abschnitt falls der Vario nur mit einem Kreisel verbunden ist und nicht an dem Kreisel direkt verbunden ist
|
||
|
||
# Erstellung der blockname für wenn die Motorstation rechts und links
|
||
blockname = (f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_rechts_{ein_kreisel_höher}_{drehung0}")
|
||
block_name_links = (f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_links_{ein_kreisel_höher}_{drehung0}")
|
||
# Falls der Block bereits in dem doc ist platziere diesen einfach
|
||
if blockname in doc.blocks:
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
elif merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
# Erstellung des Blocks und diesen in die Modelspace tuen. Die Linke version wird bei der vario erstellung selber am ende gemacht
|
||
block_vario = doc.blocks.new(blockname, base_point=(0,0,0))
|
||
dy_true = halbe_laenge * math.cos (0)
|
||
# Schauen welches as oder es element man wo verbinden muss und bereits in den block tuen, der None wert ist ein Wert der für die Gefällestrecke notwendig ist
|
||
# Entnehmen von start und end Werte für spätere vario erstellung
|
||
start, ende =erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario, drehung0, laenge, blockname,None ,block_vario, voerder_richtung, ein_kreisel_höher)
|
||
# Erstellung des Varios selber
|
||
vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
||
# reintuen des förderes in den Modelspace
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
if merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
|
||
# Erstellung einer Vario förderes wenn es mit zwei Kreisel verbunden ist
|
||
elif "Drehung0" in gefaellestrecke_vario and "Drehung1" in gefaellestrecke_vario:
|
||
# Vorbereitung der Werte für beide Kreisel
|
||
halbe_laenge = laenge / 2
|
||
zwischen_winkel = float(merkmale.get("Drehung"))
|
||
richtung_rad = math.radians(zwischen_winkel)
|
||
dx = halbe_laenge * math.sin(-1 *richtung_rad)
|
||
dy = halbe_laenge * math.cos(richtung_rad)
|
||
drehung0 = gefaellestrecke_vario.get("Drehung0")
|
||
abstand0 = float(gefaellestrecke_vario.get("abstand0")) * 1000
|
||
x0_kreisel = float(gefaellestrecke_vario.get("x0"))
|
||
y0_kreisel = float(gefaellestrecke_vario.get("y0"))
|
||
richtung0 = float(gefaellestrecke_vario.get("rotation0"))
|
||
richtung_rad0= math.radians(richtung0)
|
||
kreisel_hoehe0 =float(gefaellestrecke_vario.get("Hoehe0"))
|
||
|
||
drehung1 = gefaellestrecke_vario.get("Drehung1")
|
||
abstand1 = float(gefaellestrecke_vario.get("abstand1")) * 1000
|
||
x1_kreisel = float(gefaellestrecke_vario.get("x1"))
|
||
y1_kreisel = float(gefaellestrecke_vario.get("y1"))
|
||
richtung1 = float(gefaellestrecke_vario.get("rotation1"))
|
||
richtung_rad1= math.radians(richtung1)
|
||
kreisel_hoehe1= float(gefaellestrecke_vario.get("Hoehe1"))
|
||
# Anpassung der Kreisel, damit der Höhere Kreisel immer zuerst ist
|
||
if kreisel_hoehe0< kreisel_hoehe1:
|
||
drehung2 = drehung0
|
||
drehung0 = drehung1
|
||
drehung1 = drehung2
|
||
|
||
# Schauen ob der Förderer direkt am Kreisel verbunden ist
|
||
am_kreisel,kreisel_verbunden =am_kreisel_direct_verbunden(x, y, upper_hoehe_vario, lower_hoehe_vario, x0_kreisel, y0_kreisel, richtung_rad0, abstand0, dx, dy, x1_kreisel, y1_kreisel, richtung_rad1, abstand1)
|
||
# Falls der Förder mit beiden Kreisel verbunden ist
|
||
if kreisel_verbunden == 2:
|
||
# Erstellung der blockname für wenn die Motorstation rechts und links
|
||
blockname = (f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_rechts_{drehung0}_{drehung1}_{kreisel_verbunden}")
|
||
block_name_links = (f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_links_{drehung0}_{drehung1}_{kreisel_verbunden}")
|
||
# Falls der Block bereits in dem doc ist platziere diesen einfach
|
||
if blockname in doc.blocks:
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
elif merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
# Erstellung des Blocks und diesen in die Modelspace tuen. Die Linke version wird bei der vario erstellung selber am ende gemacht
|
||
block_vario = doc.blocks.new(blockname, base_point=(0,0,0))
|
||
dy_true = halbe_laenge * math.cos (0)
|
||
start = (x, y + dy_true,upper_hoehe_vario)
|
||
ende = (x,y -dy_true,lower_hoehe_vario)
|
||
l = (start[0],start[1],upper_hoehe_vario)
|
||
# Eine 500 mm gefällestrecke an anfang und am ende reintuen
|
||
if voerder_richtung =="Auf":
|
||
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario +500* math.sin(math.radians(3)))
|
||
start = m
|
||
|
||
elif voerder_richtung == "Ab":
|
||
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario -500* math.sin(math.radians(3)))
|
||
start = m
|
||
|
||
else:
|
||
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario )
|
||
start = m
|
||
|
||
|
||
line = Line.new(dxfattribs={"start": l,"end":m })
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block_vario.add_entity(copy)
|
||
|
||
l = (ende[0],ende[1],lower_hoehe_vario)
|
||
if voerder_richtung =="Auf":
|
||
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario - 500* math.sin(math.radians(3)))
|
||
ende = m
|
||
|
||
elif voerder_richtung == "Ab":
|
||
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario + 500* math.sin(math.radians(3)))
|
||
ende = m
|
||
else:
|
||
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario )
|
||
ende = m
|
||
line = Line.new(dxfattribs={"start": l,"end":m })
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block_vario.add_entity(copy)
|
||
# Die Vario erstellung selber
|
||
vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
||
# reintuen des förderes in den Modelspace
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
elif merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
# Falls der Förderer nur mit einem Kreisel direkt verbunden ist
|
||
if am_kreisel != 0:
|
||
#schauen ob der erste Kreisel höher ist
|
||
if upper_hoehe_vario == kreisel_hoehe0:
|
||
erster_kreisel_höher = True
|
||
else:
|
||
erster_kreisel_höher = False
|
||
# Erstellung der blockname für wenn die Motorstation rechts und links
|
||
blockname = (f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_rechts_{am_kreisel}_{erster_kreisel_höher}_{drehung0}_{drehung1}")
|
||
block_name_links = (f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_links_{am_kreisel}_{erster_kreisel_höher}_{drehung0}_{drehung1}")
|
||
|
||
# Falls der Block bereits in dem doc ist platziere diesen einfach
|
||
if blockname in doc.blocks:
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
elif merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
# Erstellung des Blocks und diesen in die Modelspace tuen. Die Linke version wird bei der vario erstellung selber am ende gemacht
|
||
block_vario = doc.blocks.new(blockname, base_point=(0,0,0))
|
||
dy_true = halbe_laenge * math.cos(0)
|
||
|
||
# schauen ob der Förderer mit welchen Kreisel der Förderer verbunden ist, und dem entsprechend eine Gefällestrecke dort reintuern
|
||
if (am_kreisel == 1 and erster_kreisel_höher == True)or (am_kreisel == 2 and erster_kreisel_höher == False):
|
||
start = (x, y + dy_true,upper_hoehe_vario)
|
||
ende = (x,y -dy_true,lower_hoehe_vario)
|
||
l = (start[0],start[1],upper_hoehe_vario)
|
||
if voerder_richtung == "Auf":
|
||
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario +500* math.sin(math.radians(3)))
|
||
z1 = m[2]
|
||
elif voerder_richtung == "Ab":
|
||
m = (start[0],start[1] - 500*math.cos(math.radians(3)),upper_hoehe_vario -500* math.sin(math.radians(3)))
|
||
z1 = m[2]
|
||
else:
|
||
m= (x,y -dy_true,lower_hoehe_vario)
|
||
z1 = m[2]
|
||
|
||
|
||
line = Line.new(dxfattribs={"start": l,"end":m })
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block_vario.add_entity(copy)
|
||
y1 = start[1] - math.cos(math.radians(3)) *500
|
||
|
||
else:
|
||
start = (x, y + dy_true,upper_hoehe_vario)
|
||
ende = (x,y -dy_true,lower_hoehe_vario)
|
||
l = (ende[0],ende[1],lower_hoehe_vario)
|
||
if voerder_richtung =="Auf":
|
||
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario - 500* math.sin(math.radians(3)))
|
||
z1 = m[2]
|
||
elif voerder_richtung == "Ab":
|
||
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario + 500* math.sin(math.radians(3)))
|
||
z1 = m[2]
|
||
else:
|
||
m = (ende[0],ende[1] + 500*math.cos(math.radians(3)) ,lower_hoehe_vario )
|
||
z1 = m[2]
|
||
|
||
line = Line.new(dxfattribs={"start": l,"end":m })
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block_vario.add_entity(copy)
|
||
y1 = ende[1] + math.cos(math.radians(3)) *500
|
||
|
||
# Schauen welche es oder as element man braucht man braucht und diese in den block einfügen
|
||
# Entnehmen von start und end Werte für spätere vario erstellung
|
||
start, ende =gefaellegerade_erstellung(x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario,richtung2, drehung0, drehung1, laenge, None, blockname,block_vario,voerder_richtung, am_kreisel,erster_kreisel_höher,y1,z1)
|
||
# Erstellung der Vario gefälle selber
|
||
vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
||
# Reintuen des endblockes in den Modelspace
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
elif merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
|
||
|
||
|
||
# Falls es nicht mit dem Kreisel direkt verbunden ist
|
||
else:
|
||
# Erstellung der blockname für wenn die Motorstation rechts und links
|
||
blockname = (f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_rechts_{drehung0}_{drehung1}")
|
||
block_name_links = (f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_links_{drehung0}_{drehung1}")
|
||
|
||
# Falls der Block bereits in dem doc ist platziere diesen einfach
|
||
if blockname in doc.blocks:
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
elif merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
|
||
# Erstellung des Blocks und diesen in die Modelspace tuen. Die Linke version wird bei der vario erstellung selber am ende gemacht
|
||
block_vario = doc.blocks.new(blockname, base_point=(0,0,0))
|
||
# Schauen welche es oder as element man braucht man braucht und diese in den block einfügen
|
||
# Entnehmen von start und end Werte für spätere vario erstellung
|
||
start, ende =gefaellegerade_erstellung(x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_vario, lower_hoehe_vario, hoehe_vario,richtung2, drehung0, drehung1, laenge, None, blockname,block_vario,voerder_richtung)
|
||
# Erstellung des Vario selber
|
||
vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block_vario,block_name_links, start, ende,voerder_richtung,winkel_VP_offset_vorne,winkel_VP_offset_hinten )
|
||
# Reintuen des endblockes in den Modelspace
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
elif merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
|
||
# Erstellung des Varios falls es nicht mit einem Kreisel verbunden ist
|
||
else:
|
||
halbe_laenge = laenge/2
|
||
dy = halbe_laenge * math.cos(0)
|
||
# Erstellung der blockname für wenn die Motorstation rechts und links
|
||
blockname = (f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_rechts")
|
||
block_name_links =(f"Vario_Foerderer_{winkel}_{voerder_richtung}_{laenge}_{hoehe_vario}_links")
|
||
# Falls der Block bereits in dem doc ist platziere diesen einfach
|
||
if blockname in doc.blocks:
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
elif merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
return
|
||
|
||
# Erstellung des Blocks und diesen in die Modelspace tuen. Die Linke version wird bei der vario erstellung selber am ende gemacht
|
||
block = doc.blocks.new(blockname, base_point=(0,0,0))
|
||
|
||
|
||
# Erstellung von start und ende
|
||
start = (x,y +dy, upper_hoehe_vario)
|
||
ende = (x ,y -dy, lower_hoehe_vario)
|
||
|
||
|
||
|
||
# Erstellung des Förderes selber
|
||
vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block,block_name_links, start, ende,voerder_richtung ,winkel_VP_offset_vorne,winkel_VP_offset_hinten)
|
||
# Reintuen des endblockes in den Modelspace
|
||
if merkmale.get("Motorseite")== "links":
|
||
msp.add_blockref(block_name_links,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
if merkmale.get("Motorseite")== "rechts":
|
||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||
|
||
|
||
|
||
|
||
|
||
|
||
def vario_erstellung(msp,merkmale, x, y, doc, lib_doc, config, winkel, hoehe_vario, laenge, block,block_name_links, start, ende,voerder_richtung,winkel_VP_offset_vorne,winkel_VP_offset_hinten ):
|
||
motor_vorhanden = merkmale.get("Motor")
|
||
umlenk_vorhanden = merkmale.get("Umlenk")
|
||
# Falls auf der Vario Förderer auf ist
|
||
umlenk_motor_offset = tuple(float(x) for x in(config.get("ILS 2.0 Variofoerderer","Umlenkstation")).split(","))
|
||
# gefahellewinkel =float(merkmale.get("Gefahellewinkel"))
|
||
|
||
# gefaelle = float(merkmale.get("Gefällestrecke"))
|
||
# if motor_vorhanden == "True":
|
||
# gefaelle = gefaelle - umlenk_motor_offset[0]
|
||
# if umlenk_vorhanden == "True":
|
||
# gefaelle = gefaelle - umlenk_motor_offset[0]
|
||
|
||
|
||
|
||
|
||
if voerder_richtung== "Auf" or voerder_richtung== "Horizontal":
|
||
|
||
# if gefaelle > 0:
|
||
# halbesgefaelle = gefaelle/2
|
||
# if motor_vorhanden == "True" and umlenk_vorhanden == "True":
|
||
# halbesgefaelle = gefaelle/2
|
||
# gefaelle_ende = ende[0], ende[1] +halbesgefaelle, ende[2] -math.sin(math.radians(gefahellewinkel))* halbesgefaelle
|
||
# line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
|
||
# line_ende_gefaelle.dxf.layer = "6-SP"
|
||
# copy_ende = line_ende_gefaelle.copy()
|
||
# copy_ende.translate(-x,-y,-hoehe_vario)
|
||
# block.add_entity(copy_ende)
|
||
# ende = gefaelle_ende
|
||
|
||
# gefaelle_start = start[0], start[1] -halbesgefaelle, start[2] +math.sin(math.radians(gefahellewinkel)) * halbesgefaelle
|
||
# line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
|
||
# line_start_gefaelle.dxf.layer = "6-SP"
|
||
# copy_start = line_start_gefaelle.copy()
|
||
# copy_start.translate(-x,-y,-hoehe_vario)
|
||
# block.add_entity(copy_start)
|
||
# start = gefaelle_start
|
||
|
||
# elif motor_vorhanden== "True":
|
||
# gefaelle_start = start[0], start[1] -gefaelle, start[2] +math.sin(math.radians(gefahellewinkel)) * gefaelle
|
||
# line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
|
||
# line_start_gefaelle.dxf.layer = "6-SP"
|
||
# copy_start = line_start_gefaelle.copy()
|
||
# copy_start.translate(-x,-y,-hoehe_vario)
|
||
# block.add_entity(copy_start)
|
||
# start = gefaelle_start
|
||
|
||
# elif umlenk_vorhanden== "True":
|
||
# gefaelle_ende = ende[0], ende[1] +gefaelle, ende[2] -math.sin(math.radians(gefahellewinkel))* gefaelle
|
||
# line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
|
||
# line_ende_gefaelle.dxf.layer = "6-SP"
|
||
# copy_ende = line_ende_gefaelle.copy()
|
||
# copy_ende.translate(-x,-y,-hoehe_vario)
|
||
# block.add_entity(copy_ende)
|
||
# ende = gefaelle_ende
|
||
|
||
# Den Motorstaton und Umlenkstation auf die richtige position in block einfügen
|
||
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
|
||
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
|
||
import_block(block_Vario_Motorstation_500mm, lib_doc, doc)
|
||
import_block(block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
||
block_Vario_Motorstation_500mm = dreh_block(block_Vario_Motorstation_500mm,doc,math.radians(3))
|
||
block_Vario_Umlenkstation_500mm = dreh_block( block_Vario_Umlenkstation_500mm, doc,math.radians(3))
|
||
if umlenk_vorhanden == "True":
|
||
block.add_blockref(block_Vario_Umlenkstation_500mm,(ende[0] -x,ende[1] -y + umlenk_motor_offset[0]/2,ende[2] - hoehe_vario -umlenk_motor_offset[2]/2 ),dxfattribs={"rotation": 90})
|
||
ende = (ende[0] ,ende[1] + umlenk_motor_offset[0],ende[2] -umlenk_motor_offset[2])
|
||
if motor_vorhanden == "True":
|
||
block.add_blockref(block_Vario_Motorstation_500mm, (start[0]-x , start[1] - umlenk_motor_offset[0]/2 -y ,start[2] - hoehe_vario +umlenk_motor_offset[2]/2),dxfattribs={"rotation": 90})
|
||
start = start[0] , start[1] - umlenk_motor_offset[0],start[2] +umlenk_motor_offset[2]
|
||
|
||
if winkel == 48:
|
||
# Einfügen der 51 Bogen und deren notwendigen Werten von dem config nehmen
|
||
block_Vario_Bogen_auf_51 = "Vario_Bogen_auf_51°"
|
||
block_Vario_Bogen_ab_51 = "Vario_Bogen_ab_51°"
|
||
|
||
auf_51_attrib =import_block(block_Vario_Bogen_auf_51, lib_doc, doc)
|
||
ab_51_attrib =import_block(block_Vario_Bogen_ab_51, lib_doc, doc)
|
||
block_Vario_Bogen_auf_51 = dreh_block(block_Vario_Bogen_auf_51, doc,math.radians(3))
|
||
block_Vario_Bogen_ab_51 = dreh_block(block_Vario_Bogen_ab_51, doc,math.radians(-48))
|
||
|
||
Vario_Bogen_auf_51_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_51_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_51_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_51_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_51_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_51_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_51_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_51_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_51_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_51_attrib["DELTA_VP_1"]))
|
||
Vario_Bogen_ab_51_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_51_attrib["DELTA_VP_0"]))
|
||
|
||
Vario_Bogen_auf_51_Delta_SP_0 = [Vario_Bogen_auf_51_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_51_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_51_Delta_SP_0[1],-Vario_Bogen_auf_51_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_51_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_51_Delta_SP_1 = [Vario_Bogen_auf_51_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_51_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_51_Delta_SP_1[1],-Vario_Bogen_auf_51_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_51_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_51_Delta_SP_0 = [Vario_Bogen_ab_51_Delta_SP_0 [0] * math.cos(math.radians(-48))+ Vario_Bogen_ab_51_Delta_SP_0[2]* math.sin(math.radians(-48)) ,Vario_Bogen_ab_51_Delta_SP_0[1],-Vario_Bogen_ab_51_Delta_SP_0[0] * math.sin(math.radians(-48))+ Vario_Bogen_ab_51_Delta_SP_0[2] * math.cos(math.radians(-48)) ]
|
||
Vario_Bogen_ab_51_Delta_SP_1 =[ Vario_Bogen_ab_51_Delta_SP_1 [0] * math.cos(math.radians(-48))+ Vario_Bogen_ab_51_Delta_SP_1[2]* math.sin(math.radians(-48)) ,Vario_Bogen_ab_51_Delta_SP_1[1],-Vario_Bogen_ab_51_Delta_SP_1[0] * math.sin(math.radians(-48))+ Vario_Bogen_ab_51_Delta_SP_1[2] * math.cos(math.radians(-48)) ]
|
||
Vario_Bogen_auf_51_Delta_VP_1 = [Vario_Bogen_auf_51_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_51_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_51_Delta_VP_1[1],-Vario_Bogen_auf_51_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_51_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_51_Delta_VP_0 = [Vario_Bogen_ab_51_Delta_VP_0 [0] * math.cos(math.radians(-48))+ Vario_Bogen_ab_51_Delta_VP_0[2]* math.sin(math.radians(-48)) ,Vario_Bogen_ab_51_Delta_VP_0[1],-Vario_Bogen_ab_51_Delta_VP_0[0] * math.sin(math.radians(-48))+ Vario_Bogen_ab_51_Delta_VP_0[2] * math.cos(math.radians(-48)) ]
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_51_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_51_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_51_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_51_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_51_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_51_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_51_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_51_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_51_Delta_VP_1:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_51_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_51_Delta_VP_0:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_51_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
#einfügen des auf blockes und erstellung des ende_VP für die VARIO lineie
|
||
block.add_blockref(block_Vario_Bogen_auf_51,(ende[0] -x ,ende[1] +Vario_Bogen_auf_51_Delta_SP_0[0] -y ,ende[2] - Vario_Bogen_auf_51_Delta_SP_0[2]- hoehe_vario ),dxfattribs={"rotation": 90})
|
||
ende_VP = (ende[0] +Vario_Bogen_auf_51_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_51_Delta_VP_1[0]+Vario_Bogen_auf_51_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_51_Delta_VP_1[2]- Vario_Bogen_auf_51_Delta_SP_0[2])
|
||
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_51_Delta_SP_1[0] + Vario_Bogen_auf_51_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_51_Delta_SP_1[2] - Vario_Bogen_auf_51_Delta_SP_0[2])
|
||
# einfügen des ab blockes und erstellung des start_VP für die VARIO lineie
|
||
block.add_blockref(block_Vario_Bogen_ab_51 ,(start[0]-x,start[1] - Vario_Bogen_ab_51_Delta_SP_1[0] -y ,start[2] - hoehe_vario-Vario_Bogen_ab_51_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
||
|
||
start_VP = start[0] +Vario_Bogen_ab_51_Delta_VP_0[1],start[1]-Vario_Bogen_ab_51_Delta_VP_0[0] - Vario_Bogen_ab_51_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_51_Delta_VP_0[2] - Vario_Bogen_ab_51_Delta_SP_1[2]
|
||
start = start[0] ,start[1] - Vario_Bogen_ab_51_Delta_SP_0[0] - Vario_Bogen_ab_51_Delta_SP_1[0],start[2] - Vario_Bogen_ab_51_Delta_SP_1[2]+ Vario_Bogen_ab_51_Delta_SP_0[2]
|
||
|
||
# Erstellung der VARIO Line
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
# Erstellung der zwischen Line
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_Bogen_ab_51,(x,y,0))
|
||
# msp.add_line((x+1000,y + 50,0),(x-1000,y +50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_51_attrib)
|
||
|
||
|
||
|
||
elif winkel == 36:
|
||
# Einfügen der 39 Bogen und deren notwendigen Werten von dem config nehmen
|
||
block_Vario_Bogen_auf_39 = "Vario_Bogen_auf_39°"
|
||
block_Vario_Bogen_ab_39 = "Vario_Bogen_ab_39°"
|
||
auf_39_attrib =import_block(block_Vario_Bogen_auf_39, lib_doc, doc)
|
||
ab_39_attrib =import_block(block_Vario_Bogen_ab_39, lib_doc, doc)
|
||
block_Vario_Bogen_auf_39= dreh_block(block_Vario_Bogen_auf_39, doc,math.radians(3))
|
||
block_Vario_Bogen_ab_39 = dreh_block(block_Vario_Bogen_ab_39, doc,math.radians(-36))
|
||
Vario_Bogen_auf_39_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_39_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_39_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_39_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_39_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_39_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_39_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_39_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_39_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_39_attrib["DELTA_VP_1"]))
|
||
Vario_Bogen_ab_39_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_39_attrib["DELTA_VP_0"]))
|
||
|
||
|
||
Vario_Bogen_auf_39_Delta_SP_0 = [Vario_Bogen_auf_39_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_39_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_39_Delta_SP_0[1],-Vario_Bogen_auf_39_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_39_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_39_Delta_SP_1 = [Vario_Bogen_auf_39_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_39_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_39_Delta_SP_1[1],-Vario_Bogen_auf_39_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_39_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_39_Delta_SP_0 = [Vario_Bogen_ab_39_Delta_SP_0 [0] * math.cos(math.radians(-36))+ Vario_Bogen_ab_39_Delta_SP_0[2]* math.sin(math.radians(-36)) ,Vario_Bogen_ab_39_Delta_SP_0[1],-Vario_Bogen_ab_39_Delta_SP_0[0] * math.sin(math.radians(-36))+ Vario_Bogen_ab_39_Delta_SP_0[2] * math.cos(math.radians(-36)) ]
|
||
Vario_Bogen_ab_39_Delta_SP_1 =[ Vario_Bogen_ab_39_Delta_SP_1 [0] * math.cos(math.radians(-36))+ Vario_Bogen_ab_39_Delta_SP_1[2]* math.sin(math.radians(-36)) ,Vario_Bogen_ab_39_Delta_SP_1[1],-Vario_Bogen_ab_39_Delta_SP_1[0] * math.sin(math.radians(-36))+ Vario_Bogen_ab_39_Delta_SP_1[2] * math.cos(math.radians(-36)) ]
|
||
Vario_Bogen_auf_39_Delta_VP_1 = [Vario_Bogen_auf_39_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_39_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_39_Delta_VP_1[1],-Vario_Bogen_auf_39_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_39_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_39_Delta_VP_0 = [Vario_Bogen_ab_39_Delta_VP_0 [0] * math.cos(math.radians(-36))+ Vario_Bogen_ab_39_Delta_VP_0[2]* math.sin(math.radians(-36)) ,Vario_Bogen_ab_39_Delta_VP_0[1],-Vario_Bogen_ab_39_Delta_VP_0[0] * math.sin(math.radians(-36))+ Vario_Bogen_ab_39_Delta_VP_0[2] * math.cos(math.radians(-36)) ]
|
||
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_39_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_39_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_39_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_39_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_39_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_39_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_39_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_39_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_39_Delta_VP_1:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_39_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_39_Delta_VP_0:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_39_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
# einfügen des auf blockes und erstellung des ende_VP für die VARIO lineie
|
||
block.add_blockref(block_Vario_Bogen_auf_39,(ende[0] -x ,ende[1] +Vario_Bogen_auf_39_Delta_SP_0[0] -y ,ende[2] - Vario_Bogen_auf_39_Delta_SP_0[2]- hoehe_vario ),dxfattribs={"rotation": 90})
|
||
|
||
ende_VP = (ende[0] +Vario_Bogen_auf_39_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_39_Delta_VP_1[0]+Vario_Bogen_auf_39_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_39_Delta_VP_1[2]- Vario_Bogen_auf_39_Delta_SP_0[2])
|
||
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_39_Delta_SP_1[0] + Vario_Bogen_auf_39_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_39_Delta_SP_1[2] -Vario_Bogen_auf_39_Delta_SP_0[2])
|
||
|
||
# einfügen des ab blockes und erstellung des start_VP für die VARIO lineie
|
||
block.add_blockref(block_Vario_Bogen_ab_39 ,(start[0]-x,start[1] - Vario_Bogen_ab_39_Delta_SP_1[0] -y ,start[2] - hoehe_vario-Vario_Bogen_ab_39_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
||
start_VP = start[0] +Vario_Bogen_ab_39_Delta_VP_0[1],start[1]-Vario_Bogen_ab_39_Delta_VP_0[0] - Vario_Bogen_ab_39_Delta_SP_1[0] ,start[2]+ Vario_Bogen_ab_39_Delta_VP_0[2] - Vario_Bogen_ab_39_Delta_SP_1[2]
|
||
|
||
start = start[0] ,start[1] - Vario_Bogen_ab_39_Delta_SP_0[0] - Vario_Bogen_ab_39_Delta_SP_1[0],start[2] +Vario_Bogen_ab_39_Delta_SP_0[2] - Vario_Bogen_ab_39_Delta_SP_1[2]
|
||
|
||
# Erstellung der VARIO Line
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
# Erstellung der zwischen Line
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_Bogen_ab_39,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_39_attrib)
|
||
|
||
|
||
|
||
elif winkel == 24:
|
||
# Einfügen der 27 Bogen und deren notwendigen Werten von dem config nehmen
|
||
block_Vario_Bogen_auf_27 = "Vario_Bogen_auf_27°"
|
||
block_Vario_Bogen_ab_27 = "Vario_Bogen_ab_27°"
|
||
auf_27_attrib =import_block(block_Vario_Bogen_auf_27, lib_doc, doc)
|
||
ab_27_attrib = import_block(block_Vario_Bogen_ab_27, lib_doc, doc)
|
||
block_Vario_Bogen_auf_27= dreh_block(block_Vario_Bogen_auf_27, doc,math.radians(3))
|
||
block_Vario_Bogen_ab_27 = dreh_block(block_Vario_Bogen_ab_27, doc,math.radians(-24))
|
||
Vario_Bogen_auf_27_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_27_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_27_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_27_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_27_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_27_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_27_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_27_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_27_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_27_attrib["DELTA_VP_1"]))
|
||
Vario_Bogen_ab_27_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_27_attrib["DELTA_VP_0"]))
|
||
|
||
|
||
Vario_Bogen_auf_27_Delta_SP_0 = [Vario_Bogen_auf_27_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_27_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_27_Delta_SP_0[1],-Vario_Bogen_auf_27_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_27_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_27_Delta_SP_1 = [Vario_Bogen_auf_27_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_27_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_27_Delta_SP_1[1],-Vario_Bogen_auf_27_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_27_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_27_Delta_SP_0 = [Vario_Bogen_ab_27_Delta_SP_0 [0] * math.cos(math.radians(-24))+ Vario_Bogen_ab_27_Delta_SP_0[2]* math.sin(math.radians(-24)) ,Vario_Bogen_ab_27_Delta_SP_0[1],-Vario_Bogen_ab_27_Delta_SP_0[0] * math.sin(math.radians(-24))+ Vario_Bogen_ab_27_Delta_SP_0[2] * math.cos(math.radians(-24)) ]
|
||
Vario_Bogen_ab_27_Delta_SP_1 =[ Vario_Bogen_ab_27_Delta_SP_1 [0] * math.cos(math.radians(-24))+ Vario_Bogen_ab_27_Delta_SP_1[2]* math.sin(math.radians(-24)) ,Vario_Bogen_ab_27_Delta_SP_1[1],-Vario_Bogen_ab_27_Delta_SP_1[0] * math.sin(math.radians(-24))+ Vario_Bogen_ab_27_Delta_SP_1[2] * math.cos(math.radians(-24)) ]
|
||
Vario_Bogen_auf_27_Delta_VP_1 = [Vario_Bogen_auf_27_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_27_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_27_Delta_VP_1[1],-Vario_Bogen_auf_27_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_27_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_27_Delta_VP_0 = [Vario_Bogen_ab_27_Delta_VP_0 [0] * math.cos(math.radians(-24))+ Vario_Bogen_ab_27_Delta_VP_0[2]* math.sin(math.radians(-24)) ,Vario_Bogen_ab_27_Delta_VP_0[1],-Vario_Bogen_ab_27_Delta_VP_0[0] * math.sin(math.radians(-24))+ Vario_Bogen_ab_27_Delta_VP_0[2] * math.cos(math.radians(-24)) ]
|
||
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_27_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_27_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_27_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_27_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_27_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_27_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_27_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_27_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_27_Delta_VP_1:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_27_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_27_Delta_VP_0:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_27_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
|
||
# einfügen des auf blockes und erstellung des ende_VP für die VARIO lineie
|
||
block.add_blockref(block_Vario_Bogen_auf_27,(ende[0] -x ,ende[1] +Vario_Bogen_auf_27_Delta_SP_0[0] -y ,ende[2] - Vario_Bogen_auf_27_Delta_SP_0[2]- hoehe_vario ),dxfattribs={"rotation": 90})
|
||
|
||
ende_VP = (ende[0] +Vario_Bogen_auf_27_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_27_Delta_VP_1[0]+Vario_Bogen_auf_27_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_27_Delta_VP_1[2]- Vario_Bogen_auf_27_Delta_SP_0[2])
|
||
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_27_Delta_SP_1[0] + Vario_Bogen_auf_27_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_27_Delta_SP_1[2] - Vario_Bogen_auf_27_Delta_SP_0[2])
|
||
|
||
# einfügen des ab blockes und erstellung des start_VP für die VARIO lineie
|
||
block.add_blockref(block_Vario_Bogen_ab_27 ,(start[0]-x,start[1] - Vario_Bogen_ab_27_Delta_SP_1[0] -y ,start[2] - hoehe_vario - Vario_Bogen_ab_27_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
||
start_VP = start[0] +Vario_Bogen_ab_27_Delta_VP_0[1],start[1]-Vario_Bogen_ab_27_Delta_VP_0[0] - Vario_Bogen_ab_27_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_27_Delta_VP_0[2] - Vario_Bogen_ab_27_Delta_SP_1[2]
|
||
start = start[0] ,start[1] - Vario_Bogen_ab_27_Delta_SP_0[0] - Vario_Bogen_ab_27_Delta_SP_1[0],start[2] +Vario_Bogen_ab_27_Delta_SP_0[2] - Vario_Bogen_ab_27_Delta_SP_1[2]
|
||
|
||
# Erstellung der VARIO Line
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
|
||
# Erstellung der zwischen Line
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_Bogen_ab_27,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_27_attrib)
|
||
|
||
|
||
|
||
elif winkel == 15:
|
||
# Einfügen der 18 Bogen und deren notwendigen Werten von dem config nehmen
|
||
block_Vario_Bogen_ab_18 = "Vario_Bogen_ab_18°"
|
||
block_Vario_Bogen_auf_18 = "Vario_Bogen_auf_18°"
|
||
auf_18_attrib =import_block(block_Vario_Bogen_auf_18, lib_doc, doc)
|
||
ab_18_attrib = import_block(block_Vario_Bogen_ab_18, lib_doc, doc,)
|
||
block_Vario_Bogen_auf_18 = dreh_block(block_Vario_Bogen_auf_18, doc,math.radians(3))
|
||
block_Vario_Bogen_ab_18 = dreh_block(block_Vario_Bogen_ab_18, doc,math.radians(-15))
|
||
Vario_Bogen_auf_18_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_18_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_18_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_18_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_18_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_18_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_18_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_18_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_18_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_18_attrib["DELTA_VP_1"]))
|
||
Vario_Bogen_ab_18_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_18_attrib["DELTA_VP_0"]))
|
||
|
||
Vario_Bogen_auf_18_Delta_SP_0 = [Vario_Bogen_auf_18_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_18_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_18_Delta_SP_0[1],-Vario_Bogen_auf_18_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_18_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_18_Delta_SP_1 = [Vario_Bogen_auf_18_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_18_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_18_Delta_SP_1[1],-Vario_Bogen_auf_18_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_18_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_18_Delta_SP_0 = [Vario_Bogen_ab_18_Delta_SP_0 [0] * math.cos(math.radians(-15))+ Vario_Bogen_ab_18_Delta_SP_0[2]* math.sin(math.radians(-15)) ,Vario_Bogen_ab_18_Delta_SP_0[1],-Vario_Bogen_ab_18_Delta_SP_0[0] * math.sin(math.radians(-15))+ Vario_Bogen_ab_18_Delta_SP_0[2] * math.cos(math.radians(-15)) ]
|
||
Vario_Bogen_ab_18_Delta_SP_1 =[ Vario_Bogen_ab_18_Delta_SP_1 [0] * math.cos(math.radians(-15))+ Vario_Bogen_ab_18_Delta_SP_1[2]* math.sin(math.radians(-15)) ,Vario_Bogen_ab_18_Delta_SP_1[1],-Vario_Bogen_ab_18_Delta_SP_1[0] * math.sin(math.radians(-15))+ Vario_Bogen_ab_18_Delta_SP_1[2] * math.cos(math.radians(-15)) ]
|
||
Vario_Bogen_auf_18_Delta_VP_1 = [Vario_Bogen_auf_18_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_18_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_18_Delta_VP_1[1],-Vario_Bogen_auf_18_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_18_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_18_Delta_VP_0 = [Vario_Bogen_ab_18_Delta_VP_0 [0] * math.cos(math.radians(-15))+ Vario_Bogen_ab_18_Delta_VP_0[2]* math.sin(math.radians(-15)) ,Vario_Bogen_ab_18_Delta_VP_0[1],-Vario_Bogen_ab_18_Delta_VP_0[0] * math.sin(math.radians(-15))+ Vario_Bogen_ab_18_Delta_VP_0[2] * math.cos(math.radians(-15)) ]
|
||
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_18_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_18_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_18_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_18_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_18_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_18_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_18_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_18_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_18_Delta_VP_1:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_18_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_18_Delta_VP_0:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_18_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
# einfügen des auf blockes und erstellung des ende_VP für die VARIO lineie
|
||
block.add_blockref(block_Vario_Bogen_auf_18,(ende[0] -x ,ende[1] +Vario_Bogen_auf_18_Delta_SP_0[0] -y ,ende[2] - Vario_Bogen_auf_18_Delta_SP_0[2]- hoehe_vario ),dxfattribs={"rotation": 90})
|
||
ende_VP = (ende[0] +Vario_Bogen_auf_18_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_18_Delta_VP_1[0]+Vario_Bogen_auf_18_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_18_Delta_VP_1[2]- Vario_Bogen_auf_18_Delta_SP_0[2])
|
||
|
||
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_18_Delta_SP_1[0] + Vario_Bogen_auf_18_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_18_Delta_SP_1[2] - Vario_Bogen_auf_18_Delta_SP_0[2])
|
||
|
||
# einfügen des ab blockes und erstellung des start_VP für die VARIO lineie
|
||
block.add_blockref(block_Vario_Bogen_ab_18 ,(start[0]-x,start[1] - Vario_Bogen_ab_18_Delta_SP_1[0] -y ,start[2] - hoehe_vario-Vario_Bogen_ab_18_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
||
|
||
start_VP = start[0] +Vario_Bogen_ab_18_Delta_VP_0[1],start[1]-Vario_Bogen_ab_18_Delta_VP_0[0] - Vario_Bogen_ab_18_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_18_Delta_VP_0[2] - Vario_Bogen_ab_18_Delta_SP_1[2]
|
||
start = start[0] ,start[1] - Vario_Bogen_ab_18_Delta_SP_0[0] - Vario_Bogen_ab_18_Delta_SP_1[0],start[2] +Vario_Bogen_ab_18_Delta_SP_0[2] - Vario_Bogen_ab_18_Delta_SP_1[2]
|
||
|
||
# Erstellung der VARIO Line
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
|
||
# Erstellung der zwischen Line
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_Bogen_ab_18,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_18_attrib)
|
||
|
||
|
||
|
||
elif winkel == 12:
|
||
block_Vario_Bogen_ab_15 = "Vario_Bogen_ab_15°"
|
||
block_Vario_Bogen_auf_15 = "Vario_Bogen_auf_15°"
|
||
auf_15_attrib =import_block(block_Vario_Bogen_auf_15, lib_doc, doc)
|
||
ab_15_attrib =import_block(block_Vario_Bogen_ab_15, lib_doc, doc)
|
||
block_Vario_Bogen_auf_15= dreh_block(block_Vario_Bogen_auf_15, doc,math.radians(3))
|
||
block_Vario_Bogen_ab_15 = dreh_block(block_Vario_Bogen_ab_15, doc,math.radians(-12))
|
||
Vario_Bogen_auf_15_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_15_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_15_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_15_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_15_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_15_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_15_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_15_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_15_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_15_attrib["DELTA_VP_1"]))
|
||
Vario_Bogen_ab_15_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_15_attrib["DELTA_VP_0"]))
|
||
|
||
|
||
Vario_Bogen_auf_15_Delta_SP_0 = [Vario_Bogen_auf_15_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_15_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_15_Delta_SP_0[1],-Vario_Bogen_auf_15_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_15_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_15_Delta_SP_1 = [Vario_Bogen_auf_15_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_15_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_15_Delta_SP_1[1],-Vario_Bogen_auf_15_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_15_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_15_Delta_SP_0 = [Vario_Bogen_ab_15_Delta_SP_0 [0] * math.cos(math.radians(-12))+ Vario_Bogen_ab_15_Delta_SP_0[2]* math.sin(math.radians(-12)) ,Vario_Bogen_ab_15_Delta_SP_0[1],-Vario_Bogen_ab_15_Delta_SP_0[0] * math.sin(math.radians(-12))+ Vario_Bogen_ab_15_Delta_SP_0[2] * math.cos(math.radians(-12)) ]
|
||
Vario_Bogen_ab_15_Delta_SP_1 =[ Vario_Bogen_ab_15_Delta_SP_1 [0] * math.cos(math.radians(-12))+ Vario_Bogen_ab_15_Delta_SP_1[2]* math.sin(math.radians(-12)) ,Vario_Bogen_ab_15_Delta_SP_1[1],-Vario_Bogen_ab_15_Delta_SP_1[0] * math.sin(math.radians(-12))+ Vario_Bogen_ab_15_Delta_SP_1[2] * math.cos(math.radians(-12)) ]
|
||
Vario_Bogen_auf_15_Delta_VP_1 = [Vario_Bogen_auf_15_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_15_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_15_Delta_VP_1[1],-Vario_Bogen_auf_15_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_15_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_15_Delta_VP_0 = [Vario_Bogen_ab_15_Delta_VP_0 [0] * math.cos(math.radians(-12))+ Vario_Bogen_ab_15_Delta_VP_0[2]* math.sin(math.radians(-12)) ,Vario_Bogen_ab_15_Delta_VP_0[1],-Vario_Bogen_ab_15_Delta_VP_0[0] * math.sin(math.radians(-12))+ Vario_Bogen_ab_15_Delta_VP_0[2] * math.cos(math.radians(-12)) ]
|
||
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_15_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_15_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_15_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_15_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_15_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_15_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_15_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_15_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_15_Delta_VP_1:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_15_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_15_Delta_VP_0:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_15_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
block.add_blockref(block_Vario_Bogen_auf_15,(ende[0] -x ,ende[1] +Vario_Bogen_auf_15_Delta_SP_0[0] -y ,ende[2] - Vario_Bogen_auf_15_Delta_SP_0[2]- hoehe_vario ),dxfattribs={"rotation": 90})
|
||
ende_VP = (ende[0] +Vario_Bogen_auf_15_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_15_Delta_VP_1[0]+Vario_Bogen_auf_15_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_15_Delta_VP_1[2]- Vario_Bogen_auf_15_Delta_SP_0[2])
|
||
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_15_Delta_SP_1[0] + Vario_Bogen_auf_15_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_15_Delta_SP_1[2] - Vario_Bogen_auf_15_Delta_SP_0[2])
|
||
|
||
block.add_blockref(block_Vario_Bogen_ab_15 ,(start[0]-x,start[1] - Vario_Bogen_ab_15_Delta_SP_1[0] -y ,start[2] - hoehe_vario-Vario_Bogen_ab_15_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
||
|
||
start_VP = start[0] +Vario_Bogen_ab_15_Delta_VP_0[1],start[1]-Vario_Bogen_ab_15_Delta_VP_0[0] - Vario_Bogen_ab_15_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_15_Delta_VP_0[2] - Vario_Bogen_ab_15_Delta_SP_1[2]
|
||
start = start[0] ,start[1] - Vario_Bogen_ab_15_Delta_SP_0[0] - Vario_Bogen_ab_15_Delta_SP_1[0],start[2] +Vario_Bogen_ab_15_Delta_SP_0[2] - Vario_Bogen_ab_15_Delta_SP_1[2]
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_Bogen_auf_15,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, auf_15_attrib)
|
||
|
||
|
||
|
||
|
||
elif winkel == 9:
|
||
block_Vario_Bogen_ab_12 = "Vario_Bogen_ab_12°"
|
||
block_Vario_Bogen_auf_12 = "Vario_Bogen_auf_12°"
|
||
auf_12_attrib =import_block(block_Vario_Bogen_auf_12, lib_doc, doc)
|
||
ab_12_attrib =import_block(block_Vario_Bogen_ab_12, lib_doc, doc)
|
||
block_Vario_Bogen_auf_12 = dreh_block(block_Vario_Bogen_auf_12, doc,math.radians(3))
|
||
block_Vario_Bogen_ab_12 = dreh_block(block_Vario_Bogen_ab_12, doc,math.radians(-9))
|
||
Vario_Bogen_auf_12_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_12_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_12_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_12_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_12_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_12_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_12_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_12_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_12_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_12_attrib["DELTA_VP_1"]))
|
||
Vario_Bogen_ab_12_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_12_attrib["DELTA_VP_0"]))
|
||
|
||
|
||
Vario_Bogen_auf_12_Delta_SP_0 = [Vario_Bogen_auf_12_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_12_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_12_Delta_SP_0[1],-Vario_Bogen_auf_12_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_12_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_12_Delta_SP_1 = [Vario_Bogen_auf_12_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_12_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_12_Delta_SP_1[1],-Vario_Bogen_auf_12_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_12_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_12_Delta_SP_0 = [Vario_Bogen_ab_12_Delta_SP_0 [0] * math.cos(math.radians(-9))+ Vario_Bogen_ab_12_Delta_SP_0[2]* math.sin(math.radians(-9)) ,Vario_Bogen_ab_12_Delta_SP_0[1],-Vario_Bogen_ab_12_Delta_SP_0[0] * math.sin(math.radians(-9))+ Vario_Bogen_ab_12_Delta_SP_0[2] * math.cos(math.radians(-9)) ]
|
||
Vario_Bogen_ab_12_Delta_SP_1 =[ Vario_Bogen_ab_12_Delta_SP_1 [0] * math.cos(math.radians(-9))+ Vario_Bogen_ab_12_Delta_SP_1[2]* math.sin(math.radians(-9)) ,Vario_Bogen_ab_12_Delta_SP_1[1],-Vario_Bogen_ab_12_Delta_SP_1[0] * math.sin(math.radians(-9))+ Vario_Bogen_ab_12_Delta_SP_1[2] * math.cos(math.radians(-9)) ]
|
||
Vario_Bogen_auf_12_Delta_VP_1 = [Vario_Bogen_auf_12_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_12_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_12_Delta_VP_1[1],-Vario_Bogen_auf_12_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_12_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_12_Delta_VP_0 = [Vario_Bogen_ab_12_Delta_VP_0 [0] * math.cos(math.radians(-9))+ Vario_Bogen_ab_12_Delta_VP_0[2]* math.sin(math.radians(-9)) ,Vario_Bogen_ab_12_Delta_VP_0[1],-Vario_Bogen_ab_12_Delta_VP_0[0] * math.sin(math.radians(-9))+ Vario_Bogen_ab_12_Delta_VP_0[2] * math.cos(math.radians(-9)) ]
|
||
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_12_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_12_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_12_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_12_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_12_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_12_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_12_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_12_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_12_Delta_VP_1:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_12_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_12_Delta_VP_0:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_12_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
|
||
|
||
|
||
block.add_blockref(block_Vario_Bogen_auf_12,(ende[0] -x ,ende[1] +Vario_Bogen_auf_12_Delta_SP_0[0] -y ,ende[2] - Vario_Bogen_auf_12_Delta_SP_0[2]- hoehe_vario ),dxfattribs={"rotation": 90})
|
||
|
||
ende_VP = (ende[0] +Vario_Bogen_auf_12_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_12_Delta_VP_1[0]+Vario_Bogen_auf_12_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_12_Delta_VP_1[2]- Vario_Bogen_auf_12_Delta_SP_0[2])
|
||
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_12_Delta_SP_1[0] + Vario_Bogen_auf_12_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_12_Delta_SP_1[2] - Vario_Bogen_auf_12_Delta_SP_0[2])
|
||
|
||
block.add_blockref(block_Vario_Bogen_ab_12 ,(start[0]-x,start[1] - Vario_Bogen_ab_12_Delta_SP_1[0] -y ,start[2] - hoehe_vario-Vario_Bogen_ab_12_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
||
|
||
start_VP = start[0] +Vario_Bogen_ab_12_Delta_VP_0[1],start[1]-Vario_Bogen_ab_12_Delta_VP_0[0] - Vario_Bogen_ab_12_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_12_Delta_VP_0[2] - Vario_Bogen_ab_12_Delta_SP_1[2]
|
||
start = start[0] ,start[1] - Vario_Bogen_ab_12_Delta_SP_0[0] - Vario_Bogen_ab_12_Delta_SP_1[0],start[2] +Vario_Bogen_ab_12_Delta_SP_0[2] - Vario_Bogen_ab_12_Delta_SP_1[2]
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_Bogen_ab_12,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_12_attrib)
|
||
|
||
|
||
|
||
|
||
elif winkel == 3:
|
||
block_Vario_ab_6 = "Vario_Bogen_ab_6°"
|
||
block_Vario_auf_6 = "Vario_Bogen_auf_6°"
|
||
ab_6_attrib =import_block( block_Vario_ab_6 , lib_doc, doc)
|
||
auf_6_attrib =import_block( block_Vario_auf_6 , lib_doc, doc)
|
||
block_Vario_ab_6 = dreh_block( block_Vario_ab_6, doc, math.radians(3))
|
||
block_Vario_auf_6 = dreh_block( block_Vario_auf_6 , doc, math.radians(-3))
|
||
Vario_Bogen_auf_6_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_6_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_6_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_6_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_6_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_6_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_6_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_6_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_6_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_6_attrib["DELTA_VP_1"]))
|
||
Vario_Bogen_ab_6_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_6_attrib["DELTA_VP_0"]))
|
||
|
||
|
||
Vario_Bogen_auf_6_Delta_SP_0 = [Vario_Bogen_auf_6_Delta_SP_0 [0] * math.cos(math.radians(-3))+ Vario_Bogen_auf_6_Delta_SP_0[2]* math.sin(math.radians(-3)) ,Vario_Bogen_auf_6_Delta_SP_0[1],-Vario_Bogen_auf_6_Delta_SP_0[0] * math.sin(math.radians(-3))+ Vario_Bogen_auf_6_Delta_SP_0[2] * math.cos(math.radians(-3)) ]
|
||
Vario_Bogen_auf_6_Delta_SP_1 = [Vario_Bogen_auf_6_Delta_SP_1 [0] * math.cos(math.radians(-3))+ Vario_Bogen_auf_6_Delta_SP_1[2]* math.sin(math.radians(-3)) ,Vario_Bogen_auf_6_Delta_SP_1[1],-Vario_Bogen_auf_6_Delta_SP_1[0] * math.sin(math.radians(-3))+ Vario_Bogen_auf_6_Delta_SP_1[2] * math.cos(math.radians(-3)) ]
|
||
Vario_Bogen_ab_6_Delta_SP_0 = [Vario_Bogen_ab_6_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_6_Delta_SP_0[1],-Vario_Bogen_ab_6_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_6_Delta_SP_1 =[ Vario_Bogen_ab_6_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_6_Delta_SP_1[1],-Vario_Bogen_ab_6_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_6_Delta_VP_1 = [Vario_Bogen_auf_6_Delta_VP_1 [0] * math.cos(math.radians(-3))+ Vario_Bogen_auf_6_Delta_VP_1[2]* math.sin(math.radians(-3)) ,Vario_Bogen_auf_6_Delta_VP_1[1],-Vario_Bogen_auf_6_Delta_VP_1[0] * math.sin(math.radians(-3))+ Vario_Bogen_auf_6_Delta_VP_1[2] * math.cos(math.radians(-3)) ]
|
||
Vario_Bogen_ab_6_Delta_VP_0 = [Vario_Bogen_ab_6_Delta_VP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_6_Delta_VP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_6_Delta_VP_0[1],-Vario_Bogen_ab_6_Delta_VP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_6_Delta_VP_0[2] * math.cos(math.radians(3)) ]
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_6_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_6_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_6_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_6_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_6_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_6_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_6_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_6_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_6_Delta_VP_1:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_6_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_6_Delta_VP_0:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_6_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
block.add_blockref(block_Vario_auf_6,(ende[0] -x ,ende[1] +Vario_Bogen_auf_6_Delta_SP_0[0] -y ,ende[2] - Vario_Bogen_auf_6_Delta_SP_0[2]- hoehe_vario ),dxfattribs={"rotation": 90})
|
||
|
||
ende_VP = (ende[0] +Vario_Bogen_auf_6_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_6_Delta_VP_1[0]+Vario_Bogen_auf_6_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_6_Delta_VP_1[2]- Vario_Bogen_auf_6_Delta_SP_0[2])
|
||
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_6_Delta_SP_1[0] + Vario_Bogen_auf_6_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_6_Delta_SP_1[2] - Vario_Bogen_auf_6_Delta_SP_0[2])
|
||
|
||
block.add_blockref(block_Vario_ab_6 ,(start[0]-x,start[1] - Vario_Bogen_ab_6_Delta_SP_1[0] -y ,start[2] - hoehe_vario-Vario_Bogen_ab_6_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
||
|
||
start_VP = start[0] +Vario_Bogen_ab_6_Delta_VP_0[1],start[1]-Vario_Bogen_ab_6_Delta_VP_0[0] - Vario_Bogen_ab_6_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_6_Delta_VP_0[2] - Vario_Bogen_ab_6_Delta_SP_1[2]
|
||
start = start[0] ,start[1] - Vario_Bogen_ab_6_Delta_SP_0[0] - Vario_Bogen_ab_6_Delta_SP_1[0],start[2] +Vario_Bogen_ab_6_Delta_SP_0[2] - Vario_Bogen_ab_6_Delta_SP_1[2]
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_ab_6,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_6_attrib)
|
||
elif winkel == 0:
|
||
block_Vario_Bogen_auf_3 = "Vario_Bogen_auf_3°"
|
||
block_Vario_Bogen_ab_3 = "Vario_Bogen_ab_3°"
|
||
auf_3_attrib =import_block(block_Vario_Bogen_auf_3, lib_doc, doc)
|
||
ab_3_attrib = import_block(block_Vario_Bogen_ab_3, lib_doc, doc)
|
||
block_Vario_Bogen_auf_3= dreh_block(block_Vario_Bogen_auf_3, doc,math.radians(3))
|
||
block_Vario_Bogen_ab_3 = dreh_block(block_Vario_Bogen_ab_3, doc,math.radians(0))
|
||
Vario_Bogen_auf_3_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_3_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_3_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_3_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_3_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_3_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_3_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_3_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_3_Delta_VP_1 = list(float(att) for att in re.split(r"[;,]", auf_3_attrib["DELTA_VP_1"]))
|
||
Vario_Bogen_ab_3_Delta_VP_0= list(float(att) for att in re.split(r"[;,]", ab_3_attrib["DELTA_VP_0"]))
|
||
|
||
|
||
Vario_Bogen_auf_3_Delta_SP_0 = [Vario_Bogen_auf_3_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_3_Delta_SP_0[1],-Vario_Bogen_auf_3_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_3_Delta_SP_1 = [Vario_Bogen_auf_3_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_3_Delta_SP_1[1],-Vario_Bogen_auf_3_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_3_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_3_Delta_SP_0 = [Vario_Bogen_ab_3_Delta_SP_0 [0] ,Vario_Bogen_ab_3_Delta_SP_0[1],Vario_Bogen_ab_3_Delta_SP_0[2] ]
|
||
Vario_Bogen_ab_3_Delta_SP_1 =[ Vario_Bogen_ab_3_Delta_SP_1 [0] ,Vario_Bogen_ab_3_Delta_SP_1[1],Vario_Bogen_ab_3_Delta_SP_1[2] ]
|
||
Vario_Bogen_auf_3_Delta_VP_1 = [Vario_Bogen_auf_3_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_auf_3_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_auf_3_Delta_VP_1[1],-Vario_Bogen_auf_3_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_auf_3_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_3_Delta_VP_0 = [Vario_Bogen_ab_3_Delta_VP_0 [0],Vario_Bogen_ab_3_Delta_VP_0[1],Vario_Bogen_ab_3_Delta_VP_0[2] ]
|
||
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_3_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_3_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_3_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_3_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_3_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_3_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_3_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_3_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_3_Delta_VP_1:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_3_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_3_Delta_VP_0:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_3_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
|
||
# einfügen des auf blockes und erstellung des ende_VP für die VARIO lineie
|
||
block.add_blockref(block_Vario_Bogen_auf_3,(ende[0] -x ,ende[1] +Vario_Bogen_auf_3_Delta_SP_0[0] -y ,ende[2] - Vario_Bogen_auf_3_Delta_SP_0[2]- hoehe_vario ),dxfattribs={"rotation": 90})
|
||
|
||
ende_VP = (ende[0] +Vario_Bogen_auf_3_Delta_VP_1[1], ende[1]+Vario_Bogen_auf_3_Delta_VP_1[0]+Vario_Bogen_auf_3_Delta_SP_0[0],ende[2] + Vario_Bogen_auf_3_Delta_VP_1[2]- Vario_Bogen_auf_3_Delta_SP_0[2])
|
||
ende = (ende[0] ,ende[1] +Vario_Bogen_auf_3_Delta_SP_1[0] + Vario_Bogen_auf_3_Delta_SP_0[0] ,ende[2] + Vario_Bogen_auf_3_Delta_SP_1[2] - Vario_Bogen_auf_3_Delta_SP_0[2])
|
||
|
||
# einfügen des ab blockes und erstellung des start_VP für die VARIO lineie
|
||
block.add_blockref(block_Vario_Bogen_ab_3 ,(start[0]-x,start[1] - Vario_Bogen_ab_3_Delta_SP_1[0] -y ,start[2] - hoehe_vario - Vario_Bogen_ab_3_Delta_SP_1[2]),dxfattribs={"rotation": 90})
|
||
start_VP = start[0] +Vario_Bogen_ab_3_Delta_VP_0[1],start[1]-Vario_Bogen_ab_3_Delta_VP_0[0] - Vario_Bogen_ab_3_Delta_SP_1[0] ,start[2]+Vario_Bogen_ab_3_Delta_VP_0[2] - Vario_Bogen_ab_3_Delta_SP_1[2]
|
||
start = start[0] ,start[1] - Vario_Bogen_ab_3_Delta_SP_0[0] - Vario_Bogen_ab_3_Delta_SP_1[0],start[2] +Vario_Bogen_ab_3_Delta_SP_0[2] - Vario_Bogen_ab_3_Delta_SP_1[2]
|
||
|
||
# Erstellung der VARIO Line
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
|
||
# Erstellung der zwischen Line
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_Bogen_ab_3,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_3_attrib)
|
||
|
||
|
||
elif voerder_richtung == "Ab":
|
||
# if gefaelle > 0:
|
||
# halbesgefaelle = gefaelle/2
|
||
# gefaelle_ende = ende[0], ende[1] +halbesgefaelle, ende[2] +math.sin(math.radians(gefahellewinkel))* halbesgefaelle
|
||
# line_ende_gefaelle = Line.new(dxfattribs={"start": ende,"end": gefaelle_ende})
|
||
# line_ende_gefaelle.dxf.layer = "6-SP"
|
||
# copy_ende = line_ende_gefaelle.copy()
|
||
# copy_ende.translate(-x,-y,-hoehe_vario)
|
||
# block.add_entity(copy_ende)
|
||
# ende = gefaelle_ende
|
||
|
||
# gefaelle_start = start[0], start[1] -halbesgefaelle, start[2] -math.sin(math.radians(gefahellewinkel)) * halbesgefaelle
|
||
# line_start_gefaelle = Line.new(dxfattribs={"start": start,"end": gefaelle_start})
|
||
# line_start_gefaelle.dxf.layer = "6-SP"
|
||
# copy_start = line_start_gefaelle.copy()
|
||
# copy_start.translate(-x,-y,-hoehe_vario)
|
||
# block.add_entity(copy_start)
|
||
# start = gefaelle_start
|
||
block_Vario_Umlenkstation_500mm ="Vario_Umlenkstation_500mm"
|
||
block_Vario_Motorstation_500mm = "Vario_Motorstation_500mm"
|
||
import_block( block_Vario_Motorstation_500mm, lib_doc, doc)
|
||
import_block( block_Vario_Umlenkstation_500mm , lib_doc, doc)
|
||
block_Vario_Motorstation_500mm = dreh_block( block_Vario_Motorstation_500mm, doc,math.radians(3))
|
||
block_Vario_Umlenkstation_500mm = dreh_block( block_Vario_Umlenkstation_500mm , doc,math.radians(3))
|
||
if umlenk_vorhanden == "True":
|
||
block.add_blockref(block_Vario_Umlenkstation_500mm,(start[0] -x,start[1] -y - umlenk_motor_offset[0]/2, start[2] - hoehe_vario -umlenk_motor_offset[2]/2 ),dxfattribs={"rotation": 270})
|
||
start_Umlenkstation_VP = start[0] - 66.5, start[1] -500 *math.cos(math.radians(-3))+ math.sin(math.radians(-3))* -45,start[2] + math.sin(math.radians(-3))*500+ math.cos(math.radians(-3))*-45
|
||
start = (start[0] ,start[1] - umlenk_motor_offset[0],start[2] -umlenk_motor_offset[2])
|
||
elif winkel == 3:
|
||
start_Umlenkstation_VP = start[0] - 66.5, start[1]+ winkel_VP_offset_vorne[0],start[2] -winkel_VP_offset_hinten[2]
|
||
if motor_vorhanden == "True":
|
||
block.add_blockref(block_Vario_Motorstation_500mm, (ende[0]-x , ende[1] + umlenk_motor_offset[0]/2 -y ,ende[2] - hoehe_vario +umlenk_motor_offset[2]/2),dxfattribs={"rotation": 270})
|
||
ende_Motor_VP = ende[0] - 66.5, ende[1] +500 *math.cos(math.radians(-3))+ math.sin(math.radians(-3))* -45,ende[2] - math.sin(math.radians(-3))*500+ math.cos(math.radians(-3))*-45
|
||
|
||
ende = ende[0] , ende[1] + umlenk_motor_offset[0],ende[2] +umlenk_motor_offset[2]
|
||
elif winkel == 3:
|
||
ende_Motor_VP = ende[0] - 66.5, ende[1]+ winkel_VP_offset_hinten[0] ,ende[2] - winkel_VP_offset_vorne[2]
|
||
|
||
if winkel == 48:
|
||
block_Vario_ab_45 = "Vario_Bogen_ab_45°"
|
||
block_Vario_auf_45 = "Vario_Bogen_auf_45°"
|
||
ab_45_attrib =import_block( block_Vario_ab_45 , lib_doc, doc)
|
||
auf_45_attrib =import_block( block_Vario_auf_45 , lib_doc, doc)
|
||
block_Vario_ab_45 = dreh_block( block_Vario_ab_45 , doc, math.radians(3))
|
||
block_Vario_auf_45 = dreh_block( block_Vario_auf_45 , doc, math.radians(48))
|
||
Vario_Bogen_auf_45_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_45_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_45_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_45_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_45_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_45_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_45_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_45_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_45_Delta_VP_0 = list(float(att) for att in re.split(r"[;,]", auf_45_attrib["DELTA_VP_0"]))
|
||
Vario_Bogen_ab_45_Delta_VP_1= list(float(att) for att in re.split(r"[;,]", ab_45_attrib["DELTA_VP_1"]))
|
||
|
||
Vario_Bogen_auf_45_Delta_SP_0 = [Vario_Bogen_auf_45_Delta_SP_0 [0] * math.cos(math.radians(48))+ Vario_Bogen_auf_45_Delta_SP_0[2]* math.sin(math.radians(48)) ,Vario_Bogen_auf_45_Delta_SP_0[1],-Vario_Bogen_auf_45_Delta_SP_0[0] * math.sin(math.radians(48))+ Vario_Bogen_auf_45_Delta_SP_0[2] * math.cos(math.radians(48)) ]
|
||
Vario_Bogen_auf_45_Delta_SP_1 = [Vario_Bogen_auf_45_Delta_SP_1 [0] * math.cos(math.radians(48))+ Vario_Bogen_auf_45_Delta_SP_1[2]* math.sin(math.radians(48)) ,Vario_Bogen_auf_45_Delta_SP_1[1],-Vario_Bogen_auf_45_Delta_SP_1[0] * math.sin(math.radians(48))+ Vario_Bogen_auf_45_Delta_SP_1[2] * math.cos(math.radians(48)) ]
|
||
Vario_Bogen_ab_45_Delta_SP_0 = [Vario_Bogen_ab_45_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_45_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_45_Delta_SP_0[1],-Vario_Bogen_ab_45_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_45_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_45_Delta_SP_1 =[ Vario_Bogen_ab_45_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_45_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_45_Delta_SP_1[1],-Vario_Bogen_ab_45_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_45_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_45_Delta_VP_0 = [Vario_Bogen_auf_45_Delta_VP_0 [0] * math.cos(math.radians(48))+ Vario_Bogen_auf_45_Delta_VP_0[2]* math.sin(math.radians(48)) ,Vario_Bogen_auf_45_Delta_VP_0[1],-Vario_Bogen_auf_45_Delta_VP_0[0] * math.sin(math.radians(48))+ Vario_Bogen_auf_45_Delta_VP_0[2] * math.cos(math.radians(48)) ]
|
||
Vario_Bogen_ab_45_Delta_VP_1 = [Vario_Bogen_ab_45_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_45_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_45_Delta_VP_1[1],-Vario_Bogen_ab_45_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_45_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_45_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_45_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_45_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_45_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_45_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_45_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_45_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_45_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_45_Delta_VP_0:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_45_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_45_Delta_VP_1:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_45_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
|
||
block.add_blockref(block_Vario_ab_45, (start[0]-x,start[1]-y- Vario_Bogen_ab_45_Delta_SP_0[0], start[2]- hoehe_vario- Vario_Bogen_ab_45_Delta_SP_0[2]),dxfattribs={"rotation": 270})
|
||
start_VP = start[0] -Vario_Bogen_ab_45_Delta_VP_1[1],start[1]- Vario_Bogen_ab_45_Delta_VP_1[0]- Vario_Bogen_ab_45_Delta_SP_0[0] ,start[2]+Vario_Bogen_ab_45_Delta_VP_1[2]-Vario_Bogen_ab_45_Delta_SP_0[2]
|
||
|
||
start =(start[0], start[1]- Vario_Bogen_ab_45_Delta_SP_0[0]- Vario_Bogen_ab_45_Delta_SP_1[0],start[2]-Vario_Bogen_ab_45_Delta_SP_0[2]+Vario_Bogen_ab_45_Delta_SP_1[2])
|
||
|
||
|
||
block.add_blockref(block_Vario_auf_45, (ende[0]-x,ende[1]-y+ Vario_Bogen_auf_45_Delta_SP_1[0],ende[2]-hoehe_vario -Vario_Bogen_auf_45_Delta_SP_1[2]),dxfattribs={"rotation": 270})
|
||
ende_VP = (ende[0] -Vario_Bogen_auf_45_Delta_VP_0[1], ende[1] + Vario_Bogen_auf_45_Delta_VP_0[0]+ Vario_Bogen_auf_45_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_45_Delta_VP_0[2]- Vario_Bogen_auf_45_Delta_SP_1[2])
|
||
ende = (ende[0],ende[1]+ Vario_Bogen_auf_45_Delta_SP_1[0]+ Vario_Bogen_auf_45_Delta_SP_0[0],ende[2]- Vario_Bogen_auf_45_Delta_SP_1[2]+ Vario_Bogen_auf_45_Delta_SP_0[2])
|
||
|
||
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
|
||
line = Line.new(dxfattribs={"start":start,"end":ende })
|
||
line.dxf.layer = "6-SP"
|
||
copy = line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
|
||
# a = msp.add_blockref(block_Vario_ab_45,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_45_attrib)
|
||
|
||
elif winkel == 36:
|
||
block_Vario_ab_33 = "Vario_Bogen_ab_33°"
|
||
block_Vario_auf_33 = "Vario_Bogen_auf_33°"
|
||
ab_33_attrib =import_block( block_Vario_ab_33 , lib_doc, doc)
|
||
auf_33_attrib =import_block( block_Vario_auf_33 , lib_doc, doc)
|
||
block_Vario_ab_33 = dreh_block( block_Vario_ab_33 , doc, math.radians(3))
|
||
block_Vario_auf_33 = dreh_block( block_Vario_auf_33 , doc, math.radians(36))
|
||
Vario_Bogen_auf_33_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_33_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_33_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_33_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_33_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_33_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_33_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_33_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_33_Delta_VP_0 = list(float(att) for att in re.split(r"[;,]", auf_33_attrib["DELTA_VP_0"]))
|
||
Vario_Bogen_ab_33_Delta_VP_1= list(float(att) for att in re.split(r"[;,]", ab_33_attrib["DELTA_VP_1"]))
|
||
|
||
Vario_Bogen_auf_33_Delta_SP_0 = [Vario_Bogen_auf_33_Delta_SP_0 [0] * math.cos(math.radians(36))+ Vario_Bogen_auf_33_Delta_SP_0[2]* math.sin(math.radians(36)) ,Vario_Bogen_auf_33_Delta_SP_0[1],-Vario_Bogen_auf_33_Delta_SP_0[0] * math.sin(math.radians(36))+ Vario_Bogen_auf_33_Delta_SP_0[2] * math.cos(math.radians(36)) ]
|
||
Vario_Bogen_auf_33_Delta_SP_1 = [Vario_Bogen_auf_33_Delta_SP_1 [0] * math.cos(math.radians(36))+ Vario_Bogen_auf_33_Delta_SP_1[2]* math.sin(math.radians(36)) ,Vario_Bogen_auf_33_Delta_SP_1[1],-Vario_Bogen_auf_33_Delta_SP_1[0] * math.sin(math.radians(36))+ Vario_Bogen_auf_33_Delta_SP_1[2] * math.cos(math.radians(36)) ]
|
||
Vario_Bogen_ab_33_Delta_SP_0 = [Vario_Bogen_ab_33_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_33_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_33_Delta_SP_0[1],-Vario_Bogen_ab_33_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_33_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_33_Delta_SP_1 =[ Vario_Bogen_ab_33_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_33_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_33_Delta_SP_1[1],-Vario_Bogen_ab_33_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_33_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_33_Delta_VP_0 = [Vario_Bogen_auf_33_Delta_VP_0 [0] * math.cos(math.radians(36))+ Vario_Bogen_auf_33_Delta_VP_0[2]* math.sin(math.radians(36)) ,Vario_Bogen_auf_33_Delta_VP_0[1],-Vario_Bogen_auf_33_Delta_VP_0[0] * math.sin(math.radians(36))+ Vario_Bogen_auf_33_Delta_VP_0[2] * math.cos(math.radians(36)) ]
|
||
Vario_Bogen_ab_33_Delta_VP_1 = [Vario_Bogen_ab_33_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_33_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_33_Delta_VP_1[1],-Vario_Bogen_ab_33_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_33_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_33_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_33_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_33_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_33_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_33_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_33_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_33_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_33_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_33_Delta_VP_0:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_33_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_33_Delta_VP_1:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_33_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
block.add_blockref(block_Vario_ab_33, (start[0]-x,start[1]-y- Vario_Bogen_ab_33_Delta_SP_0[0],start[2]-hoehe_vario-Vario_Bogen_ab_33_Delta_SP_0[2]),dxfattribs={"rotation": 270})
|
||
start_VP = start[0] -Vario_Bogen_ab_33_Delta_VP_1[1],start[1]- Vario_Bogen_ab_33_Delta_VP_1[0]- Vario_Bogen_ab_33_Delta_SP_0[0] ,start[2]+Vario_Bogen_ab_33_Delta_VP_1[2]-Vario_Bogen_ab_33_Delta_SP_0[2]
|
||
start =(start[0], start[1]- Vario_Bogen_ab_33_Delta_SP_0[0]- Vario_Bogen_ab_33_Delta_SP_1[0],start[2]-Vario_Bogen_ab_33_Delta_SP_0[2]+Vario_Bogen_ab_33_Delta_SP_1[2])
|
||
|
||
block.add_blockref(block_Vario_auf_33, (ende[0]-x,ende[1]-y+ Vario_Bogen_auf_33_Delta_SP_1[0],ende[2]-hoehe_vario -Vario_Bogen_auf_33_Delta_SP_1[2]),dxfattribs={"rotation": 270})
|
||
ende_VP = (ende[0] -Vario_Bogen_auf_33_Delta_VP_0[1], ende[1] + Vario_Bogen_auf_33_Delta_VP_0[0]+ Vario_Bogen_auf_33_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_33_Delta_VP_0[2]- Vario_Bogen_auf_33_Delta_SP_1[2])
|
||
ende = (ende[0],ende[1]+ Vario_Bogen_auf_33_Delta_SP_0[0]+ Vario_Bogen_auf_33_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_33_Delta_SP_0[2]- Vario_Bogen_auf_33_Delta_SP_1[2])
|
||
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
|
||
|
||
line = Line.new(dxfattribs={"start":start,"end":ende })
|
||
line.dxf.layer = "6-SP"
|
||
copy = line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_ab_33,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_33_attrib)
|
||
elif winkel == 24:
|
||
block_Vario_ab_21 = "Vario_Bogen_ab_21°"
|
||
block_Vario_auf_21 = "Vario_Bogen_auf_21°"
|
||
ab_21_attrib =import_block( block_Vario_ab_21 , lib_doc, doc)
|
||
auf_21_attrib =import_block( block_Vario_auf_21 , lib_doc, doc)
|
||
block_Vario_ab_21 = dreh_block( block_Vario_ab_21 , doc, math.radians(3))
|
||
block_Vario_auf_21 = dreh_block( block_Vario_auf_21 , doc, math.radians(24))
|
||
Vario_Bogen_auf_21_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_21_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_21_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_21_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_21_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_21_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_21_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_21_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_21_Delta_VP_0 = list(float(att) for att in re.split(r"[;,]", auf_21_attrib["DELTA_VP_0"]))
|
||
Vario_Bogen_ab_21_Delta_VP_1= list(float(att) for att in re.split(r"[;,]", ab_21_attrib["DELTA_VP_1"]))
|
||
|
||
Vario_Bogen_auf_21_Delta_SP_0 = [Vario_Bogen_auf_21_Delta_SP_0 [0] * math.cos(math.radians(24))+ Vario_Bogen_auf_21_Delta_SP_0[2]* math.sin(math.radians(24)) ,Vario_Bogen_auf_21_Delta_SP_0[1],-Vario_Bogen_auf_21_Delta_SP_0[0] * math.sin(math.radians(24))+ Vario_Bogen_auf_21_Delta_SP_0[2] * math.cos(math.radians(24)) ]
|
||
Vario_Bogen_auf_21_Delta_SP_1 = [Vario_Bogen_auf_21_Delta_SP_1 [0] * math.cos(math.radians(24))+ Vario_Bogen_auf_21_Delta_SP_1[2]* math.sin(math.radians(24)) ,Vario_Bogen_auf_21_Delta_SP_1[1],-Vario_Bogen_auf_21_Delta_SP_1[0] * math.sin(math.radians(24))+ Vario_Bogen_auf_21_Delta_SP_1[2] * math.cos(math.radians(24)) ]
|
||
Vario_Bogen_ab_21_Delta_SP_0 = [Vario_Bogen_ab_21_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_21_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_21_Delta_SP_0[1],-Vario_Bogen_ab_21_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_21_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_21_Delta_SP_1 =[ Vario_Bogen_ab_21_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_21_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_21_Delta_SP_1[1],-Vario_Bogen_ab_21_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_21_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_21_Delta_VP_0 = [Vario_Bogen_auf_21_Delta_VP_0 [0] * math.cos(math.radians(24))+ Vario_Bogen_auf_21_Delta_VP_0[2]* math.sin(math.radians(24)) ,Vario_Bogen_auf_21_Delta_VP_0[1],-Vario_Bogen_auf_21_Delta_VP_0[0] * math.sin(math.radians(24))+ Vario_Bogen_auf_21_Delta_VP_0[2] * math.cos(math.radians(24)) ]
|
||
Vario_Bogen_ab_21_Delta_VP_1 = [Vario_Bogen_ab_21_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_21_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_21_Delta_VP_1[1],-Vario_Bogen_ab_21_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_21_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_21_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_21_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_21_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_21_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_21_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_21_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_21_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_21_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_21_Delta_VP_0:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_21_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_21_Delta_VP_1:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_21_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
block.add_blockref(block_Vario_ab_21, (start[0]-x,start[1]-y- Vario_Bogen_ab_21_Delta_SP_0[0],start[2]-hoehe_vario-Vario_Bogen_ab_21_Delta_SP_0[2]),dxfattribs={"rotation": 270})
|
||
|
||
start_VP = start[0] -Vario_Bogen_ab_21_Delta_VP_1[1],start[1]- Vario_Bogen_ab_21_Delta_VP_1[0]- Vario_Bogen_ab_21_Delta_SP_0[0] ,start[2]+Vario_Bogen_ab_21_Delta_VP_1[2]-Vario_Bogen_ab_21_Delta_SP_0[2]
|
||
|
||
start =(start[0], start[1]- Vario_Bogen_ab_21_Delta_SP_0[0]- Vario_Bogen_ab_21_Delta_SP_1[0],start[2]-Vario_Bogen_ab_21_Delta_SP_0[2]+Vario_Bogen_ab_21_Delta_SP_1[2])
|
||
|
||
block.add_blockref(block_Vario_auf_21, (ende[0]-x,ende[1]-y+ Vario_Bogen_auf_21_Delta_SP_1[0],ende[2]-hoehe_vario -Vario_Bogen_auf_21_Delta_SP_1[2]),dxfattribs={"rotation": 270})
|
||
ende_VP = (ende[0] -Vario_Bogen_auf_21_Delta_VP_0[1], ende[1] + Vario_Bogen_auf_21_Delta_VP_0[0]+ Vario_Bogen_auf_21_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_21_Delta_VP_0[2]- Vario_Bogen_auf_21_Delta_SP_1[2])
|
||
|
||
ende = (ende[0],ende[1]+ Vario_Bogen_auf_21_Delta_SP_0[0]+ Vario_Bogen_auf_21_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_21_Delta_SP_0[2]- Vario_Bogen_auf_21_Delta_SP_1[2])
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
|
||
line = Line.new(dxfattribs={"start":start,"end":ende })
|
||
line.dxf.layer = "6-SP"
|
||
copy = line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_ab_21,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_21_attrib)
|
||
elif winkel == 15:
|
||
block_Vario_ab_12 = "Vario_Bogen_ab_12°"
|
||
block_Vario_auf_12 = "Vario_Bogen_auf_12°"
|
||
ab_12_attrib =import_block( block_Vario_ab_12 , lib_doc, doc)
|
||
auf_12_attrib =import_block( block_Vario_auf_12 , lib_doc, doc)
|
||
block_Vario_ab_12 = dreh_block( block_Vario_ab_12, doc, math.radians(3))
|
||
block_Vario_auf_12 = dreh_block( block_Vario_auf_12 , doc, math.radians(15))
|
||
Vario_Bogen_auf_12_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_12_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_12_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_12_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_12_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_12_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_12_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_12_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_12_Delta_VP_0 = list(float(att) for att in re.split(r"[;,]", auf_12_attrib["DELTA_VP_0"]))
|
||
Vario_Bogen_ab_12_Delta_VP_1= list(float(att) for att in re.split(r"[;,]", ab_12_attrib["DELTA_VP_1"]))
|
||
|
||
Vario_Bogen_auf_12_Delta_SP_0 = [Vario_Bogen_auf_12_Delta_SP_0 [0] * math.cos(math.radians(15))+ Vario_Bogen_auf_12_Delta_SP_0[2]* math.sin(math.radians(15)) ,Vario_Bogen_auf_12_Delta_SP_0[1],-Vario_Bogen_auf_12_Delta_SP_0[0] * math.sin(math.radians(15))+ Vario_Bogen_auf_12_Delta_SP_0[2] * math.cos(math.radians(15)) ]
|
||
Vario_Bogen_auf_12_Delta_SP_1 = [Vario_Bogen_auf_12_Delta_SP_1 [0] * math.cos(math.radians(15))+ Vario_Bogen_auf_12_Delta_SP_1[2]* math.sin(math.radians(15)) ,Vario_Bogen_auf_12_Delta_SP_1[1],-Vario_Bogen_auf_12_Delta_SP_1[0] * math.sin(math.radians(15))+ Vario_Bogen_auf_12_Delta_SP_1[2] * math.cos(math.radians(15)) ]
|
||
Vario_Bogen_ab_12_Delta_SP_0 = [Vario_Bogen_ab_12_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_12_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_12_Delta_SP_0[1],-Vario_Bogen_ab_12_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_12_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_12_Delta_SP_1 =[ Vario_Bogen_ab_12_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_12_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_12_Delta_SP_1[1],-Vario_Bogen_ab_12_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_12_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_12_Delta_VP_0 = [Vario_Bogen_auf_12_Delta_VP_0 [0] * math.cos(math.radians(15))+ Vario_Bogen_auf_12_Delta_VP_0[2]* math.sin(math.radians(15)) ,Vario_Bogen_auf_12_Delta_VP_0[1],-Vario_Bogen_auf_12_Delta_VP_0[0] * math.sin(math.radians(15))+ Vario_Bogen_auf_12_Delta_VP_0[2] * math.cos(math.radians(15)) ]
|
||
Vario_Bogen_ab_12_Delta_VP_1 = [Vario_Bogen_ab_12_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_12_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_12_Delta_VP_1[1],-Vario_Bogen_ab_12_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_12_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_12_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_12_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_12_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_12_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_12_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_12_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_12_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_12_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_12_Delta_VP_0:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_12_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_12_Delta_VP_1:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_12_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
block.add_blockref(block_Vario_ab_12, (start[0]-x,start[1]-y- Vario_Bogen_ab_12_Delta_SP_0[0],start[2]-hoehe_vario-Vario_Bogen_ab_12_Delta_SP_0[2]),dxfattribs={"rotation": 270})
|
||
start_VP = start[0] -Vario_Bogen_ab_12_Delta_VP_1[1],start[1]- Vario_Bogen_ab_12_Delta_VP_1[0]- Vario_Bogen_ab_12_Delta_SP_0[0] ,start[2]+Vario_Bogen_ab_12_Delta_VP_1[2]-Vario_Bogen_ab_12_Delta_SP_0[2]
|
||
|
||
start =(start[0], start[1]- Vario_Bogen_ab_12_Delta_SP_0[0]- Vario_Bogen_ab_12_Delta_SP_1[0],start[2]-Vario_Bogen_ab_12_Delta_SP_0[2]+Vario_Bogen_ab_12_Delta_SP_1[2])
|
||
|
||
block.add_blockref(block_Vario_auf_12, (ende[0]-x,ende[1]-y+ Vario_Bogen_auf_12_Delta_SP_1[0],ende[2]-hoehe_vario -Vario_Bogen_auf_12_Delta_SP_1[2]),dxfattribs={"rotation": 270})
|
||
|
||
ende_VP = (ende[0] -Vario_Bogen_auf_12_Delta_VP_0[1], ende[1] + Vario_Bogen_auf_12_Delta_VP_0[0]+ Vario_Bogen_auf_12_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_12_Delta_VP_0[2]- Vario_Bogen_auf_12_Delta_SP_1[2])
|
||
|
||
ende = (ende[0],ende[1]+ Vario_Bogen_auf_12_Delta_SP_0[0]+ Vario_Bogen_auf_12_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_12_Delta_SP_0[2]- Vario_Bogen_auf_12_Delta_SP_1[2])
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
|
||
line = Line.new(dxfattribs={"start":start,"end":ende })
|
||
line.dxf.layer = "6-SP"
|
||
copy = line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_ab_12,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_12_attrib)
|
||
|
||
elif winkel == 12:
|
||
block_Vario_ab_9 = "Vario_Bogen_ab_9°"
|
||
block_Vario_auf_9 = "Vario_Bogen_auf_9°"
|
||
ab_9_attrib =import_block( block_Vario_ab_9 , lib_doc, doc)
|
||
auf_9_attrib =import_block( block_Vario_auf_9 , lib_doc, doc)
|
||
block_Vario_ab_9 = dreh_block( block_Vario_ab_9, doc, math.radians(3))
|
||
block_Vario_auf_9 = dreh_block( block_Vario_auf_9 , doc, math.radians(12))
|
||
Vario_Bogen_auf_9_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_9_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_9_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_9_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_9_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_9_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_9_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_9_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_9_Delta_VP_0 = list(float(att) for att in re.split(r"[;,]", auf_9_attrib["DELTA_VP_0"]))
|
||
Vario_Bogen_ab_9_Delta_VP_1= list(float(att) for att in re.split(r"[;,]", ab_9_attrib["DELTA_VP_1"]))
|
||
|
||
Vario_Bogen_auf_9_Delta_SP_0 = [Vario_Bogen_auf_9_Delta_SP_0 [0] * math.cos(math.radians(12))+ Vario_Bogen_auf_9_Delta_SP_0[2]* math.sin(math.radians(12)) ,Vario_Bogen_auf_9_Delta_SP_0[1],-Vario_Bogen_auf_9_Delta_SP_0[0] * math.sin(math.radians(12))+ Vario_Bogen_auf_9_Delta_SP_0[2] * math.cos(math.radians(12)) ]
|
||
Vario_Bogen_auf_9_Delta_SP_1 = [Vario_Bogen_auf_9_Delta_SP_1 [0] * math.cos(math.radians(12))+ Vario_Bogen_auf_9_Delta_SP_1[2]* math.sin(math.radians(12)) ,Vario_Bogen_auf_9_Delta_SP_1[1],-Vario_Bogen_auf_9_Delta_SP_1[0] * math.sin(math.radians(12))+ Vario_Bogen_auf_9_Delta_SP_1[2] * math.cos(math.radians(12)) ]
|
||
Vario_Bogen_ab_9_Delta_SP_0 = [Vario_Bogen_ab_9_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_9_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_9_Delta_SP_0[1],-Vario_Bogen_ab_9_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_9_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_9_Delta_SP_1 =[ Vario_Bogen_ab_9_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_9_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_9_Delta_SP_1[1],-Vario_Bogen_ab_9_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_9_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_9_Delta_VP_0 = [Vario_Bogen_auf_9_Delta_VP_0 [0] * math.cos(math.radians(12))+ Vario_Bogen_auf_9_Delta_VP_0[2]* math.sin(math.radians(12)) ,Vario_Bogen_auf_9_Delta_VP_0[1],-Vario_Bogen_auf_9_Delta_VP_0[0] * math.sin(math.radians(12))+ Vario_Bogen_auf_9_Delta_VP_0[2] * math.cos(math.radians(12)) ]
|
||
Vario_Bogen_ab_9_Delta_VP_1 = [Vario_Bogen_ab_9_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_9_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_9_Delta_VP_1[1],-Vario_Bogen_ab_9_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_9_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_9_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_9_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_9_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_9_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_9_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_9_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_9_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_9_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_9_Delta_VP_0:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_9_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_9_Delta_VP_1:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_9_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
block.add_blockref(block_Vario_ab_9, (start[0]-x,start[1]-y- Vario_Bogen_ab_9_Delta_SP_0[0],start[2]-hoehe_vario-Vario_Bogen_ab_9_Delta_SP_0[2]),dxfattribs={"rotation": 270})
|
||
|
||
start_VP = start[0] -Vario_Bogen_ab_9_Delta_VP_1[1],start[1]- Vario_Bogen_ab_9_Delta_VP_1[0]- Vario_Bogen_ab_9_Delta_SP_0[0] ,start[2]+Vario_Bogen_ab_9_Delta_VP_1[2]-Vario_Bogen_ab_9_Delta_SP_0[2]
|
||
start =(start[0], start[1]- Vario_Bogen_ab_9_Delta_SP_0[0]- Vario_Bogen_ab_9_Delta_SP_1[0],start[2]-Vario_Bogen_ab_9_Delta_SP_0[2]+Vario_Bogen_ab_9_Delta_SP_1[2])
|
||
|
||
block.add_blockref(block_Vario_auf_9, (ende[0]-x,ende[1]-y+ Vario_Bogen_auf_9_Delta_SP_1[0],ende[2]-hoehe_vario -Vario_Bogen_auf_9_Delta_SP_1[2]),dxfattribs={"rotation": 270})
|
||
ende_VP = (ende[0] -Vario_Bogen_auf_9_Delta_VP_0[1], ende[1] + Vario_Bogen_auf_9_Delta_VP_0[0]+ Vario_Bogen_auf_9_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_9_Delta_VP_0[2]-Vario_Bogen_auf_9_Delta_SP_1[2])
|
||
|
||
ende = (ende[0],ende[1]+ Vario_Bogen_auf_9_Delta_SP_0[0]+ Vario_Bogen_auf_9_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_9_Delta_SP_0[2]- Vario_Bogen_auf_9_Delta_SP_1[2])
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
line = Line.new(dxfattribs={"start":start,"end":ende })
|
||
line.dxf.layer = "6-SP"
|
||
copy = line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_ab_9,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, ab_9_attrib)
|
||
|
||
|
||
|
||
elif winkel == 9:
|
||
block_Vario_ab_6 = "Vario_Bogen_ab_6°"
|
||
block_Vario_auf_6 = "Vario_Bogen_auf_6°"
|
||
ab_6_attrib =import_block( block_Vario_ab_6 , lib_doc, doc)
|
||
auf_6_attrib =import_block( block_Vario_auf_6 , lib_doc, doc)
|
||
block_Vario_ab_6 = dreh_block( block_Vario_ab_6, doc, math.radians(3))
|
||
block_Vario_auf_6 = dreh_block( block_Vario_auf_6 , doc, math.radians(9))
|
||
Vario_Bogen_auf_6_Delta_SP_0 = list(float(att)for att in re.split(r"[;,]", auf_6_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_auf_6_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", auf_6_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_ab_6_Delta_SP_0 = list(float(att) for att in re.split(r"[;,]", ab_6_attrib["DELTA_SP_0"]))
|
||
Vario_Bogen_ab_6_Delta_SP_1 = list(float(att) for att in re.split(r"[;,]", ab_6_attrib["DELTA_SP_1"]))
|
||
Vario_Bogen_auf_6_Delta_VP_0 = list(float(att) for att in re.split(r"[;,]", auf_6_attrib["DELTA_VP_0"]))
|
||
Vario_Bogen_ab_6_Delta_VP_1= list(float(att) for att in re.split(r"[;,]", ab_6_attrib["DELTA_VP_1"]))
|
||
|
||
|
||
Vario_Bogen_auf_6_Delta_SP_0 = [Vario_Bogen_auf_6_Delta_SP_0 [0] * math.cos(math.radians(9))+ Vario_Bogen_auf_6_Delta_SP_0[2]* math.sin(math.radians(9)) ,Vario_Bogen_auf_6_Delta_SP_0[1],-Vario_Bogen_auf_6_Delta_SP_0[0] * math.sin(math.radians(9))+ Vario_Bogen_auf_6_Delta_SP_0[2] * math.cos(math.radians(9)) ]
|
||
Vario_Bogen_auf_6_Delta_SP_1 = [Vario_Bogen_auf_6_Delta_SP_1 [0] * math.cos(math.radians(9))+ Vario_Bogen_auf_6_Delta_SP_1[2]* math.sin(math.radians(9)) ,Vario_Bogen_auf_6_Delta_SP_1[1],-Vario_Bogen_auf_6_Delta_SP_1[0] * math.sin(math.radians(9))+ Vario_Bogen_auf_6_Delta_SP_1[2] * math.cos(math.radians(9)) ]
|
||
Vario_Bogen_ab_6_Delta_SP_0 = [Vario_Bogen_ab_6_Delta_SP_0 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_0[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_6_Delta_SP_0[1],-Vario_Bogen_ab_6_Delta_SP_0[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_0[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_ab_6_Delta_SP_1 =[ Vario_Bogen_ab_6_Delta_SP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_6_Delta_SP_1[1],-Vario_Bogen_ab_6_Delta_SP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_6_Delta_SP_1[2] * math.cos(math.radians(3)) ]
|
||
Vario_Bogen_auf_6_Delta_VP_0 = [Vario_Bogen_auf_6_Delta_VP_0 [0] * math.cos(math.radians(9))+ Vario_Bogen_auf_6_Delta_VP_0[2]* math.sin(math.radians(9)) ,Vario_Bogen_auf_6_Delta_VP_0[1],-Vario_Bogen_auf_6_Delta_VP_0[0] * math.sin(math.radians(9))+ Vario_Bogen_auf_6_Delta_VP_0[2] * math.cos(math.radians(9)) ]
|
||
Vario_Bogen_ab_6_Delta_VP_1 = [Vario_Bogen_ab_6_Delta_VP_1 [0] * math.cos(math.radians(3))+ Vario_Bogen_ab_6_Delta_VP_1[2]* math.sin(math.radians(3)) ,Vario_Bogen_ab_6_Delta_VP_1[1],-Vario_Bogen_ab_6_Delta_VP_1[0] * math.sin(math.radians(3))+ Vario_Bogen_ab_6_Delta_VP_1[2] * math.cos(math.radians(3)) ]
|
||
|
||
i = 0
|
||
|
||
for negativ in Vario_Bogen_auf_6_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_6_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_6_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ= negativ*-1
|
||
Vario_Bogen_auf_6_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_6_Delta_SP_0:
|
||
if i< 2:
|
||
if negativ< 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_6_Delta_SP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_6_Delta_SP_1:
|
||
if i< 2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_ab_6_Delta_SP_1[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_auf_6_Delta_VP_0:
|
||
if i<2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
Vario_Bogen_auf_6_Delta_VP_0[i] = negativ
|
||
i = i + 1
|
||
i = 0
|
||
for negativ in Vario_Bogen_ab_6_Delta_VP_1:
|
||
if i <2:
|
||
if negativ < 0:
|
||
negativ = negativ*-1
|
||
|
||
Vario_Bogen_ab_6_Delta_VP_1[i] = negativ
|
||
i = i + 1
|
||
block.add_blockref(block_Vario_ab_6, (start[0]-x,start[1]-y- Vario_Bogen_ab_6_Delta_SP_0[0],start[2]-hoehe_vario-Vario_Bogen_ab_6_Delta_SP_0[2]),dxfattribs={"rotation": 270})
|
||
start_VP = start[0] -Vario_Bogen_ab_6_Delta_VP_1[1],start[1]- Vario_Bogen_ab_6_Delta_VP_1[0]- Vario_Bogen_ab_6_Delta_SP_0[0] ,start[2]+Vario_Bogen_ab_6_Delta_VP_1[2]-Vario_Bogen_ab_6_Delta_SP_0[2]
|
||
|
||
start =(start[0], start[1]- Vario_Bogen_ab_6_Delta_SP_0[0]- Vario_Bogen_ab_6_Delta_SP_1[0],start[2]-Vario_Bogen_ab_6_Delta_SP_0[2]+Vario_Bogen_ab_6_Delta_SP_1[2])
|
||
block.add_blockref(block_Vario_auf_6, (ende[0]-x,ende[1]-y+ Vario_Bogen_auf_6_Delta_SP_1[0],ende[2]-hoehe_vario -Vario_Bogen_auf_6_Delta_SP_1[2]),dxfattribs={"rotation": 270})
|
||
ende_VP = (ende[0] -Vario_Bogen_auf_6_Delta_VP_0[1], ende[1] + Vario_Bogen_auf_6_Delta_VP_0[0]+ Vario_Bogen_auf_6_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_6_Delta_VP_0[2]- Vario_Bogen_auf_6_Delta_SP_1[2])
|
||
|
||
ende = (ende[0],ende[1]+ Vario_Bogen_auf_6_Delta_SP_0[0]+ Vario_Bogen_auf_6_Delta_SP_1[0],ende[2]+ Vario_Bogen_auf_6_Delta_SP_0[2]- Vario_Bogen_auf_6_Delta_SP_1[2])
|
||
line_VP = Line.new(dxfattribs={"start":start_VP,"end": ende_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
|
||
line = Line.new(dxfattribs={"start":start,"end":ende })
|
||
line.dxf.layer = "6-SP"
|
||
copy = line.copy()
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
# a = msp.add_blockref(block_Vario_auf_6,(x,y,0))
|
||
# msp.add_line((x+1000,y +50,0),(x-1000,y+50,0))
|
||
# msp.add_line((x,y+1000,0),(x,y-1000,0))
|
||
# add_attributes_to_block(a, auf_6_attrib)
|
||
elif winkel == 3:
|
||
line_VP = Line.new(dxfattribs={"start": start_Umlenkstation_VP,"end": ende_Motor_VP})
|
||
line_VP.dxf.layer = "VARIO"
|
||
copy_VP = line_VP.copy()
|
||
copy_VP.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy_VP)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_vario)
|
||
block.add_entity(copy)
|
||
|
||
matrix = Matrix44.scale(-1,1,1)
|
||
block_links = doc.blocks.new(block_name_links, base_point=(0,0,0))
|
||
for entity in block:
|
||
clone= entity.copy()
|
||
if entity.dxftype() == "INSERT":
|
||
if (entity.dxf.name == "400102632_ES-Element_90_links" or entity.dxf.name == "200000146_ES-Element_90_rechts" or
|
||
entity.dxf.name == "200000241_AS-Element_90_rechts" or entity.dxf.name == "200000217_AS-Element_90_links"
|
||
):
|
||
block_links.add_entity(clone)
|
||
else:
|
||
clone.transform(matrix)
|
||
block_links.add_entity(clone)
|
||
else:
|
||
clone.transform(matrix)
|
||
block_links.add_entity(clone)
|
||
|
||
|
||
def handle_omniflo(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config):
|
||
"""
|
||
Für Omniflo Gerade: zeichnet eine Linie (Mitte = Koordinate, Länge und Winkel aus Merkmale).
|
||
Für alle anderen Omniflo-Typen: Block mit SivasNummer an den Koordinaten.
|
||
"""
|
||
# Prüfen, ob es sich um eine Gerade handelt
|
||
if merkmale.get("Länge in Meter") is not None and merkmale.get("Winkel") is not None:
|
||
try:
|
||
laenge = float(merkmale.get("Länge in Meter", "0").replace(",", ".")) * 1000 # Meter → mm
|
||
except Exception:
|
||
laenge = 0
|
||
try:
|
||
winkel = float(merkmale.get("Drehung"))
|
||
except Exception:
|
||
winkel = 0.0
|
||
|
||
winkel_rad = math.radians(winkel)
|
||
halbe_laenge = laenge / 2
|
||
# Man muss bei sin -1 machen wegen des links koordinaten system
|
||
dx = halbe_laenge * math.sin(winkel_rad * -1)
|
||
dy = halbe_laenge * math.cos(winkel_rad)
|
||
start = (x + dx, y + dy, float(merkmale.get("Höhe oben")) )
|
||
ende = (x - dx, y - dy, float(merkmale.get("Höhe unten")))
|
||
if "A-2" not in doc.layers:
|
||
doc.layers.add(name="A-2", color=2)
|
||
linie=msp.add_line(start, ende)
|
||
linie.dxf.layer = "A-2"
|
||
|
||
|
||
if verbose:
|
||
print(f"[INFO] Omniflo Gerade → {teileid} Linie von ({start[0]:.1f}, {start[1]:.1f}) nach ({ende[0]:.1f}, {ende[1]:.1f})")
|
||
return
|
||
# Sonst wie gehabt: Block mit SivasNummer
|
||
if not lib_doc:
|
||
print("[WARN] lib_doc nicht verfügbar, Block wird nicht eingefügt.")
|
||
return
|
||
blockname = merkmale.get("SivasNummer")
|
||
if not blockname:
|
||
print(f"[WARN] Keine SivasNummer für {teileid}, überspringe.")
|
||
return
|
||
if blockname not in lib_doc.blocks:
|
||
print(f"[WARN] Omniflo-Block '{blockname}' nicht in Bibliothek {lib_doc.filename}. Überspringe {teileid}.")
|
||
return
|
||
import_block(blockname, lib_doc, doc)
|
||
blockref_layer = get_layer(doc, lib_doc, blockname)
|
||
drehung = merkmale.get("Drehung")
|
||
|
||
bref = msp.add_blockref(blockname, (x, y,float(merkmale.get("Höhe"))), dxfattribs={"xscale": 1.0, "yscale":1.0,"rotation": drehung, "layer": blockref_layer})
|
||
|
||
a =bref.add_attrib(
|
||
tag= "NAME",
|
||
text= merkmale.get("bezeichner"),
|
||
insert = (x,y)
|
||
|
||
|
||
)
|
||
a.is_invisible = True
|
||
bref.add_auto_attribs({ATTR_TAG: teileid})
|
||
if verbose:
|
||
print(f"[INFO] Block '{blockname}' (Omniflo) → {teileid} ({x:.1f}, {y:.1f})")
|
||
|
||
|
||
|
||
def erstellung_gefaelle_block_verbunenden_am_einen(msp,x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle, drehung0, laenge,blockname, hight = None, block_vario = None, vario_richtung = None, verbungden_höher = None):
|
||
|
||
halbe_laenge = laenge / 2
|
||
dy = halbe_laenge * math.cos(0)
|
||
|
||
if ((blockname not in doc.blocks and 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") ):
|
||
if hight != None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
block_as = "200000241_AS-Element_90_rechts"
|
||
import_block(block_as,lib_doc,doc)
|
||
|
||
if vario_richtung == "Auf":
|
||
start = (x , y + dy ,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + asoffset ,lower_hoehe_gefaehlle)
|
||
|
||
block_vario.add_blockref(block_as,(ende[0]-x ,ende[1]-asoffset -y,ende[2] -hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start, ende
|
||
elif vario_richtung == "Ab":
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy ,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] -hoehe_gefaehlle))
|
||
return start,ende
|
||
elif vario_richtung =="Horizontal":
|
||
# TODO
|
||
return start, ende
|
||
if laenge > asoffset:
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy ,lower_hoehe_gefaehlle)
|
||
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
|
||
block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] -hoehe_gefaehlle))
|
||
return False
|
||
else:
|
||
msp.add_blockref(block_as,(x,y,upper_hoehe_gefaehlle))
|
||
return True
|
||
|
||
elif ((blockname not in doc.blocks and 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")):
|
||
block_es = "200000146_ES-Element_90_rechts"
|
||
import_block(block_es,lib_doc,doc)
|
||
if hight != None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
|
||
if vario_richtung == "Auf":
|
||
start = (x , y + dy-esoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy ,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_es, (start[0]-x ,start[1]+esoffset-y ,start[2] -hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start, ende
|
||
elif vario_richtung == "Ab":
|
||
start = (x , y + dy,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset-y ,ende[2] -hoehe_gefaehlle))
|
||
return start, ende
|
||
elif vario_richtung =="Horizontal":
|
||
# TODO
|
||
return start, ende
|
||
|
||
if laenge > esoffset:
|
||
start = (x , y + dy,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset-y ,ende[2] -hoehe_gefaehlle))
|
||
return False
|
||
else:
|
||
msp.add_blockref(block_es,(x,y,lower_hoehe_gefaehlle))
|
||
return True
|
||
|
||
elif ((blockname not in doc.blocks and 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")):
|
||
block_as = "200000217_AS-Element_90_links"
|
||
import_block(block_as,lib_doc,doc)
|
||
if hight != None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
|
||
if vario_richtung == "Auf":
|
||
start = (x , y + dy ,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + asoffset,lower_hoehe_gefaehlle)
|
||
|
||
block_vario.add_blockref(block_as,(ende[0]-x ,ende[1]-asoffset -y,ende[2] - hoehe_gefaehlle))
|
||
return start, ende
|
||
elif vario_richtung == "Ab":
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy ,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start, ende
|
||
elif vario_richtung =="Horizontal":
|
||
# TODO
|
||
return start, ende
|
||
|
||
if laenge > asoffset:
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy ,lower_hoehe_gefaehlle)
|
||
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
copy.translate(-x ,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
else:
|
||
msp.add_blockref(block_as,(x,y,upper_hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
|
||
elif (( blockname not in doc.blocks and 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")):
|
||
if hight != None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
block_es = "400102632_ES-Element_90_links"
|
||
import_block(block_es,lib_doc,doc)
|
||
|
||
if vario_richtung == "Auf":
|
||
start = (x , y + dy-esoffset ,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_es, (start[0]-x ,start[1]+esoffset -y,start[2] - hoehe_gefaehlle))
|
||
return start, ende
|
||
elif vario_richtung == "Ab":
|
||
start = (x , y + dy ,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start,ende
|
||
elif vario_richtung =="Horizontal":
|
||
# TODO
|
||
return start, ende
|
||
if laenge > esoffset:
|
||
start = (x , y + dy ,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x ,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return False
|
||
else:
|
||
msp.add_blockref(block_es,(x,y,lower_hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return True
|
||
|
||
|
||
def gefaellegerade_erstellung(x, y, doc, lib_doc, asoffset, esoffset, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, hoehe_gefaehlle,richtung2, drehung0, drehung1, laenge, hight_position, blockname, block_vario = None,voerder_richtung = None, am_kreisel = None, erster_kreisel_höher = None,y1=None,z1 =None):
|
||
#erstellung des blockes falls die gefaelle strecke mit einem kreisel verbunden ist, mehrere variation von selben weil diese nötig sind sobald man die richtigen inserts bekommen
|
||
if upper_hoehe_gefaehlle < lower_hoehe_gefaehlle:
|
||
middle_hoehe = upper_hoehe_gefaehlle
|
||
upper_hoehe_gefaehlle = lower_hoehe_gefaehlle
|
||
lower_hoehe_gefaehlle = middle_hoehe
|
||
|
||
if richtung2!= "DEFAULT" or am_kreisel != None:
|
||
if ((blockname not in doc.blocks and drehung0 == "GUZS" and drehung1 == "GUZS" 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 == "GUZS" and drehung1== "GUZS") 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 == "GUZS" and drehung1== "GUZS")):
|
||
block_es = "200000146_ES-Element_90_rechts"
|
||
import_block(block_es,lib_doc,doc)
|
||
if am_kreisel == None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
start = (x , y+ dy - esoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y1 ,z1)
|
||
block_vario.add_blockref(block_es, (start[0]-x ,start[1]+esoffset-y ,start[2] -hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start,ende
|
||
elif(voerder_richtung == "Ab"):
|
||
start = (x , y1 ,z1)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset-y ,ende[2] -hoehe_gefaehlle))
|
||
return start, ende
|
||
start = (x , y + dy,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
|
||
block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset-y ,ende[2] -hoehe_gefaehlle))
|
||
elif ((blockname not in doc.blocks and drehung0 == "GUZS" and drehung1 == "GUZS") or
|
||
(am_kreisel != None and drehung0 == "GUZS" and drehung1 == "GUZS")):
|
||
if am_kreisel == None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
block_as = "200000241_AS-Element_90_rechts"
|
||
import_block(block_as,lib_doc,doc)
|
||
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
start = (x , y1 ,z1)
|
||
ende = (x , y - dy + asoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_as,(ende[0]-x ,ende[1]-asoffset -y,ende[2] -hoehe_gefaehlle), dxfattribs={"rotation": 180})
|
||
return start,ende
|
||
elif voerder_richtung == "Ab":
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y1 ,z1)
|
||
block_vario.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] -hoehe_gefaehlle))
|
||
return start, ende
|
||
|
||
|
||
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy ,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
|
||
block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] -hoehe_gefaehlle))
|
||
elif ((blockname not in doc.blocks and (drehung0 == "GUZS" 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 == "GUZS")) 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 == "GUZS" and drehung1 == "UZS"))):
|
||
|
||
block_es = "400102632_ES-Element_90_links"
|
||
import_block(block_es,lib_doc,doc)
|
||
if am_kreisel == None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
start = (x , y + dy - esoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y1 ,z1)
|
||
block_vario.add_blockref(block_es,(start[0]-x ,start[1]+esoffset -y,start[2] - hoehe_gefaehlle))
|
||
return start,ende
|
||
elif voerder_richtung == "Ab":
|
||
start = (x , y1 ,z1)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_es,(ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle), dxfattribs={"rotation": 180})
|
||
return start,ende
|
||
|
||
start = (x , y + dy ,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
|
||
block.add_blockref(block_es,(ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle), dxfattribs={"rotation": 180})
|
||
elif (blockname not in doc.blocks and (drehung0 == "UZS" and drehung1 == "GUZS" and hight_position == "lower")or
|
||
(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"
|
||
import_block(block_as,lib_doc,doc)
|
||
if am_kreisel == None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
start = (x , y1,z1)
|
||
ende = (x , y - dy +asoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_as,(ende[0]-x ,ende[1]-asoffset -y,ende[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start,ende
|
||
elif voerder_richtung == "Ab":
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y1 ,z1)
|
||
block_vario.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle))
|
||
return start,ende
|
||
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy ,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle))
|
||
elif ((blockname not in doc.blocks and 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
|
||
(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== "UZS")):
|
||
if am_kreisel == None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
block_es = "400102632_ES-Element_90_links"
|
||
import_block(block_es,lib_doc,doc)
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
|
||
start = (x , y + dy - esoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y1,z1)
|
||
block_vario.add_blockref(block_es, (start[0]-x ,start[1]+esoffset -y,start[2] - hoehe_gefaehlle))
|
||
return start,ende
|
||
elif voerder_richtung == "Ab":
|
||
start = (x , y1 ,z1)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start, ende
|
||
|
||
|
||
|
||
start = (x , y + dy ,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x ,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
|
||
elif (((blockname not in doc.blocks and drehung0 == "UZS" and drehung1 == "UZS")or
|
||
(am_kreisel!= None and drehung0 == "UZS" and drehung1 == "UZS"))):
|
||
|
||
block_as = "200000217_AS-Element_90_links"
|
||
import_block(block_as,lib_doc,doc)
|
||
if am_kreisel == None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
start = (x , y1,z1)
|
||
ende = (x , y - dy + asoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_as,(ende[0]-x ,ende[1]-asoffset -y,ende[2] - hoehe_gefaehlle))
|
||
return start, ende
|
||
elif voerder_richtung == "Ab":
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y1 ,z1)
|
||
block_vario.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start,ende
|
||
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy ,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x ,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
|
||
block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
|
||
|
||
elif (blockname not in doc.blocks and ((drehung0 == "UZS" and drehung1 == "GUZS" 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 == "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"
|
||
import_block(block_es,lib_doc,doc)
|
||
if am_kreisel == None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
start = (x , y + dy - esoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y1 ,z1)
|
||
block_vario.add_blockref(block_es, (start[0]-x ,start[1]+esoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start, ende
|
||
elif voerder_richtung == "Ab":
|
||
|
||
start = (x , y1,z1)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle))
|
||
return start,ende
|
||
|
||
start = (x , y + dy,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x ,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
|
||
|
||
block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle))
|
||
elif (blockname not in doc.blocks and (drehung0 == "GUZS" and drehung1 == "UZS" and hight_position == "lower")or
|
||
(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"
|
||
import_block(block_as,lib_doc,doc)
|
||
if am_kreisel == None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
start = (x , y1,z1)
|
||
ende = (x , y - dy + asoffset ,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_as,(ende[0]-x ,ende[1]-asoffset -y,ende[2] - hoehe_gefaehlle))
|
||
return start, ende
|
||
elif voerder_richtung == "Ab":
|
||
start = (x , y +dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y1 ,z1)
|
||
block_vario.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start,ende
|
||
|
||
start = (x , y +dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy ,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x ,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
|
||
block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
#erstellung von den normalen gefällestrecken
|
||
else:
|
||
if ((blockname not in doc.blocks and drehung0 == "GUZS" and drehung1 == "GUZS") or (voerder_richtung != None and drehung0 == "GUZS" and drehung1 == "GUZS")):
|
||
block_as = "200000241_AS-Element_90_rechts"
|
||
import_block(block_as,lib_doc,doc)
|
||
block_es = "200000146_ES-Element_90_rechts"
|
||
import_block(block_es,lib_doc,doc)
|
||
if hight_position != None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
start = (x , y + dy - esoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + asoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_es,(start[0]-x ,start[1]+esoffset -y,start[2] -hoehe_gefaehlle), dxfattribs={"rotation": 180})
|
||
block_vario.add_blockref(block_as, (ende[0]-x ,ende[1]-asoffset-y ,ende[2] -hoehe_gefaehlle), dxfattribs={"rotation": 180})
|
||
return start,ende
|
||
elif voerder_richtung == "Ab":
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] -hoehe_gefaehlle))
|
||
block_vario.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset-y ,ende[2] -hoehe_gefaehlle))
|
||
return start, ende
|
||
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
block_as = "200000241_AS-Element_90_rechts"
|
||
import_block(block_as,lib_doc,doc)
|
||
block_es = "200000146_ES-Element_90_rechts"
|
||
import_block(block_es,lib_doc,doc)
|
||
block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] -hoehe_gefaehlle))
|
||
block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset-y ,ende[2] -hoehe_gefaehlle))
|
||
|
||
elif (blockname not in doc.blocks and((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"
|
||
import_block(block_as,lib_doc,doc)
|
||
block_es = "400102632_ES-Element_90_links"
|
||
import_block(block_es,lib_doc,doc)
|
||
if hight_position != None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
start = (x , y + dy - esoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + asoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_es,(start[0]-x ,start[1]+ esoffset -y,start[2] - hoehe_gefaehlle))
|
||
block_vario.add_blockref(block_as, (ende[0]-x ,ende[1]- asoffset-y,ende[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start, ende
|
||
elif voerder_richtung == "Ab":
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle))
|
||
block_vario.add_blockref(block_es, (ende[0]-x ,ende[1]- esoffset-y,ende[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
return start, ende
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle))
|
||
block.add_blockref(block_es, (ende[0]-x ,ende[1]- esoffset-y,ende[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
|
||
|
||
elif ((blockname not in doc.blocks and drehung0 == "UZS" and drehung1 == "UZS") or (voerder_richtung != None and drehung0 == "UZS" and drehung1 == "UZS")):
|
||
block_as = "200000217_AS-Element_90_links"
|
||
import_block(block_as,lib_doc,doc)
|
||
block_es = "400102632_ES-Element_90_links"
|
||
import_block(block_es,lib_doc,doc)
|
||
if hight_position !=None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
start = (x , y + dy - esoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + asoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_es,(start[0]-x ,start[1]+esoffset -y,start[2] - hoehe_gefaehlle))
|
||
block_vario.add_blockref(block_as, (ende[0]-x ,ende[1]-asoffset -y,ende[2] - hoehe_gefaehlle))
|
||
return start, ende
|
||
elif voerder_richtung == "Ab":
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
block_vario.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
block_vario.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle) ,dxfattribs={"rotation": 180})
|
||
return start, ende
|
||
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x ,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
|
||
block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
|
||
block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle) ,dxfattribs={"rotation": 180})
|
||
|
||
|
||
elif ((blockname not in doc.blocks and ((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"
|
||
import_block(block_as,lib_doc,doc)
|
||
block_es = "200000146_ES-Element_90_rechts"
|
||
import_block(block_es,lib_doc,doc)
|
||
if hight_position != None:
|
||
block = doc.blocks.new(name=blockname, base_point=(0,0,0))
|
||
halbe_laenge = laenge / 2
|
||
|
||
dy = halbe_laenge * math.cos(0)
|
||
if voerder_richtung == "Auf":
|
||
start = (x , y + dy - esoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + asoffset,lower_hoehe_gefaehlle)
|
||
|
||
block_vario.add_blockref(block_es,(start[0]-x ,start[1]+esoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
block_vario.add_blockref(block_as, (ende[0]-x ,ende[1]-asoffset -y,ende[2] - hoehe_gefaehlle))
|
||
return start,ende
|
||
elif voerder_richtung == "Ab":
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
|
||
block_vario.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
block_vario.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle))
|
||
return start,ende
|
||
start = (x , y + dy - asoffset,upper_hoehe_gefaehlle)
|
||
ende = (x , y - dy + esoffset,lower_hoehe_gefaehlle)
|
||
line = Line.new(dxfattribs={"start": start, "end": ende})
|
||
line.dxf.layer = "6-SP"
|
||
|
||
copy= line.copy()
|
||
|
||
copy.translate(-x ,-y,-hoehe_gefaehlle)
|
||
block.add_entity(copy)
|
||
|
||
|
||
|
||
block.add_blockref(block_as,(start[0]-x ,start[1]+asoffset -y,start[2] - hoehe_gefaehlle),dxfattribs={"rotation": 180})
|
||
|
||
block.add_blockref(block_es, (ende[0]-x ,ende[1]-esoffset -y,ende[2] - hoehe_gefaehlle))
|
||
def am_kreisel_direct_verbunden(x, y, upper_hoehe_gefaehlle, lower_hoehe_gefaehlle, x0_kreisel, y0_kreisel, richtung_rad0, abstand0, dx, dy, x1_kreisel, y1_kreisel, richtung_rad1, abstand1,kreisel_verbunden= None, richtung0 = None, richtung1 = None, richtung2 = None):
|
||
if kreisel_verbunden == None:
|
||
kreisel_verbunden = 0
|
||
unterschiedlich = False
|
||
am_kreisel = 0
|
||
halbabstand0 = abstand0 / 2
|
||
dx0 = halbabstand0 * math.cos(richtung_rad0)
|
||
dy0 = halbabstand0 * math.sin(richtung_rad0)
|
||
pos0_0_floor= (math.floor(x0_kreisel + dx0),math.floor( y0_kreisel + dy0))
|
||
pos0_1_floor = (math.floor(x0_kreisel- dx0),math.floor( y0_kreisel- dy0))
|
||
pos0_0_round= (round(x0_kreisel + dx0),round( y0_kreisel + dy0))
|
||
pos0_1_round = (round(x0_kreisel- dx0),round( y0_kreisel- dy0))
|
||
if (x1_kreisel != None):
|
||
halbabstand1 = abstand1 / 2
|
||
dx1 = halbabstand1 * math.cos(richtung_rad1 )
|
||
dy1 = halbabstand1 * math.sin(richtung_rad1)
|
||
pos1_0_floor = (math.floor(x1_kreisel + dx1), math.floor(y1_kreisel + dy1))
|
||
pos1_1_floor = (math.floor(x1_kreisel - dx1), math.floor(y1_kreisel - dy1))
|
||
pos1_0_round = (round(x1_kreisel + dx1), round(y1_kreisel + dy1))
|
||
pos1_1_round = (round(x1_kreisel - dx1), round(y1_kreisel - dy1))
|
||
|
||
|
||
# berechnung der geraden einmal abgerunden und einmal gerunden zur negirung des offsets
|
||
start_floor = (math.floor(x +dx ), math.floor(y + dy ),upper_hoehe_gefaehlle)
|
||
ende_floor = (math.floor(x -dx), math.floor(y - dy ) ,lower_hoehe_gefaehlle)
|
||
start_round = (round(x +dx ), round(y + dy ),upper_hoehe_gefaehlle)
|
||
ende_round= (round(x -dx), round(y - dy ) ,lower_hoehe_gefaehlle)
|
||
# verschiebund der endpunkte der gerade in richtung von dem potentiellen Kreisel für den vergleich wieder mit floor und rundung
|
||
abstand_fuer_kreis_start_x_floor = start_floor[0] +RADIUS, start_floor[1]
|
||
abstand_gegen_kreis_start_x_floor = start_floor[0] -RADIUS, start_floor[1]
|
||
abstand_fuer_kreis_start_y_floor = start_floor[0], start_floor[1] + RADIUS
|
||
abstand_gegen_kreis_start_y_floor = start_floor[0], start_floor[1] - RADIUS
|
||
abstand_fuer_kreis_ende_x_floor= ende_floor[0] + RADIUS, ende_floor[1]
|
||
abstand_gegen_kreis_ende_x_floor= ende_floor[0] - RADIUS, ende_floor[1]
|
||
abstand_fuer_kreis_ende_y_floor = ende_floor[0] , ende_floor[1] + RADIUS
|
||
abstand_gegen_kreis_ende_y_floor = ende_floor[0] , ende_floor[1] - RADIUS
|
||
|
||
abstand_fuer_kreis_start_x_round= start_round[0] +RADIUS, start_round[1]
|
||
abstand_gegen_kreis_start_x_round = start_round[0] -RADIUS, start_round[1]
|
||
abstand_fuer_kreis_start_y_round = start_round[0], start_round[1] + RADIUS
|
||
abstand_gegen_kreis_start_y_round = start_round[0], start_round[1] - RADIUS
|
||
abstand_fuer_kreis_ende_x_round= ende_round[0] + RADIUS, ende_round[1]
|
||
abstand_gegen_kreis_ende_x_round= ende_round[0] - RADIUS, ende_round[1]
|
||
abstand_fuer_kreis_ende_y_round = ende_round[0] , ende_round[1] + RADIUS
|
||
abstand_gegen_kreis_ende_y_round = ende_round[0] , ende_round[1] - RADIUS
|
||
if(richtung0 != None and richtung0 != None):
|
||
if (richtung0 != richtung1 and kreisel_verbunden ==1):
|
||
if(
|
||
(abstand_fuer_kreis_start_y_floor == pos0_0_floor)or
|
||
(abstand_fuer_kreis_start_y_floor == pos0_1_floor) or
|
||
(abstand_gegen_kreis_start_y_floor == pos0_0_floor) or
|
||
(abstand_gegen_kreis_start_y_floor == pos0_1_floor) or
|
||
(abstand_fuer_kreis_ende_y_floor == pos0_0_floor) or
|
||
(abstand_fuer_kreis_ende_y_floor == pos0_1_floor) or
|
||
(abstand_gegen_kreis_ende_y_floor == pos0_0_floor) or
|
||
(abstand_gegen_kreis_ende_y_floor == pos0_1_floor) or
|
||
(abstand_fuer_kreis_start_y_round == pos0_0_round)or
|
||
(abstand_fuer_kreis_start_y_round == pos0_1_round) or
|
||
(abstand_gegen_kreis_start_y_round == pos0_0_round) or
|
||
(abstand_gegen_kreis_start_y_round == pos0_1_round) or
|
||
(abstand_fuer_kreis_ende_y_round == pos0_0_round) or
|
||
(abstand_fuer_kreis_ende_y_round == pos0_1_round) or
|
||
(abstand_gegen_kreis_ende_y_round == pos0_0_round) or
|
||
(abstand_gegen_kreis_ende_y_round == pos0_1_round) or
|
||
|
||
|
||
|
||
(abstand_fuer_kreis_start_y_floor == pos1_0_floor) or
|
||
(abstand_fuer_kreis_start_y_floor == pos1_1_floor) or
|
||
(abstand_gegen_kreis_start_y_floor == pos1_0_floor) or
|
||
(abstand_gegen_kreis_start_y_floor == pos1_1_floor) or
|
||
(abstand_fuer_kreis_ende_y_floor == pos1_0_floor) or
|
||
(abstand_fuer_kreis_ende_y_floor == pos1_1_floor) or
|
||
(abstand_gegen_kreis_ende_y_floor == pos1_0_floor) or
|
||
(abstand_gegen_kreis_ende_y_floor == pos1_1_floor) or
|
||
|
||
(abstand_fuer_kreis_start_y_round == pos1_0_round) or
|
||
(abstand_fuer_kreis_start_y_round == pos1_1_round) or
|
||
(abstand_gegen_kreis_start_y_round == pos1_0_round) or
|
||
(abstand_gegen_kreis_start_y_round == pos1_1_round) or
|
||
(abstand_fuer_kreis_ende_y_round == pos1_0_round) or
|
||
(abstand_fuer_kreis_ende_y_round == pos1_1_round) or
|
||
(abstand_gegen_kreis_ende_y_round == pos1_0_round) or
|
||
(abstand_gegen_kreis_ende_y_round == pos1_1_round)
|
||
):
|
||
richtung2= "Vertikal"
|
||
unterschiedlich = True
|
||
|
||
else:
|
||
richtung2 = "Horinzontal"
|
||
unterschiedlich = True
|
||
return richtung2, unterschiedlich
|
||
return richtung2, unterschiedlich
|
||
|
||
# vergleich mit einem kreisel von zwei
|
||
if( (abstand_fuer_kreis_start_x_floor == pos0_0_floor) or
|
||
(abstand_fuer_kreis_start_x_floor == pos0_1_floor) or
|
||
(abstand_gegen_kreis_start_x_floor == pos0_0_floor) or
|
||
(abstand_gegen_kreis_start_x_floor == pos0_1_floor) or
|
||
(abstand_fuer_kreis_ende_x_floor == pos0_0_floor) or
|
||
(abstand_fuer_kreis_ende_x_floor == pos0_1_floor) or
|
||
(abstand_gegen_kreis_ende_x_floor == pos0_0_floor) or
|
||
(abstand_gegen_kreis_ende_x_floor == pos0_1_floor) or
|
||
(abstand_fuer_kreis_start_y_floor == pos0_0_floor) or
|
||
(abstand_fuer_kreis_start_y_floor == pos0_1_floor) or
|
||
(abstand_gegen_kreis_start_y_floor == pos0_0_floor) or
|
||
(abstand_gegen_kreis_start_y_floor == pos0_1_floor) or
|
||
(abstand_fuer_kreis_ende_y_floor == pos0_0_floor) or
|
||
(abstand_fuer_kreis_ende_y_floor == pos0_1_floor) or
|
||
(abstand_gegen_kreis_ende_y_floor == pos0_0_floor) or
|
||
(abstand_gegen_kreis_ende_y_floor == pos0_1_floor) or
|
||
(abstand_fuer_kreis_start_x_round == pos0_0_round ) or
|
||
(abstand_fuer_kreis_start_x_round == pos0_1_round) or
|
||
(abstand_gegen_kreis_start_x_round == pos0_0_round) or
|
||
(abstand_gegen_kreis_start_x_round == pos0_1_round) or
|
||
(abstand_fuer_kreis_ende_x_round == pos0_0_round) or
|
||
(abstand_fuer_kreis_ende_x_round == pos0_1_round) or
|
||
(abstand_gegen_kreis_ende_x_round == pos0_0_round) or
|
||
(abstand_gegen_kreis_ende_x_round == pos0_1_round) or
|
||
(abstand_fuer_kreis_start_y_round == pos0_0_round) or
|
||
(abstand_fuer_kreis_start_y_round == pos0_1_round) or
|
||
(abstand_gegen_kreis_start_y_round == pos0_0_round) or
|
||
(abstand_gegen_kreis_start_y_round == pos0_1_round) or
|
||
(abstand_fuer_kreis_ende_y_round == pos0_0_round) or
|
||
(abstand_fuer_kreis_ende_y_round == pos0_1_round) or
|
||
(abstand_gegen_kreis_ende_y_round == pos0_0_round) or
|
||
(abstand_gegen_kreis_ende_y_round == pos0_1_round)
|
||
):
|
||
kreisel_verbunden = kreisel_verbunden +1
|
||
# setzung auf kreisel 1 für spätere ausrechnung der geraden form
|
||
am_kreisel = 1
|
||
if (x1_kreisel == None):
|
||
return am_kreisel,kreisel_verbunden
|
||
|
||
|
||
|
||
if( (abstand_fuer_kreis_start_x_floor == pos1_0_floor )or
|
||
(abstand_fuer_kreis_start_x_floor == pos1_1_floor) or
|
||
(abstand_gegen_kreis_start_x_floor == pos1_0_floor) or
|
||
(abstand_gegen_kreis_start_x_floor == pos1_1_floor) or
|
||
(abstand_fuer_kreis_ende_x_floor == pos1_0_floor) or
|
||
(abstand_fuer_kreis_ende_x_floor == pos1_1_floor) or
|
||
(abstand_gegen_kreis_ende_x_floor == pos1_0_floor) or
|
||
(abstand_gegen_kreis_ende_x_floor == pos1_1_floor) or
|
||
(abstand_fuer_kreis_start_y_floor == pos1_0_floor ) or
|
||
(abstand_fuer_kreis_start_y_floor == pos1_1_floor) or
|
||
(abstand_gegen_kreis_start_y_floor == pos1_0_floor) or
|
||
(abstand_gegen_kreis_start_y_floor == pos1_1_floor) or
|
||
(abstand_fuer_kreis_ende_y_floor == pos1_0_floor ) or
|
||
(abstand_fuer_kreis_ende_y_floor == pos1_1_floor) or
|
||
(abstand_gegen_kreis_ende_y_floor == pos1_0_floor) or
|
||
(abstand_gegen_kreis_ende_y_floor == pos1_1_floor) or
|
||
(abstand_fuer_kreis_start_x_round == pos1_0_round ) or
|
||
(abstand_fuer_kreis_start_x_round == pos1_1_round) or
|
||
(abstand_gegen_kreis_start_x_round == pos1_0_round) or
|
||
(abstand_gegen_kreis_start_x_round == pos1_1_round) or
|
||
(abstand_fuer_kreis_ende_x_round == pos1_0_round) or
|
||
(abstand_fuer_kreis_ende_x_round == pos1_1_round) or
|
||
(abstand_gegen_kreis_ende_x_round == pos1_0_round) or
|
||
(abstand_gegen_kreis_ende_x_round == pos1_1_round) or
|
||
(abstand_fuer_kreis_start_y_round == pos1_0_round) or
|
||
(abstand_fuer_kreis_start_y_round == pos1_1_round) or
|
||
(abstand_gegen_kreis_start_y_round == pos1_0_round) or
|
||
(abstand_gegen_kreis_start_y_round == pos1_1_round) or
|
||
(abstand_fuer_kreis_ende_y_round == pos1_0_round) or
|
||
(abstand_fuer_kreis_ende_y_round == pos1_1_round) or
|
||
(abstand_gegen_kreis_ende_y_round == pos1_0_round) or
|
||
(abstand_gegen_kreis_ende_y_round == pos1_1_round)
|
||
):
|
||
kreisel_verbunden = kreisel_verbunden +1
|
||
am_kreisel = 2
|
||
return am_kreisel,kreisel_verbunden
|
||
def get_layer(doc, lib_doc, blockname):
|
||
if blockname in lib_doc.blocks:
|
||
src = lib_doc.blocks[blockname]
|
||
else:
|
||
src = doc.blocks[blockname]
|
||
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 doc.layers:
|
||
try:
|
||
src_layer = lib_doc.layers.get(layer_name)
|
||
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
|
||
doc.layers.add(name=layer_name)
|
||
except Exception:
|
||
pass
|
||
layer_counts = {}
|
||
for e in src:
|
||
ln = getattr(e.dxf, "layer", None)
|
||
if not ln:
|
||
continue
|
||
if ln != "BOUNDING_BOX":
|
||
layer_counts[ln] = layer_counts.get(ln, 0) + 1
|
||
if layer_counts:
|
||
blockref_layer = max(layer_counts.items(), key=lambda kv: kv[1])[0]
|
||
return blockref_layer
|
||
|
||
def normalize_func_name(name):
|
||
return (
|
||
name.replace('ä', 'ae')
|
||
.replace('ö', 'oe')
|
||
.replace('ü', 'ue')
|
||
.replace('ß', 'ss')
|
||
.replace(' ', '_')
|
||
.replace('.', '_')
|
||
.lower()
|
||
)
|
||
|
||
def get_libfile_cfg(teileart, cfg_path):
|
||
"""Liest den Bibliotheksdateinamen für eine TeileArt aus der allgemein.cfg."""
|
||
parser = configparser.ConfigParser()
|
||
with open(cfg_path, encoding='utf-8') as f:
|
||
parser.read_file(f)
|
||
# Teileart kann z.B. "ILS 2.0 Kreisel" sein, wir nehmen den ersten Teil vor erstem Leerzeichen oder Punkt
|
||
# oder suchen iterativ nach Sektionen, die im Teileart-Namen vorkommen
|
||
for section in parser.sections():
|
||
if section in teileart:
|
||
return parser.get(section, "libfile", fallback=None)
|
||
return None
|
||
|
||
|
||
def get_rotations_of_strecken(csv_path:Path) -> dict:
|
||
geraden = []
|
||
kreisel =[]
|
||
strecken_nachbarn = []
|
||
foerderernachbarn = []
|
||
anweisungen = 0
|
||
"""Gib für jede gefällestrecke zurück welche Drehrichtung die benachbarten Kreisel haben """
|
||
with csv_path.open(newline="", encoding="utf-8") as fh:
|
||
reader = csv.DictReader(fh, delimiter=';')
|
||
for row in reader:
|
||
bezeichner = row["TeileArt"].strip()
|
||
if bezeichner == "ILS 2.0 Gefällestrecke":
|
||
Id = row["TeileId"].strip()
|
||
NachbarIds = row["NachbarIds"].strip()
|
||
geraden.append({"Id": Id, "NachbarIds": NachbarIds})
|
||
if bezeichner == "ILS 2.0 Kreisel":
|
||
Id = row["TeileId"].strip()
|
||
planquadrat = row["Planquadrat"]
|
||
x, y = extract_coords(planquadrat)
|
||
merkmale = parse_merkmale(row.get("Merkmale", ""))
|
||
drehung = merkmale.get("Drehrichtung")
|
||
rotation = merkmale.get("Drehung")
|
||
hight = float(merkmale.get("Höhe in m")) *1000
|
||
abstand_m = merkmale.get(
|
||
"Abstand (Kreiselachse A - Kreiselachse) in Meter", "20"
|
||
).replace(",", ".")
|
||
kreisel.append({"Id":Id, "drehung":drehung, "höhe":hight,"x": x, "y": y, "rotation": rotation,"abstand":abstand_m})
|
||
if bezeichner =="ILS 2.0 VarioFoerderer":
|
||
Id = row["TeileId"].strip()
|
||
NachbarIds = row["NachbarIds"].strip()
|
||
merkmale = parse_merkmale(row.get("Merkmale", ""))
|
||
winkel = merkmale.get("Winkel")
|
||
h0 = float(merkmale.get("Höhe Anfang")) * 1000
|
||
h1 = float(merkmale.get("Höhe Ende")) * 1000
|
||
foerderrichtung = merkmale.get("Förderrichtung")
|
||
geraden.append({"Id": Id,"NachbarIds":NachbarIds, "Winkel":winkel, "h0": h0,"h1": h1,"Foerderrichtung":foerderrichtung })
|
||
|
||
|
||
|
||
|
||
|
||
for gerade in geraden:
|
||
anweisungen = 0
|
||
geraden_anweisung = 0
|
||
eintrag = {"Id": gerade["Id"]}
|
||
for kreis in kreisel:
|
||
if kreis["Id"] in gerade["NachbarIds"]:
|
||
if anweisungen == 0:
|
||
eintrag["Drehung0"] = kreis.get("drehung")
|
||
eintrag["Hoehe0"] = kreis.get("höhe")
|
||
eintrag["x0"] = kreis.get("x")
|
||
eintrag["y0"] = kreis.get("y")
|
||
eintrag["rotation0"] = kreis.get("rotation")
|
||
eintrag["abstand0"] = kreis.get("abstand")
|
||
anweisungen = 1
|
||
elif anweisungen == 1:
|
||
eintrag["Drehung1"] = kreis.get("drehung")
|
||
eintrag["Hoehe1"] = kreis.get("höhe")
|
||
eintrag["x1"] = kreis.get("x")
|
||
eintrag["y1"] = kreis.get("y")
|
||
eintrag["rotation1"] = kreis.get("rotation")
|
||
eintrag["abstand1"] = kreis.get("abstand")
|
||
break
|
||
if(gerade.get("Winkel") != None ):
|
||
for vario_gerade in geraden:
|
||
|
||
if vario_gerade["Id"] in gerade["NachbarIds"] and vario_gerade.get("Winkel") != None:
|
||
if geraden_anweisung == 0:
|
||
eintrag["Winkel"] = vario_gerade.get("Winkel")
|
||
eintrag["h0"] = vario_gerade.get("h0")
|
||
eintrag["h1"] = vario_gerade.get("h1")
|
||
eintrag["Foerderrichtung"] = vario_gerade.get("Foerderrichtung")
|
||
geraden_anweisung =1
|
||
elif geraden_anweisung == 1:
|
||
eintrag["Winkel_2"] = vario_gerade.get("Winkel")
|
||
eintrag["h0_2"] = vario_gerade.get("h0")
|
||
eintrag["h1_2"] = vario_gerade.get("h1")
|
||
eintrag["Foerderrichtung_2"] = vario_gerade.get("Foerderrichtung")
|
||
break
|
||
|
||
|
||
|
||
strecken_nachbarn.append(eintrag)
|
||
|
||
return strecken_nachbarn
|
||
|
||
|
||
|
||
|
||
# --------------------------------------------------------- Hauptfunktion
|
||
def main(csv_path: Path, lib_path: Path, cfg_path: Path,
|
||
output_path: Path, verbose=False, logger=None):
|
||
|
||
# Bibliothek nur laden, wenn Datei existiert
|
||
check_dxflibrary_path(lib_path, verbose, logger)
|
||
parser = configparser.ConfigParser()
|
||
try:
|
||
with open(cfg_path, encoding='utf-8') as f:
|
||
parser.read_file(f)
|
||
except Exception as e:
|
||
msg = f"Fehler beim Lesen der Config-Datei {cfg_path}: {e}"
|
||
# Neue Zielzeichnung (DXF R2018)
|
||
config =parser
|
||
doc = ezdxf.new(dxfversion="R2018")
|
||
doc.units = units.M
|
||
doc.header['$INSUNITS'] = 4 # Millimeter
|
||
msp = doc.modelspace()
|
||
|
||
# Höhe bestimmen für Koordinaten-Transformation
|
||
try:
|
||
height = berechne_hoehe(csv_path, logger=logger)
|
||
except Exception as e:
|
||
msg = f"Fehler bei der Höhenberechnung: {e}"
|
||
if logger:
|
||
logger.error(msg)
|
||
else:
|
||
print(msg)
|
||
sys.exit(1)
|
||
|
||
blocklib_dir = data_dir / "block_libraries"
|
||
lib_docs = dict()
|
||
|
||
strecken_nachbarn = get_rotations_of_strecken(csv_path)
|
||
# gibt zu jeder ShapeId einer Gefällestrecke zurück, ob sich der jeweilige Kreisel im UZ oder GUZ dreht
|
||
# rot_of_gf["shape_3ae53a7b-efb8-f66b-eadc-20b99f949ef1"] = ('UZ', 'GUZ')
|
||
|
||
# Verarbeitung der Blöcke
|
||
with csv_path.open(newline="", encoding="utf-8") as fh:
|
||
reader = csv.DictReader(fh, delimiter=';')
|
||
for row in reader:
|
||
bezeichner = row["Bezeichnung"].strip()
|
||
teileart = row["TeileArt"].strip()
|
||
teileid = row["TeileId"].strip()
|
||
planquadrat = row["Planquadrat"]
|
||
merkmale = parse_merkmale(row.get("Merkmale", ""))
|
||
merkmale["bezeichner"] = bezeichner
|
||
|
||
|
||
try:
|
||
x_screen, y_screen = extract_coords(planquadrat)
|
||
x, y = transform_coords(x_screen, y_screen, height)
|
||
except Exception as e:
|
||
msg = f"[WARN] {teileid}: {e}"
|
||
if logger:
|
||
logger.warning(msg)
|
||
else:
|
||
print(msg)
|
||
continue
|
||
|
||
# Bibliotheksdatei bestimmen
|
||
libfile = get_libfile_cfg(teileart, allgemein_cfg_path)
|
||
if libfile:
|
||
lib_path = blocklib_dir / libfile
|
||
else:
|
||
lib_path = default_lib_path
|
||
|
||
# Bibliothek laden (mit Cache)
|
||
lib_doc = None
|
||
if lib_path in lib_docs:
|
||
lib_doc = lib_docs[lib_path]
|
||
elif lib_path.exists():
|
||
try:
|
||
lib_doc = ezdxf.readfile(lib_path)
|
||
lib_docs[lib_path] = lib_doc
|
||
if verbose:
|
||
print(f"[INFO] Bibliothek geladen: {lib_path}")
|
||
except Exception as e:
|
||
print(f"[WARN] Fehler beim Lesen der Bibliothek '{lib_path}': {e}")
|
||
else:
|
||
print(f"[INFO] Keine Bibliothek gefunden unter {lib_path}. Komplexe Formen werden übersprungen.")
|
||
|
||
# Funktions-Dispatch: handle_<teileart> (mit _ statt Leerzeichen und Punkten, alles klein)
|
||
func_name = f'handle_{normalize_func_name(teileart)}'
|
||
handler = globals().get(func_name)
|
||
symbols = get_shape_cfg(teileart, cfg_path, logger=logger)
|
||
# Mapping für Omniflo-Typen
|
||
if func_name.startswith('handle_omniflo'):
|
||
handler = globals().get('handle_omniflo')
|
||
if handler:
|
||
handler(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn, config)
|
||
else:
|
||
msg = f"[WARN] Keine Routine für TeileArt '{teileart}'. Überspringe '{teileid}'."
|
||
if logger:
|
||
logger.warning(msg)
|
||
else:
|
||
print(msg)
|
||
continue
|
||
|
||
# DXF speichern
|
||
doc.saveas(output_path)
|
||
if logger:
|
||
logger.info(f"[DONE] DXF gespeichert unter: {output_path}")
|
||
else:
|
||
print(f"[DONE] DXF gespeichert unter: {output_path}")
|
||
|
||
def check_dxflibrary_path(lib_path, verbose, logger):
|
||
lib_doc = None
|
||
if lib_path.exists():
|
||
try:
|
||
lib_doc = ezdxf.readfile(lib_path)
|
||
if verbose:
|
||
logger.info(f"[INFO] Bibliothek geladen: {lib_path}") if logger else print(f"[INFO] Bibliothek geladen: {lib_path}")
|
||
except Exception as e:
|
||
msg = f"Fehler beim Lesen der Bibliothek '{lib_path}': {e}"
|
||
if logger:
|
||
logger.error(msg)
|
||
else:
|
||
print(msg)
|
||
sys.exit(1)
|
||
else:
|
||
msg = f"[INFO] Keine Bibliothek gefunden unter {lib_path}."
|
||
if logger:
|
||
logger.error(msg)
|
||
else:
|
||
print(msg)
|
||
sys.exit(1)
|
||
|
||
if __name__ == "__main__":
|
||
parser = argparse.ArgumentParser(
|
||
description="Plaziert Anlagenkomponenten aus RuleDesigner CSV.")
|
||
parser.add_argument("-f", "--file", required=True, help="CSV-Datei (Name oder Pfad)", metavar="input.csv")
|
||
parser.add_argument("-c", "--config", help="CFG mit einfachen Formen", metavar="shapes.cfg")
|
||
parser.add_argument("-l", "--lib", help="DXF-Bibliothek mit Blöcken", metavar="bibliothek.dxf")
|
||
parser.add_argument("-o", "--output", help="Ziel-DXF (Standard: PROJECT_WORK/anlage.dxf)", metavar="anlage.dxf")
|
||
parser.add_argument("-v", "--verbose", action="store_true", help="mehr Ausgaben anzeigen")
|
||
args = parser.parse_args()
|
||
|
||
# Verzeichnisse aus Umgebungsvariablen
|
||
log_dir = check_environment_var("PROJECT_LOG")
|
||
data_dir = check_environment_var("PROJECT_DATA")
|
||
work_dir = check_environment_var("PROJECT_WORK")
|
||
config_dir = check_environment_var("PROJECT_CFG")
|
||
|
||
logger = setup_logger(log_dir, name='plant2dxf')
|
||
logger.info("=== plant2dxf Verarbeitung gestartet ===")
|
||
|
||
# CSV‑Pfad: nur Dateiname → im WORK‑Ordner suchen
|
||
if os.sep not in args.file and "/" not in args.file:
|
||
csv_path = work_dir / args.file
|
||
else:
|
||
csv_path = Path(args.file)
|
||
|
||
cfg_path = Path(args.config) if args.config else config_dir / "shapes.cfg"
|
||
allgemein_cfg_path = config_dir / "allgemein.cfg"
|
||
default_lib_path = Path(args.lib) if args.lib else data_dir / "blocks.dxf"
|
||
output_path = Path(args.output) if args.output else (work_dir / f"{csv_path.stem}.dxf")
|
||
|
||
main(csv_path, default_lib_path, cfg_path, output_path, verbose=args.verbose, logger=logger)
|
||
logger.info("=== plant2dxf Verarbeitung abgeschlossen ===")
|
||
|