LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Moving a vi from parent to child class

Highlighted

So, I wrote several vis in a parent class...  then found myself thinking "hmm, these really belong in the child class. I should move them".   

 

Sure, I can create a new vi in the child class, copy/paste over, etc... but I was wondering if anyone had tricks / tools to make doing things like this easier.  I find myself doing it more often than I should.

0 Kudos
Message 1 of 6
(220 Views)

If you have both classes in one project, you can just drag the VI from one class to another.  Then you can do a "Replace" on the class terminals to switch them to the new class, and do a "Save As" on the VI with the "Rename" option to move it on disk to the directory of the new class.  Finally, go to the icon editor and delete the icon for the old class, then copy the icon from the new class from a different VI and paste it in.

Message 2 of 6
(206 Views)

Hm... I didn't think that worked.  I was under the impression that the child class would claim the vi to be part of it, but the vi would still claim to be part of the parent class... though I guess I never actually tested it. That's what I get for assuming.

0 Kudos
Message 3 of 6
(193 Views)

@Kyle97330 wrote:

  Finally, go to the icon editor and delete the icon for the old class, then copy the icon from the new class from a different VI and paste it in.


Actually you can go to the icon editor, Edit -> Import Icon from Owning Library and it will replace the class banner, leaving the other layers alone.

Message 4 of 6
(181 Views)

Well, I did this a couple of times today and it didn't seem like much less effort than just creating a new vi.  Yes it does work, but it doesn't do anything for moving the vi on disk, changing input/output class to child class, etc.  It would be nice to have all of that done by a tool. 

 

It might be a fun little scripting project to do one of these days when I'm sick of doing actual work.

0 Kudos
Message 5 of 6
(161 Views)

The problem is that LV can tell if\where to move the file. There are flavors of file organization. So, it simply doesn't do the move... A rename works.

 

I wouldn't be surprised if any of those fancy OO plugins (G#?, OpenGDS?) have options for this. you might want to check them out before reinventing spending time on scripting, even though it's fun.

0 Kudos
Message 6 of 6
(154 Views)