My VI generates a table (formatted with different cell and text colors), plus a text box, plus an array (formatted with background color).
I can group these objects on the front panel and copy them as one unit and paste them into power point.
Is it possible to do this automatically, have labVIEW group them as one object and export it as an image file with file name as a control? See the attached sample VI and the picture below:
Solved! Go to Solution.
This is the first hit I got from doing a forum search on "front panel screen shot."
Is this what you were looking for?
Here is one way to do it.
1. Create a decoration on the FP which surrounds the controls
2. Get a reference to the decoration and use the MasterBoundRect property to define a subset of the FP image
3. Save the image subset
You can color the decoration transparent to hide it if desired.
If the method works for you, there are more complicated, yet robust methods to get the decoration reference.
Thanks Billko and Darin.
What I did was to put my objects in a cluster, and right-clicked on the cluster control on the block diagram, created the Invoke Method:Get Image and connected the Image Data to Write PNG File.vi.
I worked on my sample code. For my real application, everytime I run my VI, it generates a file name associated with that run and I want this file name to be the image name.
So I took this file name (which is a string) and connected it to the Build Path VI (already has a folder connected to it), and took the output and connected to the file input of the Write PNG File.vi.
But I get an error that file doesn't exist, which is true. But I connrected Create File VI to this, still doesn't work. This should be an easy fix but I can't seem to get it.
I should mention that I by running your code as is, I got the "Object reference is invalid" error, but clicking on the continue button, it still outputs an image.
However, by connecting the reference (without creating a constant) directly to Decor proprety node, I don't get the error, and get the image.
You need to recreate the constant to get it to work. Once you run the code you simply create a new constant and replace the existing one.
I have code which lets me tag the decorations and find them later by their tag. If you are using LV11 or LV12 I believe the UID property of the decoration is now public. You can use this for a more robust solution. At the beginning of the VI run a loop which checks the UID of all of the decorations to find the value which corresponds to the bounding box decoration. You only need to find it once, as long as you do not delete the decoration it is constant. Finding it the first time is simply trial and error.
I added one more decoration and your VI below works great (I took your VI, got rid of the case structure, and put everything inside the for loop).
When I copy and paste the code below into my actual application and run it,
I gives me Property Node 'Property Node': Contains unwired or bad terminal. When I click on show error, it has to do with the Pane property
outside the loop shown below. Why don't I get the same error when I run your code?
I should have seen that. The Pane property can not be dealt with in a snippet, you need to right-click it, and choose Link To -> Pane.
I right-clicked on it, chose link to pane.
I have three decoraction on 3 tabs of a Tab Control container. I took one of the decorations out of the tab and placed it on the FP.
Then ran the code, and got the error below
A Tab control adds a small complication, you simply need to either Traverse to find the decorations or find all of the decorations in a given Tab control. The Highlight object method is a quick way to make the given Tab visible before getting the FP image.