LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic VI Istance

I implemented a MAIN vi to dynamically launch copies of a MASTER vi creating a .VIT template and calling it with VI SERVER (I followed the Kyle Gupton's recommendation found in the info-Labview archive).
It works very good in the development enviroment but it doesn't work when I build an executable. It works only if i built the EXE using the option: SMALL TARGET FILE WITH EXTERNAL FILE FOR SUBVIS.
I'm using LabVIEW 6.02 but I have the same problem under 5.1.1 (ERROR 7 File not found). In my opinion in the executable version Labview is not able to find the .VIT template into the .EXE file but It sounds very strange. If someone is interested to the problem or has any suggestion thanks.

Golzio
0 Kudos
Message 1 of 13
(4,366 Views)
This subject has come up numerous times in this forum. The problem is most likely that you are not taking into effect that a VIs path is different when it is part of a built application (a standalone VI is now inside of file). What you need to do is add a test to see if you are in the development enviroment. This can be done by using an Open Application Reference and then the App.Kind property. If you are not in development mode, you'll need to add an additional Strip Path function.
0 Kudos
Message 2 of 13
(4,366 Views)
Sorry, I trie to explain better.
I know that vi path is different when it is a part in a built application and i modify my vi in the right way but It doesn't work for subVI with .VIT extension.
0 Kudos
Message 3 of 13
(4,366 Views)
I was able to cure this problem by including a copy (with no diagram)
of the .VIT along with my .EXE on the target machine. You need to change
the path to the external .VIT in your code to reflect this change. Also include the
..VIT as "Add Dynamic Link.." under source files in the App Builder. (with the path
being to the external .VIT installed in your .EXE's directory) Make sense?

Once this is done, I can launch many instances of the .VIT with no problem
in a built app.

I think you are correct thinking LabVIEW can't find the .VIT inside the .EXE

Alan Brause


"Golzio" wrote in message
news:506500000008000000CA290000-998794254000@exchange.ni.com...
> I implemented a MAIN vi to dynamically launch copies of a MASTER vi
> creating a .VIT template and callin
g it with VI SERVER (I followed the
> Kyle Gupton's recommendation found in the info-Labview archive).
> It works very good in the development enviroment but it doesn't work
> when I build an executable. It works only if i built the EXE using the
> option: SMALL TARGET FILE WITH EXTERNAL FILE FOR SUBVIS.
> I'm using LabVIEW 6.02 but I have the same problem under 5.1.1 (ERROR
> 7 File not found). In my opinion in the executable version Labview is
> not able to find the .VIT template into the .EXE file but It sounds
> very strange. If someone is interested to the problem or has any
> suggestion thanks.
>
> Golzio
0 Kudos
Message 4 of 13
(4,366 Views)
Opening a new instance of a VIT from an executable is a new feature
introduced in LV 6.0.2.
It seems buggy yet because if you list the VIs in the executable, you will
notice that the template (as a dynamic VI) hasn't been saved there during
the build (It is also new to use "List Directory" on an executable and get
the VI list). Report the bug to NI.

One option is to distribute the VIT as a separate file or LLB. Waiting for a
fix, you could also tweak with the Application builder to intercept the
internal LLB before it is packed into an EXE and save your VIT within but
you'll have to get your hands dirty...

Jean-Pierre Drolet
Scientech R&D




"Golzio" a ecrit dans le message news:
506500000008000000CA290000-998794254000@exchange.ni.com...
> I
implemented a MAIN vi to dynamically launch copies of a MASTER vi
> creating a .VIT template and calling it with VI SERVER (I followed the
> Kyle Gupton's recommendation found in the info-Labview archive).
> It works very good in the development enviroment but it doesn't work
> when I build an executable. It works only if i built the EXE using the
> option: SMALL TARGET FILE WITH EXTERNAL FILE FOR SUBVIS.
> I'm using LabVIEW 6.02 but I have the same problem under 5.1.1 (ERROR
> 7 File not found). In my opinion in the executable version Labview is
> not able to find the .VIT template into the .EXE file but It sounds
> very strange. If someone is interested to the problem or has any
> suggestion thanks.
>
> Golzio


LabVIEW, C'est LabVIEW

0 Kudos
Message 5 of 13
(4,366 Views)
Correction: after few tests, it appears that the built application fails to
open an instance of a VIT even if it is included in the EXE internal LLB.
However, there is no problem to open a new instance when the VIT is saved
elsewhere.

Jean-Pierre Drolet
Scientech R&D


LabVIEW, C'est LabVIEW

0 Kudos
Message 9 of 13
(4,366 Views)
Golzio,

Whenever I build applications, I use a 'loader'. What this is a very simple application that uses VI server to load and run the application.

This allows you to run the project in the same manner as you did before you built it. Creating a loader VI to run the program and then building that loader allows a greater degree of flexibility and control over your program.

Try this as a possible solution to your problems. This runs your VIs on the Runtime engine. One thing to keep in mind about this method though is that you either have to manually strip diagrams, or suffer with the enourmous size caused by keeping diagrams. Also, as I haven't been able to extract from NI how to remove front panels from VIs, you will have to put up with keeping the front
panels as well. This isn't that bad, as FPs tend to be small anyway.

Good luck, and please let us know how you solved this.
0 Kudos
Message 6 of 13
(4,366 Views)
Labviewguru,

I use the Application builder to strip the VIs from panels and diagrams.
Put all required VIs in the hierachy of a dummy Top Level VI and build using
an external LLB. The AB stores the subVIs in the external LLB; only Top
Level VIs and Dynamic VIs are stored in the internal LLB (in the EXE). I use
this technique to distribute plug-ins. You can edit the external LLB to
further check one or more VIs as Top Level VI so that when you double-click
on the LLB in the Explorer, it opens and runs them.

Jean-Pierre Drolet
Scientech R&D


LabVIEW, C'est LabVIEW

0 Kudos
Message 8 of 13
(4,366 Views)
It is possible that the run-time engine is not able perform the functions necessary to load a VIT and convert it into a VI. There are many functions that are not available in the run-time engine. For example, "VI>>Save Instrument". I, too, liked Kyle Gupton's approach to cloning VIs in the latest issue of "LabVIEW Technical Resource". I seems like finding a great solution compatible with built applications may prove difficult. I am working on this one myself. If anyone else is interested in collaborating and sharing ideas, please email me at jkring@calbay.com.

-Jim Kring
0 Kudos
Message 7 of 13
(4,366 Views)
I have done some tests and found a workaroud. Here is a summary:

Include Master.vit as Dynamic VI:
the VIT is not included in the internal LLB of the executable. Error 7
generated at run-time

Include Master.vit as Top Level VI:
generates a building error at "Librarian Get Info.vi" - file not found

Include a Dynamic VI that calls Master.vit:
It works provided you change Master.vit settings to save the front panel.
To make Master.vit a subVI of another VI without creating a new instance,
open Master.vit front panel and drag and drop its icon in the diagram of the
calling VI. You can also include Master.vit as a Dynamic VI to force it into
the internal LLB when you compile with an external LLB

Jean-Pierre Drolet


LabVIEW, C'est LabVIEW

0 Kudos
Message 10 of 13
(4,366 Views)