Layer 0 in config aufgenommen. Dort waren die Rahmen, easy.json nicht mehr mit im Versionsverwaltungssystem verwalten. Kann leicht aus easy.dxf gewonnen werden.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
CALL manage_interpreter.bat activate_interpreter
|
||||
python %PROJECT_LIB%\getpositions.py %*
|
||||
python PROJECT_LIB%\getpositions.py %*
|
||||
CALL manage_interpreter.bat deactivate_interpreter
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@echo off
|
||||
CALL manage_interpreter.bat activate_interpreter
|
||||
python -m cProfile -o file.prof %PROJECT_LIB%\routing.py %*
|
||||
python %PROJECT_LIB%\routing.py %*
|
||||
CALL manage_interpreter.bat deactivate_interpreter
|
||||
|
||||
+3
-1
@@ -22,8 +22,10 @@ UNTERVERTEILER
|
||||
Busverteiler-Kennzeichnung
|
||||
|
||||
[GetPos-Layer_Equipment]
|
||||
0
|
||||
REALE_POSITION_IO
|
||||
0-0-ILS_Eingang
|
||||
0-0_A-Gruppe
|
||||
0-0_A-GRUPPE
|
||||
MOTOR
|
||||
|
||||
|
||||
|
||||
+61
-13
@@ -154,18 +154,66 @@ def copy_layers_into_dxf_by_filter(dxf_source: ezdxf.document.Drawing, dxf_targe
|
||||
msp_target = dxf_target.modelspace()
|
||||
|
||||
|
||||
subdist_layers = list(config.items('GetPos-Layer_Distributors'))
|
||||
rack_layers = list(config.items('GetPos-Layer_Racks'))
|
||||
equipment_layers = list(config.items('GetPos-Layer_Equipment'))
|
||||
tunnel_layers = list(config.items('GetPos-Layer_Tunnel'))
|
||||
subdist_layers = set(config.options('GetPos-Layer_Distributors'))
|
||||
rack_layers = set(config.options('GetPos-Layer_Racks'))
|
||||
equipment_layers = set(config.options('GetPos-Layer_Equipment'))
|
||||
tunnel_layers = set(config.options('GetPos-Layer_Tunnel'))
|
||||
|
||||
layernames = list()
|
||||
layernames.extend(subdist_layers)
|
||||
layernames.extend(rack_layers)
|
||||
layernames.extend(equipment_layers)
|
||||
layernames.extend(tunnel_layers)
|
||||
layernames = set()
|
||||
layernames.update(subdist_layers)
|
||||
layernames.update(rack_layers)
|
||||
layernames.update(equipment_layers)
|
||||
layernames.update(tunnel_layers)
|
||||
|
||||
for (layername,v) in layernames:
|
||||
# # welche Texte existieren
|
||||
# for layername in layernames:
|
||||
# selectstr = f'MTEXT[layer=="{layername}"]'
|
||||
# for text in msp_source.query(selectstr):
|
||||
# inhalt = text.dxf.text
|
||||
# position = text.dxf.insert
|
||||
# print(f"Text: '{inhalt}' an Position: {position} auf Layer: {layername}")
|
||||
# text_entity = text.copy()
|
||||
# msp_target.add_entity(text_entity)
|
||||
|
||||
layer_names_inside = dxf_source.layers
|
||||
alle_block_defs = set(dxf_source.blocks.block_names())
|
||||
verwendete = {insert.dxf.name for insert in msp_source.query("INSERT")}
|
||||
|
||||
# 1. Textstyles kopieren
|
||||
for style in dxf_source.styles:
|
||||
if style.dxf.name not in dxf_target.styles:
|
||||
dxf_target.styles.new(name=style.dxf.name)
|
||||
|
||||
# 2. Bestimmte alle Blockdefinitionen
|
||||
used_block_names = set()
|
||||
for insert in msp_source.query("INSERT"):
|
||||
block_name = insert.dxf.name
|
||||
used_block_names.add(block_name)
|
||||
# print(f"Blockname: {block_name} | Layer: {insert.dxf.layer} | Position: {insert.dxf.insert}")
|
||||
|
||||
# block = dxf_source.blocks.get(block_name)
|
||||
# print(f"Inhalte von Block '{block_name}':")
|
||||
# for entity in block:
|
||||
# print(f" Typ: {entity.dxftype()}, Layer: {entity.dxf.layer}")
|
||||
# for attrib in insert.attribs:
|
||||
# if len(insert.attribs) == 0:
|
||||
# continue # Überspringe Blöcke ohne Attribute
|
||||
# print(f"Attribut Name: {attrib.dxf.tag}, Wert: {attrib.dxf.text}")
|
||||
# has_mtext = any(e.dxftype() == "MTEXT" for e in block)
|
||||
# if has_mtext:
|
||||
# print(f"Block '{block_name}' enthält MTEXT:")
|
||||
|
||||
# 3. Blockdefinitionen kopieren
|
||||
for block_name in used_block_names:
|
||||
if block_name not in dxf_target.blocks:
|
||||
block = dxf_source.blocks.get(block_name)
|
||||
new_block = dxf_target.blocks.new(name=block_name)
|
||||
new_block.block.dxf.base_point = block.block.dxf.base_point
|
||||
for e in block:
|
||||
new_block.add_entity(e.copy())
|
||||
|
||||
# 4. Filter-Layernamen bestimmen
|
||||
for layername in layernames:
|
||||
if layername not in dxf_source.layers:
|
||||
continue
|
||||
# Falls der Layer noch nicht im Zieldokument existiert, neu anlegen
|
||||
@@ -177,13 +225,13 @@ def copy_layers_into_dxf_by_filter(dxf_source: ezdxf.document.Drawing, dxf_targe
|
||||
linetype=quelle_layer.dxf.linetype,
|
||||
lineweight=quelle_layer.dxf.lineweight
|
||||
)
|
||||
|
||||
|
||||
# Alle Entities auf diesem Layer kopieren
|
||||
for entity in msp_source.query(f"*[layer=='{layername}']"):
|
||||
entities = msp_source.query(f"*[layer=='{layername}']")
|
||||
for entity in entities:
|
||||
msp_target.add_entity(entity.copy())
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser(description='draws a dxf file with the given cable coordinates', prog='drawdxf')
|
||||
parser.add_argument('-f', '--filename', action='store', required=True, help='this json file contains all cables and its coordinates which should be drawn. Saved with an unique timestamp', metavar='myfile.json')
|
||||
|
||||
+9
-7
@@ -50,22 +50,24 @@ def get_input_positions(msp: ezdxf.document.Drawing.modelspace):
|
||||
id = ""
|
||||
ld = dict()
|
||||
for attrib in insert.attribs:
|
||||
attr_tag = attrib.dxf.tag
|
||||
attr_text = attrib.dxf.text
|
||||
if len(insert.attribs) == 0:
|
||||
continue # Überspringe Blöcke ohne Attribute
|
||||
#print(f"Attribut Name: {attrib.dxf.tag}, Wert: {attrib.dxf.text}")
|
||||
ld[attrib.dxf.tag] = attrib.dxf.text
|
||||
if attrib.dxf.tag == "IO":
|
||||
id = attrib.dxf.text
|
||||
ld[attr_tag] = attr_text
|
||||
if attr_tag == "IO":
|
||||
id = attr_text
|
||||
#print(f"-- coord io {id}--: {attrib.dxf.insert}") # position des Blocks
|
||||
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 attrib.dxf.tag == "B":
|
||||
if attr_tag == "B":
|
||||
for spec in SpecialKeys:
|
||||
if spec in attrib.dxf.text:
|
||||
id = attrib.dxf.text
|
||||
if spec in attr_text:
|
||||
id = attr_text
|
||||
#print(f"-- coord {attrib.dxf.text} --: {attrib.dxf.insert}")
|
||||
if attrib.dxf.tag == "REALE_POSITION" and attrib.dxf.text == "x":
|
||||
if attr_tag == "REALE_POSITION" and attr_text == "x":
|
||||
#print(f"-- coord real --: {attrib.dxf.insert}")
|
||||
pos = attrib.dxf.insert #Position Ecke unten links von "x"-Marker auslesen
|
||||
|
||||
|
||||
-178
@@ -1,178 +0,0 @@
|
||||
{
|
||||
"sensors": {
|
||||
"BG3241": {
|
||||
"IO": "BG3241",
|
||||
"pos": [
|
||||
38.8,
|
||||
1280.2
|
||||
],
|
||||
"ID": "",
|
||||
"VERW": "Jam detector",
|
||||
"BEZEICHNUNG": "Stausensor 1 (ILS-CV M0108)",
|
||||
"KENNZEICHNUNG": "=A01+UC0101-KF1DI1",
|
||||
"TEXT-E": "",
|
||||
"TEXT-ES": "",
|
||||
"TEXT-F": "",
|
||||
"SPS": "1",
|
||||
"REALE_POSITION": "x"
|
||||
},
|
||||
"BG3240": {
|
||||
"IO": "BG3240",
|
||||
"pos": [
|
||||
4961.9,
|
||||
5609.0
|
||||
],
|
||||
"ID": "",
|
||||
"VERW": "Jam detector",
|
||||
"BEZEICHNUNG": "Stausensor 1 (ILS-CV M0108)",
|
||||
"KENNZEICHNUNG": "=A01+UC0101-KF1DI1",
|
||||
"TEXT-E": "conveyor full",
|
||||
"TEXT-ES": "",
|
||||
"TEXT-F": "",
|
||||
"SPS": "1",
|
||||
"REALE_POSITION": "x"
|
||||
},
|
||||
"MA0062": {
|
||||
"IO": "MA0062",
|
||||
"pos": [
|
||||
4967.0,
|
||||
8072.5
|
||||
],
|
||||
"ID": "",
|
||||
"VERW": "CV-M0062_0,75",
|
||||
"BEZEICHNUNG": "Motor MA0062",
|
||||
"KENNZEICHNUNG": "=A01+UH01-KF1DQ04",
|
||||
"TEXT-E": "Motor MA0062",
|
||||
"TEXT-ES": "",
|
||||
"TEXT-F": "",
|
||||
"SPS": "1",
|
||||
"REALE_POSITION": "x"
|
||||
},
|
||||
"FC0062": {
|
||||
"IO": "FC0062",
|
||||
"pos": [
|
||||
4973.9,
|
||||
8072.5
|
||||
],
|
||||
"ID": "",
|
||||
"VERW": "MS FC0062",
|
||||
"BEZEICHNUNG": "Meldekontakt Motorschutzschalter FC0062",
|
||||
"KENNZEICHNUNG": "=A01+UH01-KF1DI2",
|
||||
"TEXT-E": "Motor protection switch signaling contact FC0062",
|
||||
"TEXT-ES": "",
|
||||
"TEXT-F": "",
|
||||
"SPS": "1",
|
||||
"REALE_POSITION": "x"
|
||||
},
|
||||
"BG3260": {
|
||||
"IO": "BG3260",
|
||||
"pos": [
|
||||
9598.8,
|
||||
12907.4
|
||||
],
|
||||
"ID": "",
|
||||
"VERW": "Jam detector",
|
||||
"BEZEICHNUNG": "Stausensor 1 (ILS-CV M0108)",
|
||||
"KENNZEICHNUNG": "=A01+UC0101-KF1DI1",
|
||||
"TEXT-E": "conveyor full",
|
||||
"TEXT-ES": "",
|
||||
"TEXT-F": "",
|
||||
"SPS": "1",
|
||||
"REALE_POSITION": "x"
|
||||
},
|
||||
"BG3270": {
|
||||
"IO": "BG3270",
|
||||
"pos": [
|
||||
5893.0,
|
||||
12968.1
|
||||
],
|
||||
"ID": "",
|
||||
"VERW": "Jam detector",
|
||||
"BEZEICHNUNG": "Stausensor 1 (ILS-CV M0108)",
|
||||
"KENNZEICHNUNG": "=A01+UC0101-KF1DI1",
|
||||
"TEXT-E": "conveyor full",
|
||||
"TEXT-ES": "",
|
||||
"TEXT-F": "",
|
||||
"SPS": "1",
|
||||
"REALE_POSITION": ""
|
||||
}
|
||||
},
|
||||
"mappings": {
|
||||
"UC0101": [
|
||||
"BG3241",
|
||||
"BG3240",
|
||||
"BG3260",
|
||||
"BG3270"
|
||||
],
|
||||
"UH01": [
|
||||
"MA0062",
|
||||
"FC0062"
|
||||
]
|
||||
},
|
||||
"distributors": {
|
||||
"UC0101": [
|
||||
0.0,
|
||||
4162.8
|
||||
],
|
||||
"UH01": [
|
||||
6719.0,
|
||||
16600.1
|
||||
]
|
||||
},
|
||||
"racks": {
|
||||
"Rack_1": [
|
||||
[
|
||||
4946.5,
|
||||
15774.4
|
||||
],
|
||||
[
|
||||
4946.5,
|
||||
3879.4
|
||||
]
|
||||
],
|
||||
"Rack_2": [
|
||||
[
|
||||
0.1,
|
||||
57.6
|
||||
],
|
||||
[
|
||||
0.1,
|
||||
3777.6
|
||||
],
|
||||
[
|
||||
14755.1,
|
||||
3777.6
|
||||
]
|
||||
],
|
||||
"Rack_3": [
|
||||
[
|
||||
185.1,
|
||||
15865.5
|
||||
],
|
||||
[
|
||||
12450.7,
|
||||
15865.5
|
||||
]
|
||||
],
|
||||
"Rack_4": [
|
||||
[
|
||||
2866.6,
|
||||
15774.4
|
||||
],
|
||||
[
|
||||
2866.6,
|
||||
3880.4
|
||||
]
|
||||
],
|
||||
"Rack_5": [
|
||||
[
|
||||
8866.1,
|
||||
15774.4
|
||||
],
|
||||
[
|
||||
8866.1,
|
||||
3878.4
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user