I will start off and say that I am a novice at scripting, in general. We recently purchased a license for Ignition 8.1 and we have great big plans for it but first, we must crawl before we can run.
With that being said, I have been playing around with the events configuration in a perspective project where I have a blank text field and when I click into it, it executes some script that I wrote. I will paste that in at the end because it is a small amount of code.
I was happy to see that the script did what I was expecting it to do, however I don't know exactly how to deal with the result in this environment. I tried to use the eval() method but it does not like the time and date format that all of the mongdb documents have.
Ultimately I would like to use some of the information that I am pulling from these (FANUC) signals for a performance display board. This signal give us an indication of how much life our cutting tools have left in them and at what time we could expect our CNC machine(s) to stop running due to an expired cutting tool.
I was building something using nodeJS and what seemed to be a basket full of other web development technologies but we were not confident in its sustainability. Additionally we had been eyeing up ignition as a solution to things like this and other SCADA applications.
I'm happy to add information as need for this conversation. I imagine more experienced folk will wonder why I am doing the things I am doing at this point. Any sort of advice or guidance would be greatly appreciated!
Here is the tiny bit of script I put together for this test, it is an "onClick" mouse event
def runAction(self, event):
system.perspective.print("Hello World")
connector = str(system.mongodb.listConnectorInfo())
connector = connector.replace("[", "")
connector = connector.replace("]", "")
res = eval(connector)
for values in res.values():
system.perspective.print(values)
filter = {
"L1Name": "MATS-2101",
"signalname": {"$regex": "PMC_"}
}
documents = system.mongodb.find(res['name'], "L1Signal_Pool_Active", filter)
system.perspective.print(type(documents))
system.perspective.print(documents)
The time and date format used by monogodb is highlighted in this screen capture.