From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

BUG Block diagram cleanup fails completely? Generates very bad results

Is there some trick to the settings of the block diagram cleanup button? Every so often I get results that are far from anything useable. I tried fiddling with the settings, but whenever there's a blockdiagram, where cleanup makes a mess, changing the settings does not really change the result.

 

What makes it hard is also that the results are also very inconsistent. See this very simple example:

weird.png

 

I could hit cleanup as often as I wanted, but the extra bend would not go away. This vi was created by "Create SubVI" on a selection. Building the same VI from a blank VI never gave such a result.

 

Currently I have a problem with a case structure (6 cases) that always wants to grow to a width of over 1500 pixels (out of my screen) while in none of the cases is anything that will even fill half a screen width. 2/3rds of every case in the structure is empty space.

If I now take said case structure, add a sequence around all the contents of every single case (so not changing anything concerning data flow), select that sequence, hit cleanup and then "exclude the sequence from cleanup", a final cleanup of the complete block diagram will yield a result not wider than half a screen (as I would expect it from the start).

This is the case with the "widest" code when all sequences are excluded from diagram cleanup:

with-sequence-excluded.png

 

Just removing the exclusion from that single sequence and pressing cleanup results in this:

with-sequence.png

 

Things get even worse if I remove the sequence (and the ones in the other cases) all together. The weird thing is: the layout of the sequence in the first picture is the result of auto cleanup being only applied to that sequence (i. e. the sequence being selected before pressing the button). Why are the results so different? The contents are all over the cases and not just shifted to one of the sides, so I can't simply resize the case structure. I have block diagrams with more contents than this, and it works fine there. But on this block diagram I can't use auto cleanup anymore, because I have more to clean up afterwards than I had before pressing the button, which is very annoying. Having to shuffle around wires and boxes with mouse is even worse than having to manually indent code in a text based language. This is something I expect the IDE to do for me.

 

This are the current settings for the cleanup:

settings.png

Changing them is no use. High or low or automatic compactness, small or large pixel spacings the empty space stays.

 

 

Message 1 of 52
(4,417 Views)

LOL - that's what happens when you use hired help.  😉

 

I always clean as I go so I have no one to blame but myself for a sloppy mess.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 52
(4,403 Views)

Almost as if Labview knew what I was talking about, LV2012 just crashed after pressing auto cleanup on the above block diagram after removing the sequences. Let's see if the "hired help" this time aka "auto recover" is any better.

 


@billko wrote:

LOL - that's what happens when you use hired help.  😉

 

I always clean as I go so I have no one to blame but myself for a sloppy mess.


Yes, but this is the same as auto indentation in an IDE for text based languages. I don't want to have to invest too much time in "prettyfying" code.

0 Kudos
Message 3 of 52
(4,399 Views)

@cober wrote:

Almost as if Labview knew what I was talking about, LV2012 just crashed after pressing auto cleanup on the above block diagram after removing the sequences. Let's see if the "hired help" this time aka "auto recover" is any better.

 


@billko wrote:

LOL - that's what happens when you use hired help.  😉

 

I always clean as I go so I have no one to blame but myself for a sloppy mess.


Yes, but this is the same as auto indentation in an IDE for text based languages. I don't want to have to invest too much time in "prettyfying" code.


I agree that this is exactly analogous to indentation.  However, it is orders of magnitude more complicated.  Cleanup hardly ever produces something I find acceptable, so I just avoid it.

 

I wouldn't say it was buggy as much as it needs tuning up.  I think maybe you should send NI some examples of poor cleanup so maybe they can fine-tune it more than it already is.  🙂

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 52
(4,384 Views)

It happens to me too.  I've inherited a gigantic code and am slowly trying to clean it up.  block diagram cleanup (BDC) loves to make my code reeaaaallly wide.  And sometimes/often it breaks wires on cases that are "behind" it (like when there is a case structure with multiple subdiagrams).  Even if i do partial cleanup on some highlighted things, it will break wires in other subdiagram cases.  But what I've noticed is that when it does go reaaaalllly wide and then i flip through my subdiagram cases, it appears that BDC wants to arrange stuff so that nothing is on top of something else in another case.  So if you had case A and case B, the stuff in Case A doesn't overlap when you view Case B (even though you don't care how Case A is arranged when you are looking at Case B).   That is the power of a human vs. computer...  I hope some NI humons can fix this in the future....

0 Kudos
Message 5 of 52
(4,275 Views)

@BigShotEngineer wrote:

It happens to me too.  I've inherited a gigantic code and am slowly trying to clean it up.  block diagram cleanup (BDC) loves to make my code reeaaaallly wide.  And sometimes/often it breaks wires on cases that are "behind" it (like when there is a case structure with multiple subdiagrams).  Even if i do partial cleanup on some highlighted things, it will break wires in other subdiagram cases.  But what I've noticed is that when it does go reaaaalllly wide and then i flip through my subdiagram cases, it appears that BDC wants to arrange stuff so that nothing is on top of something else in another case.  So if you had case A and case B, the stuff in Case A doesn't overlap when you view Case B (even though you don't care how Case A is arranged when you are looking at Case B).   That is the power of a human vs. computer...  I hope some NI humons can fix this in the future....


If you are neat to begin with, cleanup makes it look really ugly and does questionable things.  If you write spaghetti code, it's a godsend...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 6 of 52
(4,265 Views)

I have never had BDC break wires, and yes sometimes it does things I wouldn't do. But I haven't seen many cases where what it produces isn't better than what was there before.

 

Personally, unless they can get that auto layout algorithm Jeff K demoed a couple years ago at NI week running, I hope they leave it just the way it is. Make it too good and people will begin depending on it -- and what a mess that will be.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 52
(4,241 Views)

I can only guess that he doesn't mean that they literally break, but that they make some funny turns even when they apparently don't need to.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 52
(4,232 Views)
Your comments reminds me of something that I have always thought was curious, namely that the logic for a general BDC apparently uses a different algorithm for wires than the one used when cleaning up individual wires.

The most common situation where I use BDC is when cleaning up inherited code -- especially with stacked sequence structures. Typically what I'll do is turn on autogrow for all the structures outside the sequence, replace the stacked sequence with a flat sequence, and finally remove the flat sequence (they are typically superfluous anyway). The result really is a mess -- especially when there are sequences, inside of sequences, inside of sequences -- and BDC usually helps.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 9 of 52
(4,214 Views)

So it's one and a half years later and LV 2013 SP1 is still doing this with case structures (which is a very obvious bug). I still use the sequences inside case structures with "exclude from cleanup" enabled (and have gone to color them white if they are just for cleanup purposes).

 

What would really help me here (as long as cleanup fails with case structures), if the cleanup button would cleanup a structure with "exclude from cleanup" enabled, if it is the only thing that is selected. Currently I have to deselect the option for the sequences if I changed something in them, then press cleanup (which works mostly ok on everthing that does not include a case structure), and reselct the exclude, so it won't bug out on the next BDC. Still much faster than tediously moving around items pixel by pixel, but nevertheless something that's not really what programming is about.

0 Kudos
Message 10 of 52
(4,204 Views)