10-03-2019 11:38 AM - edited 10-03-2019 11:47 AM
I'm in a world of pain right now trying to migrate classes that do not belong to a library, to a packed library equivalent for multiple projects.
To generate the class PPL, I do the following:
To fix the project where these common classes are used, I do the following
<rant>
It's taking a whole day to do one project due to LabVIEW's woefully inadequate 'Replace with packed library' feature refusing to update many items after multiple attempts. No errors or feedback to the user, just 'Nope, not doing it' and silently failing. For the failed items I have no choice but to manually replace each vi, ctl etc. with the packed equivalent which is extremely time consuming and error prone.
It's also taking a long time (over a minute in some cases) when adding the class to a library or switching it to a PPL as it goes away and silently updates links without any useful feedback to the user (the spinning loading cursor does not count). This also hangs the UI and generates the not responding prompt sometimes. Right clicking on an item in the project to bring up the context menu can also cause LV to hang indefinitely (I've left it over 10 minutes to see if it would ever complete).
The more items I try to do in one hit the slower it will obviously go, but then at the other end I have to add the classes to libraries more times. I.e. In theory I could load up all of the projects in one super project and do all of the actions once, but LabVIEW would probably crash.
There has to be a more efficient workflow compared to the one I'm using for achieving this from my starting point? If you have any helpful ideas, I would be extremely grateful if you could share them.
The sooner I can get rid of this software, the better... </rant>
10-03-2019 11:42 AM - edited 10-03-2019 12:00 PM
Slightly related: Are there any built-in tools that allow a class/library/llb etc. to be completely swapped out for another instance including all VIs, type defs etc. that match the names of the target class (omiting the container name) project-wide (including dependencies) and semi-automatically?
Original item Class 1.lvclass
Target item: Library 1.lvlib:Class 8.lvclass
In this example I would expect the following
Class 1.lvclass:Method 1.vi → Library 1.lvlib.Class 8.lvclass:Method 1.vi
Class 1.lvclass:Type def 1.ctl → Library 1.lvlib.Class 8.lvclass:Type def 1.ctl
Class 1.lvclass:Method 2.vi → No action
10-03-2019 11:56 AM
@matt.baker wrote:
Slightly related: Are there any built-in tools that allow a class/library/llb etc. to be completely swapped out for another instance including all VIs, type defs etc. that match the names of the target class (omiting the container name) project-wide (including dependencies) and semi-automatically?
Built-in -> no-ish?
This link might be useful to you (although it doesn't exactly solve your problem - it instead carries out the "Replace with Packed Library" but programmatically): Unit-Testing-a-built-PPL
From there, you could perhaps look at scripting a more complex tool that carries out some of your steps.
When I've had need to do what you're doing, I usually do it in far fewer steps, but I also by the sounds of it have far fewer projects!
For me, it becomes something like (and I haven't taken notes, so apologies if this is impossibly inaccurate):
So I'd say if you have a lot of projects and a lot of intended PPLs, the scripting might be worthwhile!
10-03-2019 12:11 PM - edited 10-03-2019 12:29 PM
Thanks for the suggestion!
I'll give the rename/delete a try, but as you said it probably wont work (I think I already tried this and it failed spectacularly, but will double check).
The projects load in about 2000 items with most of them from custom common libraries/classes (~140 libraries total to be PPL'd I think) so fixing the missing items is unmanageable without some kind of automation.
There are approx. 10 active projects and around 40 in total that may need updating at some point, all using the same libraries.
I did think about the scripting option, but then started thinking by the time I've created something suitable/semi-reliable, would it have been just as quick to do it manually (although I might have had a breakdown by then haha). May have to go down this road though.
Thanks again
10-03-2019 12:50 PM
It could make it worse...
Tools >>> Advanced >>> Clear Compiled Object Cache
May help if LV is looking at the cache instead of your desired changes.
But if does not work, it could introduce even more delay.
Ben
10-03-2019 02:11 PM
Thanks Ben. That's a very good point.
I did try that previously and it did appear to correct some of the links the next time I opened the project. It took a while recompiling everything on access, but got there eventually.
I've just tried deleting the non PPL libraries and relinking the files and it worked better than expected.
Keep finding more broken features in LabVIEW IDE: Unable to right click on broken type def (contained missing classes) and select Open type def as it's greyed out.
Almost finished one whole project now which I need back up and running asap (could always revert, but want PPLs in next release).
10-03-2019 02:46 PM - edited 10-03-2019 02:47 PM
@matt.baker wrote:
3. Replace with packed library.
4. Lose the will to live when LabVIEW decides to only replace some of the occurrences with the new PPL version.
Okay, I'll take some of that back and blame myself for this . I renamed a few classes before packing them which meant that LV couldn't resolve them. The lvlib can be any name, but the parts inside must remain the same. Would have been helpful if LV had given some sort of warning/message to explain why though, instead of silently failing.
10-03-2019 03:50 PM
In our environment we have approximately 170 PPLs with a hierarchy 11 levels deeps. First, I highly recommend that you use MGI's solution explorer to aid in the build process. Depending on changes made, you may need to rebuild quite a few PPLs if something changes.
Anyway, what we end up with lots of projects. We start at the lowest level PPLs, those that are not dependent on any other PPLs, and build them first. We generally call this "Level 0". With solution explorer to you can build solutions of solutions which means you can define the build order of your PPLs. Once all of the Level 0 PPLs are build, move to the next level. Level 1 will be PPLs that will use any number of Level 0 PPLs. Within these projects you begin to use the "Replace with PPL" to now include your PPLs. Do this for all of the Level 1 libraries. Move to the next layer and repeat the process.
We will have a solution file for each PPL. We will also have a solution file for each Level. Finally we have a solution file containing all of the levels, building them from the bottom up. When defining "levels", it means that any PPLs at level "x", can only include PPls from levels "x-1" and below.
It can be a tedious process to do the conversion, but once done it works fairly well. When I am in the transition phase, I duplicate the original source to a new folder location and then do the conversion there. It makes life easier.
See our presentation from NI Week regarding effectively using PPls.
10-04-2019 11:34 AM
Thanks for the detailed reply, Mark! Some excellent info which I'll be sure to use.
I came across your presentation yesterday morning, from a post in another thread about PPLs, but haven't had a chance to watch it yet. I'll go and have a watch of this now and digest the info - I've skim read through the presentation slides which were useful.
I think my maximum PPL hierarchy depth is currently about 6-7. Build automation will definitely be the best solution.
07-02-2020 10:23 AM - edited 07-02-2020 10:25 AM
After much frustration I managed to build a semi-working 'Find and Replace' tool that allows the user to specify a project, have it search through all items in the project (purposely excluding dependencies), open each compatible type, perform multiple regex searches/matches on all the VIs/type defs/classes etc. (including if they are nested in non-typedef containers) and then replace it with another specified type based on regex style lookup list.
Will hopefully be able to release this at some point when it's a bit more user friendly and dependencies are sorted.
Saves so much time when updating projects and libraries with new dependencies.