I’m looking for advice on how to properly work with UDT Instances in a Vision script.
Here’s the setup:
- UDT Instance of type “Tester” called “Tester_1”
- The window has a custom property “selected_tester” of type Tester
- I bind the UDT Instance tag “Tester_1” -> the “selected_tester” property
- The vision client window has complex scripts that read / write tags in the UDT
What I’m trying to do in the script is reference the UDT Instance elegantly with:
event.source.parent.selected_tester.SN = ‘xxxxx’
Instead of with a parameterized path:
The problem: When I write to the SN tag, the Custom Properties viewer shows the SN value getting assigned to the SN tag, but the associated OPC Tag is not being affected. It’s like the UDT Instance “passed in” to the custom property is a copy of the object - not a reference to the original UDT Instance.
Is there a right way in scripting to work directly with UDT instances as objects? Thanks!