LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Moving elements outside loops without breaking the wires

Solved!
Go to solution

Hello everyone,

 

is there any way to move a few elements and their wires outside of a loop without breaking the connections? It become a real pain when you have more elements to move and have to reconnect everything one by one.

 

Many thanks!

0 Kudos
Message 1 of 3
(2,662 Views)
Solution
Accepted by PiotrW

Today, there's no option to do this directly. What would probably require the least amount of work is removing the loop, moving the objects and then drawing the loop again, but that would depend on how much work is required to configure the loop (shift registers, etc.). You could probably write scripting code to do this (or to move the code outside the loop and rewire it), but I expect that the work required to write and test the code will be greater than the work required to do this. You could do a search for the "remove and rewire" Quick Drop plugin to see how that works, as it does some of the work.

 

A few years ago, NI showed a demo of an experimental touch-based editor which had this behavior built in, so at least they're aware of it and maybe you will see it in LV at some point.


___________________
Try to take over the world!
Message 2 of 3
(2,656 Views)

Of course you should ask yourself why these elements are in the loop in the first place if they don't belong there. As you gain more programmming experience, you learn how to correctly place code parts from the beginning, making your current problem task unecessary. 😄

 

While Yair (tst) is of course correct that it could be automated for simple problems (e.g. scalar wires), no automatic code can intelligently deal with all possible scenarios. There is a wide variety of tunnels (last value, indexing, conditional, shift register), so how should it know how to dispose existing tunnels and how to configure the newly created tunnels after things are moved.

 

That leaves us with the question as of why do you want to move things outside the loop? Maybe you suddenly realize that the code is loop invariant and think that moving things outside eliminates unecessary repeated operations. While it does make the code look cleaner, be aware that the LabVIEW compiler will most likely reconize and fold loop invariant code and will generate the most efficient code even if things that belong outside are placed inside the loop.

 

Do you have performance problems?

0 Kudos
Message 3 of 3
(2,629 Views)