LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting a project to use a project library

Solved!
Go to solution

Hi.

 

I am trying to convert a large main VI with lots of SubVI to a a project that would instead use a project library. In particular, I want to pack all or almost all my SubVIs into a project library (so that I can later reuse these subVIs for different projects) and the main VI would use this library. I hope I get the idea of project libraries correctly.

 

Now, I figured I will pack all my subVIs into a project library and save it as ProjectLib, then I will create a new project with my main VI and add ProjectLib to that project.

 

Here is my ProjectLib, with virtual folders for subVIs and Utils (Utils are just more generic subVIs)

Capture.PNG

 

and here is my main VI project, with the above project library added:

Capture2.PNG

 

 

Now, I am pretty sure that I am doing this wrong, but I cannot figure out what would be the correct way to go about this, despite reading and re-reading LabView Help articles on the matter (such as this: https://www.ni.com/docs/en-US/bundle/labview/page/using-libraries-in-labview-projects.html). Nowhere can I find a step-by-step guide to converting my existing VI with lots of subVIs to this structure.

 

For example, when I open my main VI now, I see errors caused by all the subVIs missing. My thought would be that I could now tell my main VI: "look, here is a ProjectLib I included, see? Take this subVI from there!" but I cannot see an option for doing this.

 

I would appreciate any ellucidation on how to correctly do what I am trying to do. I appologize in advance for any obtuseness on my part.


Thanks in advance.

0 Kudos
Message 1 of 8
(3,311 Views)
Solution
Accepted by topic author SenSLabs

Hello SenSLabs,

 

It appears that you are attempting to add a project (lvproj) to another project, rather than building a library (lvlib or lvlibp) and adding that to the new project.  The simplest way to build a standard .lvlib is described here:

 

LabVIEW Help: Creating a Project Library from a Project Folder

https://www.ni.com/docs/en-US/bundle/labview/page/creating-a-project-library-from-a-project-folder.h...

 

Once you've built the lvlib (from the old project), add that library to your (new) project and you should be good to go.

 

Regards,

Tom L.
Message 2 of 8
(3,296 Views)

@0utlaw wrote:

Once you've built the lvlib (from the old project), add that library to your (new) project and you should be good to go.



Thanks a lot for your help - I just followed your advise and created two libs and added them to my project. However, all the errors in dependencies are still there:
Capture.PNG
So, as you see, my Utils.lvlib has the VI called Array_WA_MA, but Dependecies still complains about it. If I were to add the file itself manually (not as part of the lvlib), then I would get a Resolve Conflict dialog and could tell LabView that now I want to load this VI from the new path, but here I don't see a way to do this.
Again, your help is very much appreciated!
0 Kudos
Message 3 of 8
(3,290 Views)

Hi SensSLabs,

 

This doesn't appear to be a conflict-rather the VI hasn't been located on disk.  What is calling it? MainVI.VI?  If so, launch MainVI from the project and you should be prompted to locate the dependencies.

 

Regards,

Tom L.
0 Kudos
Message 4 of 8
(3,282 Views)

Thanks, Tom!

So, indeed, I had to tell LabView where to get all the dependedncies it could not find. Strangely, LabView had no problem locating some of them on its own, but needed me to point it to many others. I am not sure what was different about those that it did find on its own vs. those that it did not, but, OK, I'll take the result 🙂

Thanks for the help!

0 Kudos
Message 5 of 8
(3,274 Views)

One more question I just remembered: I cannot find what would be the best way to include Matlab scripts into a project library. I have some of the VIs using MathScript nodes, that in turn use Matlab functions saved as .m files. Ideally, I'd love to see those as part of my ProjectLib somehow. Any recommendation for doing this? Maybe I should start a new thread with this...

0 Kudos
Message 6 of 8
(3,268 Views)

Glad that worked- as for why LabVIEW was able to find some files- once you've pointed out a particular directory containing dependencies, the environment will assume that other dependencies may also be located there and will check before prompting you to locate a missing file.

 

As for including the external files- yes, starting a second thread is probably a good idea as it sounds like the original library issue is solved (If it is, you should mark the thread as solved as well!)

 

That being said, you should be fine saving the VIs you mentioned into a library, what you'll need to be careful about is the external file search/load path, which will need to be updated for the calling application context.  This can be set by right-clicking a target in the project (My Computer, for instance) and going to Properties>>MathScript:Search Paths.  I believe there is also a tag that can be used to set these path programmatically, but I don't recall what it is offhand.

 

Regards,

 

Tom L.
Message 7 of 8
(3,259 Views)

@0utlaw wrote:

That being said, you should be fine saving the VIs you mentioned into a library, what you'll need to be careful about is the external file search/load path, which will need to be updated for the calling application context.  This can be set by right-clicking a target in the project (My Computer, for instance) and going to Properties>>MathScript:Search Paths.

 



Awesome, this worked great. Thanks!

0 Kudos
Message 8 of 8
(3,234 Views)