Hello, I found few methods, but results are wrong - many connections get broken.
This picture below shows screen dump from LabVIEW window:
And this next was acquired programmatically (using VI Invoke "Node BD.Get Image Scaling") - here the broken connections can be seen:
The problem is that LabVIEW handles the VI alone, aside from the project the VI belongs to - and does not recognize objects defined in the project.
I tried to open the project in the application (the Open VI Reference function has an "application reference" input and I tried passing there a reference which I used to open the project with Application Invoke Node Project.Open), but the result was the same.
Possibly there is some way to tell the LabVIEW "handle the VI in a project context", but I spent 2 days looking for a way to do it, without success. Has anyone an idea?
Thakns in advance, Jerzy Tarasiuk
I think the trick is that you are looking at FPGA code and each FPGA target in the project is its own application context. You were right in that you have to use the application reference input for the open VI reference function but it has to specifically be the application reference of the FPGA item. I did this for a very simple project and you can see I got the project reference and instead of going straight to getting the application reference I had to traverse the project to find the FPGA target (I cheated a bit by only having one item under my computer so I could just index the first item from the ownedItems array).
Post your script; I'll take a look at it.
The key is: use Application Invoke Node Project.Open, then get Project Property Node Targets, and find between them a target for which the VI is one of OwnedItems obtained from the target Property Node; then use the target Property Node to get Application and finally use the Application to open the VI.
Seems now it is working correctly for few VI-s I tried and I hope for the same for other VI-s.
Thanks for help which pointed me to the solution.
Yet another version - this processes all VI-s of a project.
pvibd2img1.vi - Convert BDs of all VI-s of a project to PNGs
controls: ProjectPath, LogFilePath, VI full paths, Image Counter in
indicators: -, Log path out, -, Image Counter out
* ProjectPath - a full path of LVPROJ file
* LogFilePath - a path of LogFile, may be relative
* VI full paths - full paths or names only of VI-s are listed
* Image Counter in - initial value for an image counter (0)
* Log path out - an expanded path of LogFile
* Image Counter out - final value of the image counter
Images are created in Application Directory, using names
bd%u.png, where the %u is substituted by the image counter;
the counter is incremented before its values is used, so
if it was 0, images will be named bd1.png, bd2.png, etc.
I tried my script on a project containing a VI which uses as SubVI a VI not being in the project. And the SubVI was not processed, therefore I modified the script, adding an ability to process dependencies (it is optional, controlled by Dependencies button.
I tried to use Find SubVIs property, but it didn't return SubVI-s used by a VI or a Target.
The included VI (as well as previous) can be invoked as a SubVI (e.g. by a main VI
which reads a list of project paths and makes FP/BD images of all VI-s in them).
Maybe it will be helpful for someone wanting to quickly review several projects.
By using a VI Invoke Node Print.VItoRTF, an RTF output can be created. In such a case, images of many VI-s can be output to one file if using Append input of the Invoke Node.
Additional information on the pvibd2img2.vi
Controls (inputs to the VI):
VI Full Paths (Boolean) Show full paths of VI-s in log
Image Counter in (Integer) Image names "bd%u.png", start from number+1
Dependencies (Boolean) Get dependent VI which aren't in the project
Indicators (outputs from the VI):
Log path out (Path/String; full path)
Image Counter out Copy it to "in" before the next run
Log contains lines:
- they tell which PNG is for which VI.
Below the VI block diagram: