John Lokanis Posted August 26, 2013 Report Share Posted August 26, 2013 I am trying to automate some housekeeping tasks and have run into a problem. I decided to rename some classes in my project. In several VIs, I place those classes as block diagram constants. I usually display their labels when I do this for readability. Unfortunately, when I rename the class, the labels do not update. (Fixing this would be a nice Idea Exchange feature). So, I decided to write a little scripting VI to go though my BDs and find all objects of type LabVIEWClassConstant and then extract their new class name and use it to change the label. I have done this in the past with front panel controls successfully by using the TypedefPath property to get the class name. So, I traversed the BD and returned an array of LabVIEWClassConstant refs. These were returned as GObjects so I had to cast them to LabVIEWClassConstant type before I can access the TypedefPath property. But when I do this, the value returned from the TypedefPath is empty. I am guessing this is because the cast loses the object's identity and makes it a generic LabVIEWClassConstant. So, now am stuck. Unless I find a way to get the actual class name, I cannot fix the label and must go manually fix it on every BD. I think I am about to add VI Scripting to the realm of regular expressions. In other words, if you have a problem and you decide to solve it using VI Scripting, now you have two problems. thanks for any ideas or pointing out obvious mistakes/misconceptions I may have made... -John Quote Link to comment
Darin Posted August 26, 2013 Report Share Posted August 26, 2013 Regexes and scripting are two of my favorite things. In this case I would use the Terminal.datatype property of the LVClassConstant and pass the value to the GetLVClassInfo.vi found in vi.libUtilityVariantDataType 2 Quote Link to comment
John Lokanis Posted August 26, 2013 Author Report Share Posted August 26, 2013 Thanks! That did it. There are so many helpful things hidden away in vi.lib... Here is my cleanup VI, if anyone else needs to do the same. Class Label Cleanup.vi 1 Quote Link to comment
John Lokanis Posted August 28, 2013 Author Report Share Posted August 28, 2013 Added a new idea to the exchange relating to the issue I was trying to address. Please kudo it! http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Update-LabVIEW-class-controls-and-labels-when-class-is-renamed/idi-p/2538984 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.