LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI Scripting: Block Diagram Cleanup Selection

I am trying to clean up some cases in my DQMh Controller and want to use scripting.

 

I am currently trying the following code, but it does not seem to be selecting the files (or doing any cleanup).

 

Am I doing the selection incorrectly?

 

Kenny_K_0-1664815066596.png

 

Kenny

0 Kudos
Message 1 of 7
(1,283 Views)

Haven't tried this myself but each Diagram object also has a CleanUp method so when you index Frames[] you might have to run the CleanUp method of that specific diagram.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 7
(1,270 Views)

Here is how I would do:

Block Diagram Cleanup Selection.png

 

1. You can use "TRef Find Object by Label" to directly get your named case structure (requires VIPM toolkit "Hidden Gems" to have it in the function palette).

2. I'm using the Cleanup method from the TopLevelDiagram class, but it should be the same as the one from the VI class, with an extra options input.

Also the Cleanup method from the simple Diagram class is not implemented and always returns an error (so calling it on the frames directly won't work).

3. Selecting AllObjects[] is sufficient, wires are also cleaned up automatically.

4. I only clean up if there is at least 1 object, otherwise it would perform a global cleanup.

5. I'm only recording 1 undo transaction, I don't know if recording a transaction for each case was a requirement...

6. In your case, you may also be careful to close the VI ref at the end since you're opening it explicitly with Open VI Reference.

 

This works with the attached example (LV2020):

Message 3 of 7
(1,242 Views)

This works great, thank you!

0 Kudos
Message 4 of 7
(884 Views)

Nice !

If the answer solved your problem, don't forget to mark it as solution.

Thanks.

0 Kudos
Message 5 of 7
(858 Views)

It solved one of my many problems, if only it would solve them all.

It doesn't appear that I can mark it as the solution as I am not the original poster. I would if I could. 😎

0 Kudos
Message 6 of 7
(836 Views)

Oops, I thought you were the original poster 😅

0 Kudos
Message 7 of 7
(830 Views)