D. Ackermann Posted July 15, 2020 Report Share Posted July 15, 2020 Hi I am looking for an efficient way to replace the VIs of a lvlib with another lvlib with the same type of VIs in multiple projects. It should be done without having to do the replace for each single VI, because there are up to 50 public VIs in the lvlib. As an example: A lvlib with these VIs: LibA.lvlib:FuncA.vi LibA.lvlib:FuncB.vi LibA.lvlib:FuncC.vi Is to be repleced in all the code with another lvlib with these VIs: LibB.lvlib:FuncA.vi LibB.lvlib:FuncB.vi LibB.lvlib:FuncC.vi Of course the VIs have the same interfaces. In a text based language, this would be quite simple. How can this be done in LabVIEW Thanks Quote Link to comment
JKSH Posted July 15, 2020 Report Share Posted July 15, 2020 Unfortunately, there is no straightforward way to do this in LabVIEW. I can think of one trick which takes advantage of the LabVIEW Project Explorer: When a library gets renamed or moved, the Project Explorer automatically updates the links in all of the project's VIs. So, Close LabVIEW. Temporarily delete or move LibB away to a completely different folder where it can't be found by LabVIEW. Open your project's .lvproj file. Use the LabVIEW Project Explorer to rename LibA.lvlib to LibB.lvlib, saving it in the folder where the real LibB used to be. This will update all your project VIs' links. Click "Save All" on your project to make the update permanent. Close your project. Delete the fake LibB and all the old LibA VIs. Restore the real LibB. Open your project. It should now pick up LibB instead of LibA. (It might complain that the LibB VIs were not in the expected folder. If it does, just "Save All" again and it will be happy after that) Make sure you back up everything before attempting this; rinse and repeat will all your projects. Caveat: If your project uses LibA in more than 1 Application Instance, LabVIEW will lock the library when you open your project, which blocks you from doing step #4. Quote Link to comment
D. Ackermann Posted July 15, 2020 Author Report Share Posted July 15, 2020 Unfortunately, the libraries are locked with password. Also the libraries are distributed to other users and the way to replace them should not be to complicated. I never looked into VI scripting. Maybe this could be a way to replace all lvlib VIs in a complete project? Quote Link to comment
JKSH Posted July 15, 2020 Report Share Posted July 15, 2020 8 hours ago, D. Ackermann said: I never looked into VI scripting. Maybe this could be a way to replace all lvlib VIs in a complete project? Yes, that can do the job. It will take some time to write the script, however. (I'd set aside a few days if you've never done VI scripting before) Could you simply modify LibA instead of replacing it with a different library with the same interface? Quote Link to comment
D. Ackermann Posted July 17, 2020 Author Report Share Posted July 17, 2020 I will take a look at VI Scripting then. The situation is like this: LibA is out there for years. Now a 2.0 version of LibA called LibB will be created. LibB is doing things quite different internally and depending on other software. Therefore the transition from LibA to LibB requires multiple changes on the systems it is deployed to. A developer with multiple deployed systems will have a transition period where he has to work with LibA and LibB. That is why I don't want to make it LibA 2.0. That would require installing the LibA versions back and forth. With creating LibB they can be installed parallel. Now I am trying to find the best way to upgrade projects from LibA to LibB.. 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.