LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Scripting - Enclose Selection in Flat Sequence

Solved!
Go to solution

Hi all,

 

I'm trying to create a quick drop plugin to do the following, but am stuck at basically step 1, which is to wrap the BD selection in a flat sequence structure.

 

1. Wrap BD selection in FSS

2. Add one frame before and one frame after

3. In the two new frames, place a Tick Count (ms) or High Resolution Relative Seconds VI and wire them out

4. Add a subtract function after the sequence and wire the two time VIs to it to get the elapsed time

 

I am able to successfully create a flat sequence sequence structure using the Create FSS.vi attached. But if you look in the Enclose in FSS.vi, you'll see that the "EncloseSelection2" method is not accepting the FlatSequence reference as the "EnclosureType". I know I have the right type, because the Create FFS.vi works... The "EncloseSelection2" method works if I change the "EnclosureType" to a case structure.

 

Does anyone know why it won't accept the FlatSequence. Surely there's a way to achieve this, since you can easily do this while programming manually!

Download All
0 Kudos
Message 1 of 3
(1,798 Views)
Solution
Accepted by topic author michael.lambert

The first part of your problem is easy to understand.  The method only accepts structures, and obviously the Flat Sequence STRUCTURE is not a structure.  Not really sure why you would think that the Flat Sequence STRUCTURE would be a structure, but in the LV Class Hierarchy it is neither a structure or a node, but rather a Generic.  As you may have surmised from the sarcasm, I am not a fan of this choice, and the explanations I have received so far have been pretty weak sauce.  But, that is life in the scripting underbelly of LV....

 

One option is to enclose in a Stacked Sequence Structure (which is an honest-to-goodness structure) and then use the method to convert it to a FSS.

 

This would work in theory, unfortunately my experiences with the Enclose Selection method have been less than satisfactory.

0 Kudos
Message 2 of 3
(1,766 Views)

Hi Darin,

 

Thanks for the response (sarcasm fully appreciated, haha!). As you noted, the enclose method does work with a stacked sequence. The next step would be working around the default behavior of the Replace method, which replaces the stacked sequence with a flat one, but also deletes everything that was inside the stacked sequence! D'oh!

 

In the normal programming environment, stacked sequences have a right-click option to "replace with flat sequence", so I'm going to search around and see if I can find access to this method in the scripting nodes. I'll respond on this post if I do.

 

I like the flat sequence for readability, but I may have to concede for a stacked sequence for the time being...

 

EDIT: Okay, as long as you make sure your vi object class is "Sequence", not "MultiFrameStructure", then the Convert to FlatSequence method is available. If you get the output reference of the EncloseSelection2 method, it will not be the right type, but you can type cast it to a Sequence to get access to this method! I attached the VI that does this (you just need to have a antoher VI with stuff in it and put the right path in the path constant). I did this in 2018, but haven't tested it for older versions yet.

0 Kudos
Message 3 of 3
(1,683 Views)