12-14-2023 10:31 AM
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?
Solved! Go to Solution.
12-14-2023 11:38 AM
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.
12-14-2023 12:30 PM
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.
12-14-2023 12:47 PM
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. 😞
12-14-2023 03:07 PM - edited 12-14-2023 03:50 PM
@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.
12-14-2023 05:04 PM
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?
12-14-2023 05:10 PM
Works OK for me.
12-15-2023 04:36 AM
@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
12-15-2023 06:55 AM - edited 12-15-2023 06:55 AM
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
12-15-2023 07:39 AM
@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\