11-21-2012 02:35 AM - edited 11-21-2012 02:38 AM
I use LabVIEW 2009 Service Pack 1.
SubVIs are referenced by absolute paths, so when I move them to a new folder I may need to set their paths again.
How can I make a SubVI reference a relative path so that I don't have to set its path after moving VIs to a new folder or a new drive?
Solved! Go to Solution.
11-21-2012 03:02 AM
You can use the static vi reference or if you have a defined folder structure you can always refer from the vi where you are giving the path and strip and build accordingly.
11-21-2012 03:22 AM
I believe that SubVIs are internally referenced by relative paths. Once you move the entire project to a new place, it should find everything in the new relative paths.
Where did you encounter any problems?
11-21-2012 03:34 AM
@altenbach wrote:
[...]Where did you encounter any problems?
From my experience, most of those problems occur when moving VI files directly on disk (Windows File Explorer) individually.
@Op:
Altenbach brought up a good point: When moving/copying the project, take care that all project related sources are within a single project folder. Move/copy the whole project folder, keeping its internal setup. In most cases, that is doing fine.
When moving individual files (VIs), make sure that you use the LV Project Explorer to do so. Add all files used in the project into a single lvproj and then swap to the "Files" tab. Rightclick the individual VI you want to move and select "Move on Disk" from the context menu. This will auto-update all (known) callers as well.
hope this helps,
Norbert
11-21-2012 03:40 AM
SInce he said he wanted to specify relative paths, I assumed that he kept the relative hierarchy intact so there should not be anything else needed. Who knows? 😄
11-21-2012 07:08 PM - edited 11-21-2012 07:10 PM
My boss told me there had been dialogs that prompted for SubVI paths after moving the entire folder to another location by Windows Explorer.
There had been such dialogs according to my boss, but I have to investigate to know if it is true.
11-21-2012 10:04 PM
Those dialog box will come only when you are calling the vi directly by creating an instance but when you are calling the vi by using its absolute path (Dynamicall) you won't get any.
11-21-2012 10:11 PM - edited 11-21-2012 10:11 PM
What do you mean by "Those dialog box will come only when you are calling the vi directly by creating an instance"?
By creating an instace of what?
11-21-2012 10:19 PM
In a block diagram when you pull a sub vi into a main vi that is called the Instance of the sub vi. So when you replace the sub vi in some other place and when you open the main vi where the sub vi is called it will search for the vi since it is not found in its original place it will give you a dialog box to select the missing sub vi and then you can browse to the other location where you have kept the sub vi.
@iCat wrote:
What do you mean by "Those dialog box will come only when you are calling the vi directly by creating an instance"?
By creating an instace of what?
11-21-2012 10:20 PM
If you are calling VIs dynamically using a path, you can make the path relative to the toplevel VI, for example.
We really need to see some code to see what this discussion is all about.