LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Project Explorer beginner's mistakes : Copying Sub-VIs and libraries from another project

Solved!
Go to solution

Hi!

 

So I've made this dumb mistake of copying files from one project to another, done some modifications on it, only to realize now that I was not working on a copy of the original, but the reference was still here.....

 

Anyway I'm looking for some recommendations for good tutorials on how to handle the project explorer and "copying" files from one project to another as in creating a new reference. 

I've seen numerous stuff online (including NI courses) but they are either not really helpful or way too long to invest time without being recommended (I've seen too many bad tutorials in the past, teaching you things not recommended)

 

Thanks in advance for your help.

Vinny.

0 Kudos
Message 1 of 10
(3,301 Views)
Solution
Accepted by topic author VinnyAstro

Hi Vinny,

 

So assuming that you have an existing project open, and you'd like to make a copy of some of the contents (to be later used in a different project), you can do the following:

 

For libraries:

  1. Right click on library (.lvlib) file and go to Save > Save As...
  2. Leave "Copy" (the default, top option) selected
  3. Deselect the "Add copy to..." option (you probably don't want it to be a part of your existing project
  4. Click Continue, then choose a new folder for it (not a file, but a folder - note the "Current Folder" button at the bottom if you've already created the target location)

For classes:

  • Basically the same as libraries (classes are a variation on libraries)

For VIs:

  1. Open the VI (it doesn't seem like there's a right click option here for me)
  2. Go to File > Save As...
  3. Choose to Copy - Create unopened disk copy (this will not become a part of your existing project)
    • Note that you can also consider "Duplicate hierarchy to a new location" - this is more useful if you have a collection of VIs that are not in a library. But maybe it would be better to put them in a library first, and then copy that 😉

 

Separately from the above, if you want to make reusable code, consider having one "source" folder that contains the code you're developing (VIs, ctls, lvlibs, etc) and then using a PPL (Packed Project Library) or packaging technology (e.g. VI Packages via VIPM) to produce some "output" and install that. Then, have any code that should use your code reference the installed copy. Be very careful not to reference the source version!


GCentral
Message 2 of 10
(3,268 Views)

1. There is a great feature of the Project Explorer that is not widely used.  In the Project menu, select Show Item Paths.  You will now be able to confirm the exact location of every VI project and easily spot something out of place. 

2. You should also try to use auto-populating folders.  Virtual folders can invisibly contain items in other projects.

3. Beware of File->Save As.  It will default to the last location which might be the old project.

Michael Munroe, CLD, CTD, MCP
Automate 1M+ VI Search, Sort and Edit operations with Property Inspector 5.0, now with a new Interactive Window Manager!
Now supports full project automation using one-click custom macros or CLI.
0 Kudos
Message 3 of 10
(3,261 Views)

I have found the best way is to:

 

  1. Close LabVIEW
  2. Copy the entire project to a new directory.
  3. Delete the three project files if they are in that directory
    1. xxx.aliases
    2. xxx.lvps
    3. xxx.lvproj
  4. Open LabVIEW
  5. Create a new project
  6. Add the new directory you just made to your project. 
========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 10
(3,232 Views)

@Michael_Munroe wrote:

1. There is a great feature of the Project Explorer that is not widely used.  In the Project menu, select Show Item Paths.  You will now be able to confirm the exact location of every VI project and easily spot something out of place. 

2. You should also try to use auto-populating folders.  Virtual folders can invisibly contain items in other projects.

3. Beware of File->Save As.  It will default to the last location which might be the old project.


I disagree with #2 if you practice #1.  You can open the virtual files and immediately notice if something seems "out of place".  There are many advantages to using virtual folders, particularly regarding versioning software.  Oftentimes, nothing changes at all if you move a file from one virtual folder to another.  Moving from one autopopulating folder to another can cause the need for massive commits to the repository.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 10
(3,216 Views)

@cbutcher wrote:

Hi Vinny,

 

So assuming that you have an existing project open, and you'd like to make a copy of some of the contents (to be later used in a different project), you can do the following:

 

For libraries:

  1. Right click on library (.lvlib) file and go to Save > Save As...
  2. Leave "Copy" (the default, top option) selected
  3. Deselect the "Add copy to..." option (you probably don't want it to be a part of your existing project
  4. Click Continue, then choose a new folder for it (not a file, but a folder - note the "Current Folder" button at the bottom if you've already created the target location)

For classes:

  • Basically the same as libraries (classes are a variation on libraries)

For VIs:

  1. Open the VI (it doesn't seem like there's a right click option here for me)
  2. Go to File > Save As...
  3. Choose to Copy - Create unopened disk copy (this will not become a part of your existing project)
    • Note that you can also consider "Duplicate hierarchy to a new location" - this is more useful if you have a collection of VIs that are not in a library. But maybe it would be better to put them in a library first, and then copy that 😉

 

Separately from the above, if you want to make reusable code, consider having one "source" folder that contains the code you're developing (VIs, ctls, lvlibs, etc) and then using a PPL (Packed Project Library) or packaging technology (e.g. VI Packages via VIPM) to produce some "output" and install that. Then, have any code that should use your code reference the installed copy. Be very careful not to reference the source version!


Hi Cbutcher.

 

Thanks for your answer, I will consider having a source folder that's a good idea. I am still confused with what NI has to offer sometimes (VIPM vs NI package manager etc.) But I'm getting there.

 

Another question:

Let's say you have a VI/Library... in the folder you want it to be. How do you import it in your project in the best way ?

- Do you use the "Open" button in the project view

- Can you just drag and drop the VI/Library into your project?

What happens then if ever the VI for instance has some dependencies to other VIs I made and are elsewhere? 

 

Thanks again, now I need to fix the mess I made 😅  

Vinny

0 Kudos
Message 6 of 10
(3,160 Views)

@billko wrote:


I disagree with #2 if you practice #1.  You can open the virtual files and immediately notice if something seems "out of place".  There are many advantages to using virtual folders, particularly regarding versioning software.  Oftentimes, nothing changes at all if you move a file from one virtual folder to another.  Moving from one autopopulating folder to another can cause the need for massive commits to the repository.


I'm actually also looking into how to manage versionning. We are using SVN here and I saw a few articles detailing how to work with it in labview, I need to look at it in details.

 

That actually makes me think of build specifications: I believe it is better to have all files on the same drive and not to have some on my drive and other on our servers, right? (might be for another post though).

 

Vinny.

0 Kudos
Message 7 of 10
(3,156 Views)

PS: I'm still looking for some good tutorials on how to manage properly a project explorer, explaining the use of libraries, shared and packed ibraries, how to organize it in an effective way etc.

Thank you for any suggestions 🙂

 

Vinny.

Message 8 of 10
(3,143 Views)

@VinnyAstro wrote:

Another question:

Let's say you have a VI/Library... in the folder you want it to be. How do you import it in your project in the best way ?

- Do you use the "Open" button in the project view

- Can you just drag and drop the VI/Library into your project?


I usually use the right click on parent item (e.g. Virtual Folder, or Target (My Computer, etc)) and then go to Add > File.

I *think* dragging and dropping would do the same thing (from e.g. Explorer).

 


@VinnyAstro wrote:

What happens then if ever the VI for instance has some dependencies to other VIs I made and are elsewhere? 


If the VI has dependencies, those will also be loaded. Probably you'll get a search box if the VIs are at different relative/symbolic (in the sense of vi.lib, instr.lib etc) paths than expected.

 

It looks like you already found the forum issue with only being able to quote one reply, so I'll quote you now in red and indented:

 

That actually makes me think of build specifications: I believe it is better to have all files on the same drive and not to have some on my drive and other on our servers, right? 

 

I'd personally suggest that you keep whatever source code you're developing on your hard drive (whereever is convenient to develop it) and then install "built" products (e.g. via VIPM, NIPM) into specific directories. There seem to be a large number of possible options (and people don't generally seem to have converged on any particular workflow), so you should go ahead and read various forum posts or see videos recorded at previous NI Weeks.

 

The wiki page here might be useful regarding possible packaging options: Package Manager Comparison 

 

 


GCentral
0 Kudos
Message 9 of 10
(3,064 Views)

If you want a good beginner's overview for using Project Explorer, try this one.

0 Kudos
Message 10 of 10
(2,401 Views)