My issue is that I do not know how to create / modify the BoundValue datatype. Setting the opcItemPath equal a string of the desired path does not work. I have to manually go back into the UDT and apply the change.
There’s not any way to construct bindings in scripts, for any part of Ignition. You would have to instantiate an expression parser with a carefully constructed execution context, and none of the necessary pieces are exposed, not even in the SDK. It is theoretically possible, though. But totally unsupported.
I know its an old thread, but if you were still wondering, I found that (in 8.3) if you import the BoundValue type you can create a new BoundValue and assign it to a tag's opcItemPath property.
eg. if you want to bind a parameter named opcRootPath:
I just looked at this (and Ignition) for the first time in years. It turns out all that was needed was a .getValue() on the parameter. No need for messing with BoundValue.
Here's a script that dynamically goes through a specified path and automatically adds the nested name to the OPC_Item_Path custom parameter.
Going off the initial example, the OPC_Item_Path variable was FV_102.
Now the OPC_Item_Path for FV_102/FullStall will be FV_102.FullStall
# goes through all tags in project and replaces child UDT parameters with the parent values
# if they have the same parameter names
def propogateParamsChildren(pth, layer=0, dParams={}):
browsedPath = system.tag.browseTags(pth)
for itm in browsedPath:
if itm.isFolder():
propogateParamsChildren(itm)
continue
tagConfig = system.tag.getConfiguration(itm)
if tagConfig[0]['tagType'].toString() == 'UdtInstance':
if layer == 0:
dParams = tagConfig[0]['parameters']
propogateParamsChildren(itm, layer+1, dParams)
else:
for k in dParams.keys():
if tagConfig[0]['parameters'].get(k, None) is not None:
if k == 'OPC_Item_Path':
tagConfig[0]['parameters'][k] = dParams[k].getValue() + '.' + tagConfig[0]['name']
else:
tagConfig[0]['parameters'][k] = dParams[k]
system.tag.configure(pth, tagConfig, 'o')
propogateParamsChildren(itm, layer+1, dParams)