LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

a problem about saving the picture control'image in a child VI.

Solved!
Go to solution

i want to use 'export image' method to get a picture control'image,so ,i have a child VI to use method 'export image',and a main VI to using the child VI,but when i run the main VI,there is no image is saved on the disk ,but if i open the child VI'frontpanel,then,i run the main VI,the image is saved on the disk,i want to know the reason why i can not get the image,when i run the main vi without the child 'frontpanel or blockdiagram is opened.

Download All
0 Kudos
Message 1 of 4
(2,328 Views)

I believe the behavior you are seeing has to do with the way LabVIEW optimizes performance.  The front panels of unopened VIs are not loaded into memory or drawn if that VI is used as a subVI (why waste resources if nobody would see the result?).  Exporting an image requires the front panel to be both loaded and drawn.

 

I don't have LabVIEW in front of me to check my workarounds but you may want to try setting the child VI to programatically open it's own front panel when called and close it before it exits.  To prevent it flashing onscreen you might be able to to set it's display mode to "hidden" although I'm not sure if this prevents it from existing in memory or not.  Another option if that doesn't work is to use the appropriate property notes to position the window outside the visible bounds of the monitor.

 

Hope this helps,

 

~Simon

0 Kudos
Message 2 of 4
(2,302 Views)
Solution
Accepted by topic author 小静

The behavior that Simon describes is not a hard and fast rule, and the Export Image method used to be a bit of an exception.  It would supposedly update the controls of unopened FPs that used the method.  Reality never quite matched what was described in the documentation if I recall.

 

If you pore over the detailed help you discover that this method works fine in SubVIs with some controls and not others.  Look at the characteristic 'Loads the Front Panel Into Memory', for a Picture control it is 'No', for a Waveform Graph, for instance, it is 'Yes'.  Caveat:  Relying on this level of detail to be correct in the LV help is a bit risky.  Best to try it yourself.  Not loading the FP is a good hint that the method is not going to behave in a SubVI.

 

As to the problem at hand, a Picture Indicator is an odd choice to me to use this method.  You have VIs in the Picture palette to convert pictures to image data and then export the image data to a PNG or JPG or BMP file directly.  Anything you would draw and then export could be exported directly without drawing.

0 Kudos
Message 3 of 4
(2,298 Views)

thanks.all people.

0 Kudos
Message 4 of 4
(2,290 Views)