From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get path of a VI used in LV project?

How can I get the path of a VI used in LabVIEW project?

 

Actually I want to replace the VI used in LV project by saome other VI, and I think it can be done if I get the path of the VI already present in project and replace that path with path of the VI which I want to include in that project.

 

0 Kudos
Message 1 of 6
(6,391 Views)
You can use a "current vi file path function"
Message Edited by muks on 10-15-2008 07:22 AM
0 Kudos
Message 2 of 6
(6,362 Views)

pritam wrote:

 

Actually I want to replace the VI used in LV project by saome other VI, and I think it can be done if I get the path of the VI already present in project and replace that path with path of the VI which I want to include in that project.


Could you explain this a bit further? What do you mean replace a VI used in a LV project? A LabVIEW project doesn't "use" VIs. It's just a convenient container. In fact, its organization has no bearing on the structure of VI, or even on the way you have the files organized on disk.

0 Kudos
Message 3 of 6
(6,348 Views)
Ok, so you have this VI a.vi, and you want all the VI's in your project to
use VI b.vi? Probably the easiest way to do this is to close the project,
delete or rename VI a.vi, and then open the project. When you open a VI that
uses a.VI, it can't be found. Browse to b.vi, and this VI will be used.

Or simply rename b.vi to a.vi, when the VI isn't in use.

Make backups before you do any of this... At least the first few times.

Regards,

Wiebe.



0 Kudos
Message 4 of 6
(6,306 Views)

I'm facing the same probelm Smiley Indifferent

Actually I'm working on very Huge Project which was developed since at least 15 years ago, so I don't think that rename Vi's would be helpful.Smiley Sad

Appreciating any other solution.

0 Kudos
Message 5 of 6
(5,304 Views)

There are several ways to replace a VI, say "MyFirstVI", with another, say "MySecondVI".  The method you use will depend on several factors, including

  • the version of LabVIEW you are running
  • whether the VIs are in a LabVIEW Project or not (if they are, I'm assuming they are in the same Project)
  • whether you want to replace all MyFirstVI instances with MySecondVI, or selected ones
  • the size (number of VIs) of the Project.

As noted, if you want to replace all of MyFirstVI with MySecondVI in a Project, here is one way to do this:

  1. Close the Project.  You do not want to do this with Project open.
  2. Rename MyFirstVI to MyOldFirstVI.
  3. Rename MySecondVI to MyFirstVI.  If MySecondVI already exists in the Project, you might want to Copy it instead of Rename.
  4. Open the Project.  Find and open an instance of MyFirstVI, verify it has the code of MySecondVI.
  5. In Project Explorer, find MyFirstVI and rename it MySecondVI.
  6. Exit Project.  Rename MyOldFirstVI back to MyFirstVI.

At this point, all of your VIs have their "original" names, but in, say, Main.vi, wherever MyFirstVI was called, you should see MySecondVI.

 

For doing selective Replacement (or even total replacement where you want to actually see all of the instances where replacements are made), you can use QuickDrop to your advantage.  You need to have in memory the VIs that use MyFirstVI, and also have MySecondVI in memory.  With the Project open and the relevant VIs in memory:

  1. Open any VI that shows MyFirstVI on the Block Diagram.  Right-click it and choose "Find All Instances".
  2. When the search is done, you need to "visit" each of the found VIs -- use Ctrl-G to do this.
  3. When you find an instance of MyFirstVI, type Ctrl-Space to activate QuickDrop, start typing MySecondVI until it appears on the Selection line (if you are lucky, you will only need to type MySec and it will find the correct VI), then type Ctrl-P to replace MyFirstVI with MySecondVI.
  4. Type another Ctrl-G to go to the next instance of MyFirstVI and replace as needed.  When you've replaced all of them (or all that you want to replace), stop.

Bob Schor

0 Kudos
Message 6 of 6
(5,280 Views)