10-03-2022 11:38 AM
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?
10-03-2022 11:52 AM
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.
10-03-2022 01:09 PM - edited 10-03-2022 01:22 PM
Here is how I would do:
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):
06-08-2023 02:19 PM
This works great, thank you!
06-09-2023 02:53 AM - edited 06-09-2023 02:54 AM
06-09-2023 09:13 AM
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. 😎
06-09-2023 10:13 AM