LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving for the Desired Version of LabVIEW

There for sure is. It’s the traditional one:

 

- Create an empty new VI (or use yoyr favorite existing scrap VI) 

- Drag the unknown/suspicious/magic or whatever auto start VI from the File Explorer info the diagram of your scrap VI (or select from the Function palette the add with File Dialog icon and search and select your VI)

- Double-click the icon to open its frontpanel and try to open the diagram, which works fine for this VI.

 

Newer LabVIEW versions will prompt you if they should run the autostart VI if you open it from the file system but this technique will work in all versions to safely open unknown VIs without triggering the autostart function.

Rolf Kalbermatter
My Blog
0 Kudos
Message 11 of 27
(383 Views)

@paul_a_cardinale wrote:

@tst wrote:

@Andrey_Dmitriev wrote:


I will really appreciate if you will be able to implement the same for LabVIEW Snippets (I mean Edit->Create VI Snippet from Selection - Retain LV Version)...


While the CCT, linked to by UliB, doesn't have this specific option, it does have the option of selecting the version to save the snippet to.

 

I don't remember offhand the details of what happens if you select a version which doesn't support features which exist in the code you're capturing. A quick test shows that the image appears correctly and that LV tries to do the standard mutation. I haven't checked what happens when there is no mutation path.

 

In theory, it shouldn't be difficult to add a checkbox to default to the save version of the VI.

 

Also, it might be useful to have the snippet option available when no selection has been made (and then you need to select the entire BD). That change is probably a bit more complex.


I looked at the Code Capture S/W.  I'm not willing to search for, and dig out, the part that saves a snippet.


Fair enough. If you do want it, in the top loop there's a store case with another case structure inside which calls the snippet creation code. This is what creates the actual binary chunks in the PNG image (it also shows the backsaving option, as you can see the snippet is in 2013 format):

 

CCT snippet.png

 

There's a separate point in the code which adds the snippet graphic. Looks like this basically just creates a temporary VI with the selection and then calls the SFP method before reading the binary data of the VI file.

 

Also, unlike what I said, it looks like the CCT does allow a snippet if you select the ALL option in the BD (although it looks like by default the NONE option is selected, but I haven't gone back to check how it behaves in all cases).


___________________
Try to take over the world!
0 Kudos
Message 12 of 27
(380 Views)

@tst wrote:

@paul_a_cardinale wrote:

@tst wrote:

@Andrey_Dmitriev wrote:


I will really appreciate if you will be able to implement the same for LabVIEW Snippets (I mean Edit->Create VI Snippet from Selection - Retain LV Version)...


While the CCT, linked to by UliB, doesn't have this specific option, it does have the option of selecting the version to save the snippet to.

 

I don't remember offhand the details of what happens if you select a version which doesn't support features which exist in the code you're capturing. A quick test shows that the image appears correctly and that LV tries to do the standard mutation. I haven't checked what happens when there is no mutation path.

 

In theory, it shouldn't be difficult to add a checkbox to default to the save version of the VI.

 

Also, it might be useful to have the snippet option available when no selection has been made (and then you need to select the entire BD). That change is probably a bit more complex.


I looked at the Code Capture S/W.  I'm not willing to search for, and dig out, the part that saves a snippet.


Fair enough. If you do want it, in the top loop there's a store case with another case structure inside which calls the snippet creation code. This is what creates the actual binary chunks in the PNG image (it also shows the backsaving option, as you can see the snippet is in 2013 format):

 

CCT snippet.png

 

There's a separate point in the code which adds the snippet graphic. Looks like this basically just creates a temporary VI with the selection and then calls the SFP method before reading the binary data of the VI file.

 

Also, unlike what I said, it looks like the CCT does allow a snippet if you select the ALL option in the BD (although it looks like by default the NONE option is selected, but I haven't gone back to check how it behaves in all cases).


I don't see a loop.  I don't see a "store" case.

0 Kudos
Message 13 of 27
(360 Views)

@paul_a_cardinale wrote:


I don't see a loop.  I don't see a "store" case.


The VI "Code Capture Tool GUI__CCT.vi" (UI for the CCT) has the while loop with the main state machine and the "Store" case.

 

CCT Main State Machine.PNG

The VI with the green banner "CCT_Snippet__CCT.vi" is the VI tst showed in his message.

0 Kudos
Message 14 of 27
(353 Views)

No documentation.

No examples.

I guessed that this would work:

paul_a_cardinale_0-1733183397482.png

It doesn't.

Looking inside the code is a headache.

Anybody have a working example?

0 Kudos
Message 15 of 27
(320 Views)

Well, the CCT itself is a working example, but I can understand how going into the code is a headache.

 

When we did the original work on the CCT, we thought that having the VIs as an API would be a good idea. I vaguely remember hearing people referring to using the API over the years, but I don't think I ever used it beyond the work I did on the code (which was limited, I believe Ton did the majority of the work at that point and I don't think I had access to the repo after it was moved from Sourceforge). It looks like when he did the work on adding the snippet feature he didn't add it to the API.

 

Creating a minimal example based on the CCT, I can also see that the border is added separately and not stored in the internal image, so it has to be written back into the object. This seems to work, although I haven't tested the backsaving part:

 

CCT snippetCCT snippet


___________________
Try to take over the world!
0 Kudos
Message 16 of 27
(303 Views)

@tst wrote:

Well, the CCT itself is a working example, but I can understand how going into the code is a headache.

 

When we did the original work on the CCT, we thought that having the VIs as an API would be a good idea. I vaguely remember hearing people referring to using the API over the years, but I don't think I ever used it beyond the work I did on the code (which was limited, I believe Ton did the majority of the work at that point and I don't think I had access to the repo after it was moved from Sourceforge). It looks like when he did the work on adding the snippet feature he didn't add it to the API.

 

Creating a minimal example based on the CCT, I can also see that the border is added separately and not stored in the internal image, so it has to be written back into the object. This seems to work, although I haven't tested the backsaving part:

 

CCT snippetCCT snippet


Doesn't work when BD mode is set to 'Selected' (and the error prevents clean up).

What's that unconnected 2D array constant for?

0 Kudos
Message 17 of 27
(287 Views)

@paul_a_cardinale wrote:

What's that unconnected 2D array constant for?


I think the array constant serves as documentation here.

In the 1st column there are formatter codes for the snippet header line.

 

As an example, this "LV: $VERSION$ $DATE:%c$" can result in 

 CCT_SnippetHeaderLine.PNG

0 Kudos
Message 18 of 27
(273 Views)

@paul_a_cardinale wrote:


Doesn't work when BD mode is set to 'Selected' (and the error prevents clean up).


I didn't check, but the VI I used is probably used somewhere in the hierarchy, putting it into run mode, where you can't have a BD selection. Didn't check how the CCT destroy VI treats errors.

 

And yes, the array is the format codes. I just copied it from the settings dialog, where it's displayed for the user. The format codes aren't needed if you're writing your own version.


___________________
Try to take over the world!
0 Kudos
Message 19 of 27
(266 Views)

OK, here's the new and improved version

Place the attached LLB in all of your  ...\LabVIEW 20??\project\  folders.

(It's a good idea to mass compile).

Now when you run LabVIEW, you will have two new menu items

Tools -> Retain LV Version - Create Snippet...

Tools -> Retain LV Version - Save VI...

By default, they will save to whichever version of LabVIEW the VI was last saved for (but you can also choose a different version).

Message 20 of 27
(243 Views)