01-12-2020 03:22 PM
Hello,
I need to replace class constant via VI Scripting on Block Diagram.
For Controls on FP it is very easy using dedicated method:
For constant there is nothing to get class name that constant points to, I need to get class path to replace it with something new. I expected there will be something in typedef fields but they are empty.
I could use terminal to get default class data but that will not work when constant is inside cluster or arrays:
Another idea was to change to control using:
then do conversions that are required and convert back to constant. But I can not find a way to convert control to constant in VI scripting.
Can Anyone help?
Solved! Go to Solution.
01-13-2020 12:45 AM
Well, you don't need a dedicated method for class constants. The GObject class had a Replace method which takes a path, and this works on constants.
Also, instead of using the Terminal property to get the data type, you can use the Value property, which will work on nested constants.
Depending on how your code works, you might also be able to use the Traverse for GObjects VI and tell it that you want class constants, so that you don't need to check each constant to know if it's a class.
01-13-2020 03:45 AM
Thanks, works as expected!