LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to export a table and array as image?

Solved!
Go to solution

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:

 

Untitled.jpg

0 Kudos
Message 1 of 17
(3,830 Views)

This is the first hit I got from doing a forum search on "front panel screen shot."

 

take screenshot of part of front panel

 

Is this what you were looking for?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 17
(3,821 Views)
Solution
Accepted by murchak

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.

Message 3 of 17
(3,807 Views)

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.

Message 4 of 17
(3,794 Views)

Darin,

 

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.

0 Kudos
Message 5 of 17
(3,756 Views)

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.

 

FindDecoration.png

0 Kudos
Message 6 of 17
(3,751 Views)

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?

 

0 Kudos
Message 7 of 17
(3,743 Views)

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.

0 Kudos
Message 8 of 17
(3,738 Views)

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

 

Untitled.jpg

0 Kudos
Message 9 of 17
(3,735 Views)

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.

 

FindDecoration2.png

0 Kudos
Message 10 of 17
(3,729 Views)