Merge branch 'main' of http://gitea.schoenenberger.de/mistangl/plant2dxf
This commit is contained in:
+98
-96
@@ -48,6 +48,52 @@ class Bt_element(BaseModel):
|
|||||||
drehung = drehung
|
drehung = drehung
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
class Angetriebene_Kurve(BaseModel):
|
||||||
|
teileid: str
|
||||||
|
x: float
|
||||||
|
y:float
|
||||||
|
drehung: float = Field(default=0.0,description="Rotation der Kurve")
|
||||||
|
hoehe0: float = Field(default=0.0,description="Hoehe Anfang der Kurve")
|
||||||
|
hoehe1: float = Field(default=0.0,description="Hoehe Ende der Kurve")
|
||||||
|
kurvenrichtung: str = Field(description="Kurvenrichtung der Kurve")
|
||||||
|
antriebNebenStrecke: str =Field(description="wo die Angetriebene Strecke ist abhängig von der kurvenrichtung")
|
||||||
|
winkel: int = Field(description="Der Winkel der Kurve")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def antrieb(self):
|
||||||
|
if self.antriebNebenStrecke == "Aussen":
|
||||||
|
self.antriebNebenStrecke = "außen"
|
||||||
|
elif self.antriebNebenStrecke == "Innen":
|
||||||
|
self.antriebNebenStrecke = "innen"
|
||||||
|
return self.antriebNebenStrecke
|
||||||
|
@property
|
||||||
|
def hight_zwischen(self):
|
||||||
|
return ((self.hoehe0 + self.hoehe1) /2)
|
||||||
|
@classmethod
|
||||||
|
def from_merkmale(cls, teileid: str, x: float, y: float, merkmale: dict) -> 'Angetriebene_Kurve':
|
||||||
|
hoehe0 = float(merkmale.get("Höhe Anfang")) * 1000
|
||||||
|
hoehe1 = float(merkmale.get("Höhe Ende")) * 1000
|
||||||
|
winkel = int(merkmale.get("Kurvenwinkel"))
|
||||||
|
kurvenrichtung = merkmale.get("Kurvenrichtung")
|
||||||
|
antriebNebenstrecke = merkmale.get("AntriebNebenStrecke")
|
||||||
|
try:
|
||||||
|
drehung = float(merkmale.get("Drehung"))
|
||||||
|
except Exception as e:
|
||||||
|
drehung = 0.0
|
||||||
|
|
||||||
|
return cls(
|
||||||
|
teileid = teileid,
|
||||||
|
x = x,
|
||||||
|
y = y,
|
||||||
|
drehung = drehung,
|
||||||
|
hoehe0 = hoehe0,
|
||||||
|
hoehe1 = hoehe1,
|
||||||
|
kurvenrichtung = kurvenrichtung,
|
||||||
|
antriebNebenStrecke = antriebNebenstrecke,
|
||||||
|
winkel = winkel
|
||||||
|
|
||||||
|
)
|
||||||
# --------------------------------------------------------- CFG-Leser für shapes.cfg
|
# --------------------------------------------------------- CFG-Leser für shapes.cfg
|
||||||
def get_shape_cfg(teileart, cfg_path, logger=None):
|
def get_shape_cfg(teileart, cfg_path, logger=None):
|
||||||
parser = configparser.ConfigParser()
|
parser = configparser.ConfigParser()
|
||||||
@@ -299,47 +345,7 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
|||||||
richtung2 ="DEFAULT"
|
richtung2 ="DEFAULT"
|
||||||
unterschiedlich = False
|
unterschiedlich = False
|
||||||
|
|
||||||
separatoren = gefaelle_objekt.anzahl_separatoren
|
anzahl_seperatoren_oder_scan(msp, x, y, doc, lib_doc, gefaelle_objekt, hoehe_gefaehlle, rotation)
|
||||||
scanner = gefaelle_objekt.anzahl_scanner
|
|
||||||
if rotation == 0 or rotation == -180:
|
|
||||||
ausrichtung = "V"
|
|
||||||
else:
|
|
||||||
ausrichtung = "H"
|
|
||||||
if ausrichtung == "V":
|
|
||||||
einsatz_fest = [x + 300, y,hoehe_gefaehlle]
|
|
||||||
modular = 2
|
|
||||||
else:
|
|
||||||
einsatz_fest = [x,y - 150,hoehe_gefaehlle]
|
|
||||||
modular = 3
|
|
||||||
block_scanner = "SCAN"
|
|
||||||
block_separatoren = "S-LP"
|
|
||||||
import_block(block_scanner,lib_doc,doc)
|
|
||||||
import_block(block_separatoren,lib_doc,doc)
|
|
||||||
layer_scan, color_scan = get_insert_color_layer(lib_doc, block_scanner)
|
|
||||||
layer_separatioren, color_separatioren = get_insert_color_layer(lib_doc, block_separatoren)
|
|
||||||
einsatz_zwischen =[ einsatz_fest[0],einsatz_fest[1],einsatz_fest[2]]
|
|
||||||
anzahl =0
|
|
||||||
while anzahl < separatoren:
|
|
||||||
anzahl = anzahl + 1
|
|
||||||
msp.add_blockref(block_separatoren,einsatz_zwischen, dxfattribs={"layer": layer_separatioren,"color": color_separatioren})
|
|
||||||
if anzahl % modular == 0:
|
|
||||||
einsatz_fest[1] = einsatz_fest[1] - 150
|
|
||||||
einsatz_zwischen = einsatz_fest.copy()
|
|
||||||
else:
|
|
||||||
einsatz_zwischen[0] = einsatz_zwischen[0]+ 300
|
|
||||||
|
|
||||||
if anzahl % modular != 0:
|
|
||||||
einsatz_fest[1] = einsatz_fest[1] - 150
|
|
||||||
einsatz_zwischen = einsatz_fest.copy()
|
|
||||||
anzahl =0
|
|
||||||
while anzahl < scanner:
|
|
||||||
anzahl = anzahl + 1
|
|
||||||
msp.add_blockref(block_scanner,einsatz_zwischen,dxfattribs={"layer": layer_scan,"color": color_scan})
|
|
||||||
if anzahl % modular == 0:
|
|
||||||
einsatz_fest[1] = einsatz_fest[1] - 150
|
|
||||||
einsatz_zwischen = einsatz_fest.copy()
|
|
||||||
else:
|
|
||||||
einsatz_zwischen[0] = einsatz_zwischen[0]+ 300
|
|
||||||
for nachbarn in strecken_nachbarn:
|
for nachbarn in strecken_nachbarn:
|
||||||
if teileid == nachbarn.get("Id"):
|
if teileid == nachbarn.get("Id"):
|
||||||
gefaellestrecke_nachbarn = nachbarn
|
gefaellestrecke_nachbarn = nachbarn
|
||||||
@@ -671,6 +677,49 @@ def handle_ils_2_0_gefaellestrecke(msp, teileid, merkmale, x, y, doc, lib_doc, v
|
|||||||
block.add_entity(line)
|
block.add_entity(line)
|
||||||
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
|
msp.add_blockref(blockname,(x,y,hoehe_gefaehlle),dxfattribs={"rotation": rotation,"layer": gefaelle_layer})
|
||||||
|
|
||||||
|
def anzahl_seperatoren_oder_scan(msp, x, y, doc, lib_doc, klassen_objekt, hoehe, rotation):
|
||||||
|
separatoren = klassen_objekt.anzahl_separatoren
|
||||||
|
scanner = klassen_objekt.anzahl_scanner
|
||||||
|
if rotation == 0 or rotation == -180:
|
||||||
|
ausrichtung = "V"
|
||||||
|
else:
|
||||||
|
ausrichtung = "H"
|
||||||
|
if ausrichtung == "V":
|
||||||
|
einsatz_fest = [x + 300, y,hoehe]
|
||||||
|
modular = 2
|
||||||
|
else:
|
||||||
|
einsatz_fest = [x,y - 150,hoehe]
|
||||||
|
modular = 3
|
||||||
|
block_scanner = "SCAN"
|
||||||
|
block_separatoren = "S-LP"
|
||||||
|
import_block(block_scanner,lib_doc,doc)
|
||||||
|
import_block(block_separatoren,lib_doc,doc)
|
||||||
|
layer_scan, color_scan = get_insert_color_layer(lib_doc, block_scanner)
|
||||||
|
layer_separatioren, color_separatioren = get_insert_color_layer(lib_doc, block_separatoren)
|
||||||
|
einsatz_zwischen =[ einsatz_fest[0],einsatz_fest[1],einsatz_fest[2]]
|
||||||
|
anzahl =0
|
||||||
|
while anzahl < separatoren:
|
||||||
|
anzahl = anzahl + 1
|
||||||
|
msp.add_blockref(block_separatoren,einsatz_zwischen, dxfattribs={"layer": layer_separatioren,"color": color_separatioren})
|
||||||
|
if anzahl % modular == 0:
|
||||||
|
einsatz_fest[1] = einsatz_fest[1] - 150
|
||||||
|
einsatz_zwischen = einsatz_fest.copy()
|
||||||
|
else:
|
||||||
|
einsatz_zwischen[0] = einsatz_zwischen[0]+ 300
|
||||||
|
|
||||||
|
if anzahl % modular != 0:
|
||||||
|
einsatz_fest[1] = einsatz_fest[1] - 150
|
||||||
|
einsatz_zwischen = einsatz_fest.copy()
|
||||||
|
anzahl =0
|
||||||
|
while anzahl < scanner:
|
||||||
|
anzahl = anzahl + 1
|
||||||
|
msp.add_blockref(block_scanner,einsatz_zwischen,dxfattribs={"layer": layer_scan,"color": color_scan})
|
||||||
|
if anzahl % modular == 0:
|
||||||
|
einsatz_fest[1] = einsatz_fest[1] - 150
|
||||||
|
einsatz_zwischen = einsatz_fest.copy()
|
||||||
|
else:
|
||||||
|
einsatz_zwischen[0] = einsatz_zwischen[0]+ 300
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def add_attributes_to_block(block, attributes):
|
def add_attributes_to_block(block, attributes):
|
||||||
@@ -721,47 +770,7 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
|
|||||||
upper_hoehe_vario= foerderer.h1
|
upper_hoehe_vario= foerderer.h1
|
||||||
lower_hoehe_vario = foerderer.h0
|
lower_hoehe_vario = foerderer.h0
|
||||||
hoehe_vario= foerderer.hight_zwischen
|
hoehe_vario= foerderer.hight_zwischen
|
||||||
separatoren = foerderer.anzahl_separatoren
|
anzahl_seperatoren_oder_scan(msp, x, y, doc, lib_doc, foerderer, hoehe_vario, rotation)
|
||||||
scanner = foerderer.anzahl_scanner
|
|
||||||
if rotation == 0.0 or rotation == -180.0:
|
|
||||||
ausrichtung = "V"
|
|
||||||
else:
|
|
||||||
ausrichtung = "H"
|
|
||||||
if ausrichtung == "V":
|
|
||||||
einsatz_fest = [x + 300,y,hoehe_vario]
|
|
||||||
modular = 2
|
|
||||||
else:
|
|
||||||
einsatz_fest = [x,y - 150,hoehe_vario]
|
|
||||||
modular = 3
|
|
||||||
block_scanner = "SCAN"
|
|
||||||
block_separatoren = "S-LP"
|
|
||||||
import_block(block_scanner,lib_doc,doc)
|
|
||||||
import_block(block_separatoren,lib_doc,doc)
|
|
||||||
einsatz_zwischen =[ einsatz_fest[0],einsatz_fest[1],einsatz_fest[2]]
|
|
||||||
anzahl =0
|
|
||||||
while anzahl < separatoren:
|
|
||||||
anzahl = anzahl + 1
|
|
||||||
msp.add_blockref(block_separatoren,einsatz_zwischen)
|
|
||||||
if anzahl % modular == 0:
|
|
||||||
einsatz_fest[1] = einsatz_fest[1] - 150
|
|
||||||
einsatz_zwischen = einsatz_fest.copy()
|
|
||||||
else:
|
|
||||||
einsatz_zwischen[0] = einsatz_zwischen[0]+ 300
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if anzahl % modular != 0:
|
|
||||||
einsatz_fest[1] = einsatz_fest[1] - 150
|
|
||||||
einsatz_zwischen = einsatz_fest.copy()
|
|
||||||
anzahl =0
|
|
||||||
while anzahl < scanner:
|
|
||||||
anzahl = anzahl + 1
|
|
||||||
msp.add_blockref(block_scanner,einsatz_zwischen)
|
|
||||||
if anzahl % modular == 0:
|
|
||||||
einsatz_fest[1] = einsatz_fest[1] - 150
|
|
||||||
einsatz_zwischen = einsatz_fest.copy()
|
|
||||||
else:
|
|
||||||
einsatz_zwischen[0] = einsatz_zwischen[0]+ 300
|
|
||||||
# Umstellung der Höhen falls nötig für die Konsistenz der spätere Erstellung, ist nur notwendig für ab Vario Förderer
|
# 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:
|
if upper_hoehe_vario< lower_hoehe_vario:
|
||||||
hight = upper_hoehe_vario
|
hight = upper_hoehe_vario
|
||||||
@@ -1274,20 +1283,13 @@ def handle_ils_2_0_variofoerderer(msp, teileid, merkmale, x, y, doc, lib_doc, ve
|
|||||||
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
msp.add_blockref(blockname,(x,y,hoehe_vario),dxfattribs={"rotation": rotation})
|
||||||
|
|
||||||
def handle_ils_2_0_kurve_angetrieben(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config,config_allgemein):
|
def handle_ils_2_0_kurve_angetrieben(msp, teileid, merkmale, x, y, doc, lib_doc, verbose, symbols, strecken_nachbarn,config,config_allgemein):
|
||||||
kurvenrichtung = merkmale.get("Kurvenrichtung")
|
voerder_kurve = Angetriebene_Kurve.from_merkmale(teileid,x,y,merkmale)
|
||||||
kurvenwinkel = int(merkmale.get("Kurvenwinkel"))
|
kurvenwinkel = voerder_kurve.winkel
|
||||||
h0 = float(merkmale.get("Höhe Anfang"))* 1000
|
h_zwischen = voerder_kurve.hight_zwischen
|
||||||
h1 = float(merkmale.get("Höhe Ende")) * 1000
|
antriebNebenStrecke = voerder_kurve.antrieb
|
||||||
h_zwischen = (h0 +h1)/2
|
kurvenrichtung = voerder_kurve.kurvenrichtung
|
||||||
antriebNebenStrecke = merkmale.get("AntriebNebenStrecke")
|
rotation = voerder_kurve.drehung
|
||||||
if antriebNebenStrecke == "Aussen":
|
blockname = (f"Vario_Kurve_{kurvenrichtung}_{kurvenwinkel}°_TEF_{antriebNebenStrecke}")
|
||||||
antriebstecke = "außen"
|
|
||||||
else:
|
|
||||||
antriebstecke = "innen"
|
|
||||||
|
|
||||||
|
|
||||||
rotation = float(merkmale.get("Drehung"))
|
|
||||||
blockname = (f"Vario_Kurve_{kurvenrichtung}_{kurvenwinkel}°_TEF_{antriebstecke}")
|
|
||||||
import_block(blockname,lib_doc,doc)
|
import_block(blockname,lib_doc,doc)
|
||||||
msp.add_blockref(blockname,(x,y,h_zwischen),dxfattribs={"rotation": rotation})
|
msp.add_blockref(blockname,(x,y,h_zwischen),dxfattribs={"rotation": rotation})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user