Merge branch 'main' of http://gitea.schoenenberger.de/mistangl/kabellaengen
This commit is contained in:
@@ -25,6 +25,8 @@ Busverteiler-Kennzeichnung
|
|||||||
0-0_Omniflo_UNTERVERTEILER
|
0-0_Omniflo_UNTERVERTEILER
|
||||||
UNTERVERTEILER
|
UNTERVERTEILER
|
||||||
|
|
||||||
|
[Layer_Tunnel]
|
||||||
|
Busverteiler-Kennzeichnung
|
||||||
|
|
||||||
# Maße des zur genauen Bestimmung der Mitte
|
# Maße des zur genauen Bestimmung der Mitte
|
||||||
[Unterverteiler]
|
[Unterverteiler]
|
||||||
|
|||||||
@@ -159,6 +159,36 @@ def get_subdistributor_positions(msp, dist2sensors):
|
|||||||
# print("---")
|
# print("---")
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def get_tunnel_positions(msp):
|
||||||
|
"""hole alle Positionen aller Tunnel Ein und Ausgänge
|
||||||
|
"""
|
||||||
|
allTunnels = dict()
|
||||||
|
tunnel_length = dict()
|
||||||
|
# Alle Text mit "Tunnel" als Inhalt auf Layer "xy"
|
||||||
|
all_layers = config.items('Layer_Tunnel')
|
||||||
|
for (layer,v) in all_layers:
|
||||||
|
selectstr = f'MTEXT[layer=="{layer}"]'
|
||||||
|
for text in msp.query(selectstr):
|
||||||
|
#print(f"Text auf Layer 'Busverteiler-Kennzeichnung': {text.dxf.text}")
|
||||||
|
# match = re.search("Tunnel-", text.dxf.text)
|
||||||
|
# if match:
|
||||||
|
# if tunnelname in allTunnels:
|
||||||
|
# pos = (round(text.dxf.insert[0],1), round(text.dxf.insert[1],1)) #nur x und y Koordinate in Json schreiben
|
||||||
|
txt = text.dxf.text
|
||||||
|
pattern = r"(TUNNEL\d+)-(\d+)"
|
||||||
|
match = re.search(pattern, txt)
|
||||||
|
if match:
|
||||||
|
pos = (round(text.dxf.insert[0],1), round(text.dxf.insert[1],1)) #nur x und y Koordinate in Json schreiben
|
||||||
|
tunnelname = match.group(1)
|
||||||
|
laenge = match.group(2)
|
||||||
|
tunnel_length[tunnelname] = laenge
|
||||||
|
if not tunnelname in allTunnels:
|
||||||
|
allTunnels[tunnelname] = list()
|
||||||
|
allTunnels[tunnelname].append(pos)
|
||||||
|
else:
|
||||||
|
allTunnels[tunnelname].append(pos)
|
||||||
|
allTunnels['length'] = tunnel_length
|
||||||
|
return allTunnels
|
||||||
|
|
||||||
# helper function
|
# helper function
|
||||||
def print_line(e):
|
def print_line(e):
|
||||||
@@ -274,6 +304,12 @@ if __name__ == '__main__':
|
|||||||
output_results['distributors'] = res_dist
|
output_results['distributors'] = res_dist
|
||||||
if args.console:
|
if args.console:
|
||||||
print(to_json(res_dist))
|
print(to_json(res_dist))
|
||||||
|
|
||||||
|
res_tunnel = get_tunnel_positions(msp)
|
||||||
|
output_results['tunnels'] = res_tunnel
|
||||||
|
if args.console:
|
||||||
|
print(to_json(res_tunnel))
|
||||||
|
|
||||||
if args.rack:
|
if args.rack:
|
||||||
res_rac = get_rack_positions(msp)
|
res_rac = get_rack_positions(msp)
|
||||||
output_results['racks'] = res_rac
|
output_results['racks'] = res_rac
|
||||||
|
|||||||
+36128
-21872
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user