LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

save png from sub vi

Hi Folks,

Am using LabView 7.1 on a Win XP machine.

I have a VI which takes [captured data and puts it into] a built array and put this onto a graph.  I then take 'image data' from the graph and save as a PNG.  Works OK, graph plus plotted data is saved.
This works well when the VI is run itself.

However, when I call this VI as a sub, even though the data is the same (ie from the same source) the saved PNG only consists of the graph, but does not include the plotted data.

Any ideas ?

Cheers,
Bob.
Uk.
0 Kudos
Message 1 of 10
(3,797 Views)
You have to load the frontpanel into memory.
There are several methods to do this. The most reliable is to open the FP in a  'a' hidden state.

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 10
(3,795 Views)

Dear Ton,

How to open fp in a hidden state? Could u please explain in bit detail.

Thanks,

Mathan

0 Kudos
Message 3 of 10
(3,792 Views)

Hi,

Why don't you do the following:

1 - connect the Subvi graph to an output.

2 - on the parent vi, connect it to another graph indicator and hide it

3 -  save the graph by the same method that you already use on the subvi

4 - delete the procedure for saving the image that you have on the subvi (since it's not needed anymore)

Software developer
www.mcm-electronics.com





PORTUGAL
0 Kudos
Message 4 of 10
(3,784 Views)
Hi,

I can't remove the code from the sub vi since I am wanting to store plotted images of data that is being worked on in a While-Loop.
Funny enough, everything works OK if I have that sub vi front panel open while the main code runs.  🙂

Bob.
0 Kudos
Message 5 of 10
(3,776 Views)
If you don't have the front panel in memory, labview will not call the graph indicator as an optimization, therefore no picture is ever loaded to the indicator.  When you pull the front panel into memory, you now have an indicator that can hold an image for you to save.
0 Kudos
Message 6 of 10
(3,772 Views)
OK, can someone provide example code of 'pulling a front panel into memory'.

Thanks,
Bob.
0 Kudos
Message 7 of 10
(3,766 Views)
Hi all,

OK, I've got a work-around.  Not what i wanted, but it is OK for this debug process.

On the parent vi I tight clicked on the sub vi icon and selected 'open front panel when run' and 'close front panel is already closed'  (or words to that effect)
Tidied up the windows, resized them and closed everything except the main vi front panel.

Works a treat.
many thanks for your input.

Bob.
0 Kudos
Message 8 of 10
(3,747 Views)
I believe property nodes will also pull a front panel into memory because they're all handled by the UI thread.  So if you just drop a value node or something and wire it to any structure, it should keep the front panel in memory without having to actually open the front panel in runtime.


Message Edited by JeffOverton on 05-19-2008 09:25 AM
0 Kudos
Message 9 of 10
(3,744 Views)


@Mad_Bob wrote:
OK, can someone provide example code of 'pulling a front panel into memory'.

Thanks,
Bob.



The VI method, Open Front Panel (with ctrl-shift-B you can explore properties and methods and do searches.)

Ton


Message Edited by TonP on 05-19-2008 06:35 PM
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 10 of 10
(3,716 Views)