I am trying to pass some information to an EasyChart in another window. I’ve read a bunch of topics and manual entries and have created the following code to pass the info to the next window.
# Initialize variables
penNames = []
penPaths = []
#Configure graph pen historical tags
#Provider will be the same for all historical tags
tagPathSP = event.source.parent.PIDTagInstance.Meta.TagPath + "/SP"
tagPathStr = tagPathSP + ".HistoryProvider"
provider = system.tag.readBlocking([tagPathStr])[0].value
penPathSP = tagPathSP.replace("default", provider, 1)
penPaths.append(penPathSP)
penNameSP = 'SP'
penNames.append(penNameSP)
print penNameSP
tagPathPV = event.source.parent.PIDTagInstance.Meta.TagPath + "/PV"
penPathPV = tagPathPV.replace("default", provider, 1)
penPaths.append(penPathPV)
penNamePV = 'PV'
penNames.append(penNamePV)
print penNamePV
tagPathM1 = event.source.parent.M1TagInstance.Meta.TagPath + "/OutputSpeed"
penPathM1 = tagPathM1.replace("default", provider, 1)
penPaths.append(penPathM1)
penNameM1 = event.source.parent.M1TagInstance.MotorNum
penNames.append(penNameM1)
print penNameM1
tagPathM2 = event.source.parent.M2TagInstance.Meta.TagPath + "/OutputSpeed"
penPathM2 = tagPathM2.replace("default", provider, 1)
penPaths.append(penPathM2)
penNameM2 = event.source.parent.M2TagInstance.MotorNum
penNames.append(penNameM2)
print penNameM2
maxRange = event.source.parent.ChartMaxY
minRange = event.source.parent.ChartMinY
title = event.source.parent.TitleText
for item in penNames:
print str(item)
#Set parameters for the next window
#params = {"PenPath1": penPathSP, "PenPath2": penPathPV, "PenPath3":penPathM1, "PenPath4": penPathM2, "MaxRange": maxRange, "MinRange": minRange, "WindowTitle": title}
params = {"PenNames": penNames, "PenPaths": penPaths, "MaxRange": maxRange, "MinRange": minRange, "WindowTitle": title}
#Close current window
window_path = system.nav.getCurrentWindow()
system.nav.closeWindow(window_path)
#Open new window with these parameters
system.nav.swapTo('Trends\TrendGraph', params)
I then have some code in the “visionWindowOpened event to show what was received as array parameters. The code looks like this.
root_container = system.gui.getParentWindow(event).getComponentForPath("Root Container")
received_array = root_container.PenNames
print str(received_array)
for item in received_array:
print str(item)
This is what I get from the the Diagnostics Console when I invoke the window change.
I see each individual string with the correct data. I also see the array in the original window with the correct data. When it gets to the second window, the string array looks like it is a bunch of individual ASCII values as an array, not a string array.
I’m sure I’m missing something simple since I’ve seen this topic from back in 2019 where this worked after a bug fix. Please help me with this if you can.
