I am trying to connect to a opc device case code printer. I connected to it as an opcua device. In scripting, when trying to invoke methods (that i can see as tags when I browse the device), I get weird arrays of data that is illegible. I think I need to be using system.opcua.callMethod but i get the error that there is no module named opcua. system.opcua.callMethod - Ignition User Manual 8.0 - Ignition Documentation
Someone else with more knowledge will have to chime in but system.opc is a different library from system.opcua. Maybe it's a different module you need. Not sure. But based on your error code that seems to be the issue, you're missing the necessary module.
Yes, agreed. I am confused because as posted earlier there is documentation for using system.opcua in v8.1 but it does not specify that it has to be imported or how to do so. I am pretty sure system.opcua.callMethod() is the ticket to make this work.
You cannot call this function from the designer script console. It is available in gateway scope only. (And Perspective, which is an extension of gateway scope.)
(Use a gateway message handler to call the function. In the designer, use system.util.sendRequest() to invoke it.)
How can I test this and see the outputs or values returned from the specified methods if not in script console? It seems like its working but I cannot see the data being returned. I tried to create a string memory tag to write to but the "Length of values does not match length of paths."
Write your test code as a function in your project script library. Have it return the desired information. Call it from the gateway message handler, and have the handler end by returning what it got from your library function.
Then, in the script console, you will get that as the return from system.util.sendRequest().