Erdungskabel und Erdungen werden gesucht und ein Kabellayout erzeugt

This commit is contained in:
2025-06-25 11:14:40 +02:00
parent ee9f1b8dae
commit 371fe6241e
5 changed files with 64 additions and 16 deletions
+2
View File
@@ -10,6 +10,7 @@ QM
BG BG
BP BP
BX BX
PO
# Kürzel die im Routing Prozess ignoriert werden sollen, zum Beispiel bauteile innerhalb der Schaltschränke # Kürzel die im Routing Prozess ignoriert werden sollen, zum Beispiel bauteile innerhalb der Schaltschränke
@@ -32,6 +33,7 @@ BG = WD_I
BG-829422026 = WD_I-829422026 BG-829422026 = WD_I-829422026
BG-720002003 = WD_I-720002003 BG-720002003 = WD_I-720002003
BX = WF_B, WD_I BX = WF_B, WD_I
PO = WD_PO
# Anpassung von berechneter kabellänge um Betrag x aufgrund von z.b. an Sensor existierenden Kabelschwänzen # Anpassung von berechneter kabellänge um Betrag x aufgrund von z.b. an Sensor existierenden Kabelschwänzen
+13
View File
@@ -53,6 +53,19 @@ REALE_POSITION_IO
0-0-Omniflo_MOTOR 0-0-Omniflo_MOTOR
0-0_A-GRUPPE 0-0_A-GRUPPE
MOTOR MOTOR
0-0_ILS_POT Pritsche
0-0_ILS_POT-CT
0-0_ILS_POT-DP
0-0_ILS_POT-MA
0-0_ILS_POT-RA
0-0_Omniflo_POT Pritsche
0-0_Omniflo_POT-CT
0-0_Omniflo_POT-DP
0-0_Omniflo_POT-MA
0-0_Omniflo_POT-RA
0-0_Omniflo_AM_POT_FS
0-0_Omniflo_AM_POT_Pritsche
# Maße des zur genauen Bestimmung der Mitte # Maße des zur genauen Bestimmung der Mitte
+14
View File
@@ -91,6 +91,20 @@
85.0=726001060 85.0=726001060
95.0=726001061 95.0=726001061
[WD_PO]
0.25=726001062
0.5=726001040
1.0=726001041
5.0=726001045
10.0=726001046
15.0=726001047
20.0=726001048
25.0=726001049
30.0=726001050
35.0=726001051
40.0=726001052
45.0=726001053
100.0=726001049
# Bezeichner jeder Verbindungsleitung (gekürzt) # Bezeichner jeder Verbindungsleitung (gekürzt)
# Name of every cable (shortened) # Name of every cable (shortened)
+1 -1
View File
@@ -609,7 +609,7 @@ def map_sensor_to_cable_cfg(plines):
mapping = config_BMK["Cable-Mapping"] mapping = config_BMK["Cable-Mapping"]
for pl in plines.kabel: for pl in plines.kabel:
sensor_name = pl.id.split('-')[-1] sensor_name = '-'.join(pl.id.split('-')[1:])
cable_length = round(pl.length/1000, 1) cable_length = round(pl.length/1000, 1)
sensor_artinr = pl.s_artinr sensor_artinr = pl.s_artinr
name_prefix = sensor_name[:2] name_prefix = sensor_name[:2]
+34 -15
View File
@@ -1,16 +1,13 @@
import argparse import argparse
import configparser import configparser
import ezdxf.document import ezdxf
from ezdxf import readfile
import os import os
import sys import sys
import json import json
import re import re
from shapely import Point
from itertools import combinations
from ezdxf.addons import iterdxf from ezdxf.addons import iterdxf
import re import re
import time from pathlib import Path
""" """
@@ -97,6 +94,11 @@ def get_attributes_of_insert(insert):
#print(f"Attribut Name: {attrib.dxf.tag}, Wert: {attrib.dxf.text}") #print(f"Attribut Name: {attrib.dxf.tag}, Wert: {attrib.dxf.text}")
ld[attr_tag] = attr_text ld[attr_tag] = attr_text
if attr_tag == "NAME": # die neueren Bläcke heissen nicht IO, sondern haben einen Namen
typ = get_type_of_name_cfg(attr_text)
id = attr_text
# pos = attrib.dxf.insert #Position aufzeichnen und bei Bedarf später mit REAL_POS überschreiben
# ld["pos"] = (round(pos.x, 1), round(pos.y, 1))
if attr_tag == "IO": if attr_tag == "IO":
typ = get_type_of_name_cfg(attr_text) typ = get_type_of_name_cfg(attr_text)
id = attr_text id = attr_text
@@ -389,11 +391,12 @@ def get_dxf_file(filepath):
sys.exit(2) sys.exit(2)
return doc return doc
def check_file_in_work(work_dir, filename): def check_file_in_work(work_dir:Path, filename:Path):
fexists = True fexists = True
if not os.path.exists(filename): if not filename.exists(): # dann schau im Work Ordner nach
mypath = os.path.join(work_dir, filename) mypath = work_dir.joinpath(filename)
if not os.path.exists(mypath): ex = mypath.exists()
if not mypath.exists():
fexists = False fexists = False
else: else:
mypath = filename mypath = filename
@@ -455,6 +458,14 @@ def validate_configs():
else: else:
print ("No inconsistencies found") print ("No inconsistencies found")
def check_environment_var(env_str:str) -> Path:
out_path = os.environ.get(env_str)
if out_path:
return Path(out_path)
else:
print(f"Umgebungsvariable {env_str} ist nicht gesetzt oder leer.")
exit()
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(description='fetches the x/y positions from a dxf file', prog='getpositions') parser = argparse.ArgumentParser(description='fetches the x/y positions from a dxf file', prog='getpositions')
@@ -467,13 +478,21 @@ if __name__ == '__main__':
args = parser.parse_args() args = parser.parse_args()
out_dir = os.environ.get('PROJECT_DATA') out_dir = check_environment_var('PROJECT_DATA')
work_dir = os.environ.get('PROJECT_WORK') work_dir = check_environment_var('PROJECT_WORK')
config_dir = os.environ.get("PROJECT_CFG") config_dir = check_environment_var("PROJECT_CFG")
filename = args.filename
(dxf_path, dexists) = check_file_in_work(work_dir, filename)
filename = Path(args.filename)
if not filename.suffix == ".dxf":
print("only available for .dxf files")
exit()
(dxf_path, dexists) = check_file_in_work(work_dir, filename)
if dexists == False:
print("no such file ")
parser.print_help()
exit()
if dxf_is_binary(dxf_path): # Wenn dxf eine binary ist, dann komplett parsen und modelspace anlegen if dxf_is_binary(dxf_path): # Wenn dxf eine binary ist, dann komplett parsen und modelspace anlegen
print("Given .dxf-file is binary dxf. Proceeding to read file. Watch RAM-usage.") print("Given .dxf-file is binary dxf. Proceeding to read file. Watch RAM-usage.")
doc = get_dxf_file(dxf_path) doc = get_dxf_file(dxf_path)