LabVIEW is a visual programming language. To post code for other users on StackOverflow, I need to post an image of my block diagram. What is the best way to post such code?
-
I suggest moving this post to [meta], which is the appropriate sub-part for questions *about* Stack Overflow. (It may be a duplicate.) – Jongware Jul 26 '16 at 20:34
-
Except it is also about LabVIEW generally, so I think it is a valid question to stay in the main "how do I do this" area of StackOverflow itself. – srm Jul 26 '16 at 22:03
2 Answers
You should select all (ctl + A) then go to Edit and select -- > Create VI Snippet from Selection.
Here is the result image, which can be opened via LabVIEW and used further.

- 1,982
- 15
- 24
-
Mind if I add your images to my answer? I posted this and answered it specifically to lay out more details than just the actual mechanics of creating a snippet because I find myself having to post this information regularly as comments on StackOverflow and I wanted a question/answer that could just be linked to. – srm Jul 26 '16 at 15:13
-
Note that the default image hosting for SO is imgur.com. Many companies block imgur.com :( – Phil Brooks Jul 26 '16 at 19:07
-
The best way to show LabVIEW code on StackOverflow is to post a VI snippet as a PNG image.
A VI snippet is a PNG that can be viewed online just like any image. Unlike a regular PNG, it has embedded metadata so that when a user drops that PNG on a block diagram, instead of just pasting a picture, the code in the picture gets pasted. That allows other users to explore your multi-frame structure nodes and execute your code (if the code is not broken).
To create a VI snippet, select the code on a block diagram that you want (it can be the entire block diagram) then choose from the menus Edit >> Create VI Snippet From Selection. You will be prompted to save a .PNG file.
For example, doing this:
produces this:
Snippets will help StackOverflow users answer your questions. If you truly think you've found a bug in LabVIEW or need someone to investigate your whole hierarchy under an NDA, contact NI tech support ( http://ni.com ). Their legal department can work with you to set up ways to investigate code without violating NDAs.
Note that the default image hosting for StackOverflow is imgur.com. Many companies block imgur.com. If you can post your image on some other host and then link it in your post, more people may be able to see it.

- 3,062
- 16
- 30
-
Note that you can also use an external tool called the [Code Capture Tool](https://lavag.org/files/file/63-code-capture-tool/), which has some advantages over the built in snippet tool, such as showing the FP as well or running plugins (for instance automatic uploading to imgur). – Yair Aug 01 '16 at 13:55