Neue Blöcke erfordern Änderungen am Parser
This commit is contained in:
+31
-21
@@ -70,6 +70,37 @@ def get_attributes_of_insert(d_insert: dict, d_pos: dict) -> tuple[dict, str, st
|
||||
ld = d_insert
|
||||
typ = 'unknown'
|
||||
|
||||
# die neueren Bläcke heissen nicht IO, sondern haben einen Namen
|
||||
if "IO" in d_insert:
|
||||
pos = d_pos["IO"]
|
||||
typ = get_type_of_name_cfg(d_insert["IO"])
|
||||
|
||||
if "ARTINR" in d_insert and "SPS" in d_insert:
|
||||
id_ = d_insert["IO"]+"@"+d_insert["SPS"]
|
||||
ld["pos"] = (pos[0], pos[1])
|
||||
|
||||
if "REALE_POSITION" in d_insert and d_insert["REALE_POSITION"] == 'x':
|
||||
pos = d_pos["REALE_POSITION"]
|
||||
|
||||
else:
|
||||
|
||||
id_ = d_insert["IO"]
|
||||
# Sensoren werden später gemerged mit den anderen Blöcken des Rahmens mit A,B,C, usw
|
||||
if "SPS" in d_insert and typ != "Sensor":
|
||||
id_ = id_+"@"+d_insert["SPS"]
|
||||
|
||||
if "REALE_POSITION" in d_insert and d_insert["REALE_POSITION"] == 'x':
|
||||
pos = d_pos["REALE_POSITION"]
|
||||
|
||||
# Hoehe und Breite von "x" addieren, um Mittelpunkt zu finden
|
||||
breite_marker = config.getfloat("GetPos-Geom-Sensor", "Breite")
|
||||
hoehe_marker = config.getfloat("GetPos-Geom-Sensor", "Hoehe")
|
||||
midx = pos[0] + breite_marker * 0.5
|
||||
midy = pos[1] + hoehe_marker * 0.5
|
||||
ld["pos"] = (round(midx, 1), round(midy, 1))
|
||||
else:
|
||||
ld["pos"] = (pos[0], pos[1])
|
||||
|
||||
# die neueren Bläcke heissen nicht IO, sondern haben einen Namen
|
||||
if "NAME" in d_insert:
|
||||
typ = get_type_of_name_cfg(d_insert["NAME"])
|
||||
@@ -77,27 +108,6 @@ def get_attributes_of_insert(d_insert: dict, d_pos: dict) -> tuple[dict, str, st
|
||||
pos = d_pos["NAME"]
|
||||
ld["pos"] = (pos[0], pos[1])
|
||||
|
||||
if "IO" in d_insert:
|
||||
attr_text = d_insert["IO"]
|
||||
typ = get_type_of_name_cfg(attr_text)
|
||||
id_ = d_insert["IO"]
|
||||
# Sensoren werden später gemerged mit den anderen Blöcken des Rahmens mit A,B,C, usw
|
||||
if "SPS" in d_insert and typ != "Sensor":
|
||||
id_ = id_+"@"+d_insert["SPS"]
|
||||
pos = d_pos["IO"]
|
||||
|
||||
if "REALE_POSITION" in d_insert and d_insert["REALE_POSITION"] == 'x':
|
||||
pos = d_pos["REALE_POSITION"]
|
||||
|
||||
# Hoehe und Breite von "x" addieren, um Mittelpunkt zu finden
|
||||
breite_marker = config.getfloat("GetPos-Geom-Sensor", "Breite")
|
||||
hoehe_marker = config.getfloat("GetPos-Geom-Sensor", "Hoehe")
|
||||
midx = pos[0] + breite_marker * 0.5
|
||||
midy = pos[1] + hoehe_marker * 0.5
|
||||
ld["pos"] = (round(midx, 1), round(midy, 1))
|
||||
else:
|
||||
ld["pos"] = (pos[0], pos[1])
|
||||
|
||||
if "B" in d_insert:
|
||||
attr_text = d_insert["B"]
|
||||
typ = get_type_of_name_cfg(attr_text)
|
||||
|
||||
Reference in New Issue
Block a user