LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

how to remove VI/Control from class library with scripting?

I want to use LabVIEW scripting for deriving classes from  a base class.

The simple way I do this is to open the base class, save it with a different name to a new folder and then removing all VIs and controls that are not dynamic dispatch VIs. And then adapt the inheritance of the new class.

I can not get the removal working. I can identify the VI/ctl and then invoke DisconnectFromLibrary on  the VI/ctl. However, this does not REMOVE the VI/ctl from the class library.

How can I do this correctly?

Attachment demonstrates the problem:

  • Run the VI
  • close generated class
  • open it again
  • Test.vi is still referenced by library, although it is correctly disconnected from the library.

0 Kudos
Message 1 of 3
(5,498 Views)

Are you being certain to save the library after you call disconnect on the VI?  Depending on how you obtained the reference to the library it might not be prompting for save as it exits memory.

I should have looked at the posted VI before responding.  Give me a bit to look at it and I'll post again.

0 Kudos
Message 2 of 3
(1,344 Views)

Looking into this further, I believe you are correct that DisconnectFromLibrary doesn't do anything to tell it's owning library that it's gone.  This is not the right behavior, and I've filed CAR #353988 to fix it.

In the meantime you can work around this deficiency by using scripting to interact with the project tree for the library instead.  Ask the library for a reference to the items it contains, iterate over those items to find the ones that represent VIs you want to remove, and call ProjectItemSmiley Very Happyelete on the ones you don't want.  That worked for me on my toy example here.

0 Kudos
Message 3 of 3
(1,344 Views)