LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Scripting - locate loop iteration and conditional terminals.

Solved!
Go to solution

I have inherited some very poorly written LabVIEW code, which consists of VIs with huge block diagrams and multiple humongous loops… think scrolling through multiple screen heights and widths! It is painstaking to find each loop's iteration terminal and conditional terminal (stop terminal). Is there’s a way to do this with scripting?

^TeraTech.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Check out this lengthy post of mostly complaints)
0 Kudos
Message 1 of 12
(1,660 Views)

See if the following code will help you.

 

You can search for WhileLoop and for ForLoop and get references to the LoopCounter and the LoopEndRef of the structures.

You should build a tool which lists the terminals and gives you the possibility to highlight one LoopCounter or LoopEndRef at a time.

 

Highlight.png

Message 2 of 12
(1,622 Views)
Solution
Accepted by topic author TeraTech

Hi TeraTech,

 

Yes it is possible by using a right-click plugin. You can create one by running VI "<LabVIEW 20xx>\resource\plugins\PopupMenus\Create Shortcut Menu Plug-In From Template.vi". It will create a new plugin and place it in "<YourUser>\Documents\LabVIEW Data\PopupMenus\edit time panel and diagram" so that all your installed LV versions (superior or equal to the one used to run the VI) can see it.

 

Attached is an example for your use case, put the .llb folder in "<YourUser>\Documents\LabVIEW Data\PopupMenus\edit time panel and diagram". Then restart LabVIEW and try to right-click a loop, then you can see the new Find->Iteration Terminal / Conditional Terminal options. Works for LV versions >= 2021.

 

Regards,

Raphaël.

Message 3 of 12
(1,608 Views)

You read my mind!  I eventually wanted to create a right-click plug in for it. Thanks for the code.  Unfortunately, I can't try it out right now, we're still on LV2017.  😞

^TeraTech.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Check out this lengthy post of mostly complaints)
0 Kudos
Message 4 of 12
(1,601 Views)

 


@raphschru wrote:

Hi TeraTech,

 

Yes it is possible by using a right-click plugin. You can create one by running VI "<LabVIEW 20xx>\resource\plugins\PopupMenus\Create Shortcut Menu Plug-In From Template.vi". It will create a new plugin and place it in "<YourUser>\Documents\LabVIEW Data\PopupMenus\edit time panel and diagram" so that all your installed LV versions (superior or equal to the one used to run the VI) can see it.

 

Attached is an example for your use case, put the .llb folder in "<YourUser>\Documents\LabVIEW Data\PopupMenus\edit time panel and diagram". Then restart LabVIEW and try to right-click a loop, then you can see the new Find->Iteration Terminal / Conditional Terminal options. Works for LV versions >= 2021.

 

Regards,

Raphaël.


I installed LV 2021. Downloaded and unzipped "Find Loop Terminals.zip". Copied the resulting folder "Find Loop Terminals.llb" to the folder "C:\Users\<USER>\LabVIEW Data\PopupMenus\edit time panel and diagram"

I started LV2021, created a new VI with both a for loop and a while loop.  When I right click, either the For or While loops, I don't see a Find menu as you described.

2023_12_14_16_04_47_Find Loop Terminal missing right click option.png

 

^TeraTech.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Check out this lengthy post of mostly complaints)
0 Kudos
Message 5 of 12
(1,573 Views)

I ran "Create Shortcut Menu Plug-In From Template.vi" and gave it "Find Loop Terminals" as a name. The resulting VIs were placed in the "...\Documents\LabVIEW Data\PopupMenus\edit time panel and diagram folder", but they just templates. So I pasted the code you provided into the VIs with the same names and update the ctl file of the same name.  Saved all.  Exited LV. Restarted LV and tried the right click on a while loop. Still missing the "Find Iteration Terminal" or "Find Conditional Terminal" selection. I've attached the llb file. What am I missing?

^TeraTech.

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Check out this lengthy post of mostly complaints)
0 Kudos
Message 6 of 12
(1,544 Views)

Works OK for me.

0 Kudos
Message 7 of 12
(1,542 Views)

@raphschru wrote:

Attached is an example for your use case, put the .llb folder in "<YourUser>\Documents\LabVIEW Data\PopupMenus\edit time panel and diagram". Then restart LabVIEW and try to right-click a loop, then you can see the new Find->Iteration Terminal / Conditional Terminal options. Works for LV versions >= 2021.

 

Regards,

Raphaël.


Thank you Raphaël for uploading the Plug-In, it is really helpful

Works for me in LV2022Q3

0 Kudos
Message 8 of 12
(1,481 Views)

It reminds me of this thread, @paul, did you eventually find what caused the issue ?

https://forums.ni.com/t5/LabVIEW/Missing-Popup-Menus/m-p/4267046

0 Kudos
Message 9 of 12
(1,467 Views)

@raphschru wrote:

It reminds me of this thread, @paul, did you eventually find what caused the issue ?

https://forums.ni.com/t5/LabVIEW/Missing-Popup-Menus/m-p/4267046


I did solve it, but I don't remember what the solution was.

At this point, my best guess would be that there was a buggy version of the popup located at ...\labview 2019\resource\plugins\PopupMenus\edit time panel and diagram\

 

0 Kudos
Message 10 of 12
(1,454 Views)