LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Undo for Programmatic BD cleanup?

Solved!
Go to solution

I am wondering why a BD cleanup called via an Invoke Node is not un-doable.  Same is true for Remove Bad Wires (scripting method).  Specifically setting up a transaction (scripting again) does not seem to help.

 

Scripting issues I'll probably take up on the scripting board, but the BD cleanup method is fully public.  The other funny thing is that it doesn't seem to trigger a re-trigger a compilation of the VI.  Cleanup (programmatic) removes broken wires, but LV still claims the VI is broken until you run it and it works fine.  Minor nuisance compared to missing the undo option, especially since the "cleanup" is a bit of a roll of the dice.

 

 

0 Kudos
Message 1 of 6
(3,477 Views)

I think the undo needs a user-interaction, and doing someting programmatically is causing no user-interaction.

 

 

Christian

0 Kudos
Message 2 of 6
(3,473 Views)

Christian_M wrote:

I think the undo needs a user-interaction, and doing someting programmatically is causing no user-interaction.

 

 

Christian


I can go in and wreak havoc on the block diagram using scripting, and so long as I properly start and end the undo transaction, I can go to the affected BD and undo the scripting activity.  Something in the BD cleanup method is wiping out the undo transactions.  I don't mind setting up the undo manually, it is a habit I have gotten into, just frustrating that it is all-for-naught.

 

Probably an issue for the scripting experts (are there any?  Seems like a dark art still), I know that this is one method I won't often invoke with the undo safety net.

 

 

 

0 Kudos
Message 3 of 6
(3,464 Views)
Solution
Accepted by Darin.K
If memory serves, either Ton or Darren posted a workaround (probably in the scripting group or here). I believe the trick was to call the cleanup method on the TopLevelDiagram (which is probably owned by the VI's diagram) and not on the Diagram of the VI itself (as in VI.BlockDiagram.TopLevelDiag).

___________________
Try to take over the world!
Message 4 of 6
(3,445 Views)

Thanks, I'll try.  I have asked over on the scripting board as well and will update if I find a solution.

 

Edit:  We have a winner.  Using the scripting method 'CleanUp'  on Diagram.TopLvlDiag is  Undoable.  Thanks!

Message Edited by Darin.K on 11-10-2009 03:13 PM
0 Kudos
Message 5 of 6
(3,442 Views)
As an aside, scripting often does not do many things automatically which are done automatically when manually editing.  Undo is one of those things.  The main reason for this is that scripting is simply a thin layer over the manual editing code.  However, it tends to only expose single functions instead of complex functions.  For example, scripting has always been able to move a single object from anywhere to any other legal place (e.g. move a block diagram constant to a front panel).  However, it was only fairly recently that scripting was able to move groups of objects.  As we have now released scripting externally, expect to see more of these issues cleaned up.  Please continue to let us know when you run into them so we can prioritize the issues.
Message 6 of 6
(3,384 Views)