From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
04-14-2020 12:11 AM - edited 04-14-2020 12:12 AM
While writing a plugin that deals with cluster terminals, I found that I needed to distinguish among terminals in various contexts: on control and indicator terminals, tunnels, and yes even sequence locals in stacked sequence structures--for completeness only.
In most cases I have been able to determine from a terminal's ownership hierarchy (accessed from the "Owner" property") what flavor of terminal I'm dealing with. But I found that this does not work for terminals inside of flat or stacked sequence structures. Any terminal inside a Sequence structure has an ownership hierarchy that looks like
[some object]:Diagram:Sequence:TopLevelDiagram
OR
[some object]:Diagram:FlatSequeceFrame:FlatSequence:TopLevelDiagram
Obviously there may be more levels to this for nested structures, but there's no hint of the sequence local here.
I have a workaround for my plugin, because I needed to make this distinction only for placement in a contextual menu, and I could use a particular menu items of a sequence local to determine the difference, but it seems like there should be another way, and relying on the menu seems too fragile in the face of version changes.
Solved! Go to Solution.
04-14-2020 12:48 AM
I guess that's just one more reason to add to my list of reasons why stacked sequence structures are evil. 😉
04-14-2020 02:34 AM
If the owner structure is a sequence, get it's list of it's locals (Sequence Locals[] property). From each sequence local, get a list of terminals. Keep that list.
For each terminal, see if it's in the list of sequence terminals. If there is a match (a Search 1D Array should work), the terminal is a sequence local...
It depends a bit on the context. Are you traversing controls, wires, structures? Perhaps you can post a VI that demonstrates the problem, so we can work on it?
04-14-2020 12:40 PM
Your solution makes sense, and I'll try it out. I am acting on a right-clicked sequence local (or any other terminal). By using the owner reference, I can get the sequence locals of the sequence structure and determine of the clicked terminal is in that list. Great!
04-14-2020 08:07 PM
I have attached sample code that shows how to determine if a terminal reference is a sequence local.