LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Moving files belonging to multiple projects

Solved!
Go to solution

The task is probably simple (at least each of us encounters it quite often). However, I cannot find any simple routine to solve it.

There are multiple projects using the same bunch of common files (VI-s, CTL-s, Classes, LLB-s). But these common files are located in hard disk under one of these projects. Such bad file structures usually have historical reasons. There is a need to reorganize the file structure; i.e. move common files in logically justified place. This is a simple illustration:

HD.gif

 

Moving files in one project causes inconsistency in all other projects. Is there any way to move files in many projects at once? I.e. is there any way to  move files in HD preserving consistency of many projects?

_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
0 Kudos
Message 1 of 8
(1,597 Views)

Some thoughts:

  1. I'm ignoring the question of whether the new file structure makes sense and whether there are other good options (leave it where it is/move it to vi.lib/have the dependencies in every project, etc.).
  2. Whatever you do, I would suggest starting with making sure you have source code control and make sure everything is in there. Then, make sure to commit each change as a block.
  3. One option is to just move the files and then open the projects and let LV search for the VIs, load them from the new location and save. This can be made somewhat easier and can be helped by adding the path of your new folder to the LV search paths. How well this works probably depends on how unique your file names are and whether you have complex dependencies (classes, XControls, PPLs, etc.)
  4. Another option is to map the old and new paths and then run a VI for each project which does the following:
    1. Make sure you have the current state, where the files are in the original location (for example, by creating a copy or reverting in SCC) and the new location is empty.
    2. For each file in the map, open a reference to it and get its callers, so that you know which VIs you later need to save.
    3. For each file in the map, move or copy it to its new location.
    4. Save all of the VIs you listed in step 2.
    5. Check the links to see that they're OK.
  5. This will allow you to have the relinking done by LV and in theory, you should end up with the same thing each time.
  6. In any case, I would suggest using the Files tab of the project window for each project to make sure you really are getting the VIs from where you want.

___________________
Try to take over the world!
0 Kudos
Message 2 of 8
(1,579 Views)

tst , thank you for the answer.

 

Sorry, I did not write in my first message: the question is related to large projects. Hundreds of files must be moved at once.

 

So, manual methods for preserving project consistency are not convenient. Otherwise I should do exactly as you describe. And I actually tried.

 

Unfortunately, dialog Resolve Load Conflict pops up several times for each moved file. I.e. each moved file causes multiple conflicts. Resolving so many conflicts in several projects is a nightmare.

_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
0 Kudos
Message 3 of 8
(1,524 Views)

If it is just one (or a few) folders, you can try the following steps (make a commit to your SCC before doing this, just in case)

1) open a project

2) in the file view, right-click the folder(s) you want to move, select Move on Disk and move it to the destination

3) save the project

4) close the project and move the folder(s) you have just moved back to their original location.

5) repeat step 1-4

6) Once the last project you have, leave the folders in the new location.

 

All projects, once opened should find the new files as, as far as the project knows, they haven't changed locations since the last time the project was opened.

0 Kudos
Message 4 of 8
(1,515 Views)

Thank you Basjong53. Unfortunately this method works only if the projects do not have complicated inter-dependencies. If they have (as in my case), the problem is the same.

 

This is a simple illustration of such a problem:

2proj.gif

 

  1. There are two projects sharing two VIs: VI-1.vi and VI-2.vi.
  2. Project 1 is opened and VI-1.vi is moved to new location.
  3. Changes are saved and the project is closed.
  4. VI-1.vi is moved back.
  5. Project 1 is opened with a conflict: VI-2.vi searches VI-1.vi in the new location while VI-4.vi loads it from the old location.
_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
0 Kudos
Message 5 of 8
(1,492 Views)

Hi _Y_,

 


@_Y_ wrote:

This is a simple illustration of such a problem:

 

  1. There are two projects sharing two VIs: VI-1.vi and VI-2.vi.
  2. Project 1 is opened and VI-1.vi is moved to new location.
  3. Changes are saved and the project is closed.
  4. VI-1.vi is moved back.
  5. Project 1 is opened with a conflict: VI-2.vi searches VI-1.vi in the new location while VI-4.vi loads it from the old location.

Why do you do step 4? This is what creates the conflict!

 

When you omit step 4 and open Project2 then it should load VI4 because VI2 knows the location of VI1…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(1,488 Views)

 , It was my comment to previous suggestion with oversimplified example. The main practical problem is in hundreds (if not thousandths) Resolve Load Conflict pop-ups asking to select between existing and non-existing locations.

 
_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
0 Kudos
Message 7 of 8
(1,481 Views)
Solution
Accepted by topic author _Y_

Thank you again for your answers. I found solution that is not perfect but works. It may be useful to others, so I describe it step-by step:

 

How to move files belonging to multiple projects

 

  1. Open one of the projects. The project must include all files intended to move. If several projects include all files, select the largest one.
  2. Create a LVLIB in this project in the old location. Let’s call it old LVLIB. Add all moved files to this LVLIB. Save all.
  3. Copy the LVLIB and all its content in new location using new name for the LVLIB. It will be new LVLIB.
  4. Switch to new LVLIB using pop-up menu Replace with… of the old LVLIB.
  5. Save all. Attention! All VIs and CTLs calling the LVLIB must be saved!
  6. Remove the old LVLIB from the project.
  7. Check: the old LVLIB must not stay in Dependencies of the project. If so, resolve remaining dependencies manually.
  8. Open next project. It shall find all old files and the old LVLIB. Repeat steps 4..7 for this project.
  9. Repeat step 8 for all remaining projects.
  10. Remove the old LVLIB and all its contain committing the changes to SCC server (if you use it, of course). I shall recommend to keep the new LVLIB but the decision depends on particular needs.

 

Unfortunately, Replace with… does not work perfectly for me (LabVIEW 2021 32-bit). Some typedefs remain pointing to the old LVLIB. These typedefs must be resolved manually (see step 7). However, this method prevents multiple pop-ups of Resolve Load Conflict dialog. In my case it saved 80-90% of work time.

_____________________________________
www.azinterface.net - Interface-based multiple inheritance for LabVIEW OOP
0 Kudos
Message 8 of 8
(1,429 Views)