Dan Bookwalter N8DCJ Posted October 15, 2018 Report Share Posted October 15, 2018 (edited) Ok , I would like to programmatically copy a Default class and a Default Test.vi to another folder say , XYZ , rename the Default Test.vi to XYZ.vi, then change its DD terminal from the default class to the newly created XYZ.lvclass and add it to the project. I currently can do everything I need to do , except , after changing the XYZ parent to the Default class I copied it from , add it to the project etc.... When I try to open the newly created/renamed XYZ.vi from the project I get a dialog box that says , "Default.lvclass:XYZ.vi" is at the expected path but it is part of a library. Default.lvclass:XYZ.vi" will be opened but it will be removed from the project". I really need to be able to do this programmatically , we will have hundreds of test cases that will have different functionality but use the Default Test.vi as a starting template , I also have to assume that future users will be totally unaware of classes and how to create/use them... I have a framework that should be very expandable in the future , I just want to automate as much as possible.... <EDIT> I should mention this is in LV2012 <EDIT> TIA Dan Edited October 15, 2018 by Dan Bookwalter N8DCJ added lv version Quote Link to comment
shoneill Posted October 15, 2018 Report Share Posted October 15, 2018 (edited) Right-click the Default class in project and choose "Save As...", then create an unopened copy. You only need to rename the terminaly, but there's a quick drop shortcut available for that somewhere (rename labels). You need to manually change inheritance. Edited October 15, 2018 by shoneill Quote Link to comment
Stagg54 Posted October 15, 2018 Report Share Posted October 15, 2018 (edited) Posting your scripting code, so we can exactly what you are trying to do would be helpful. What you are trying to do should be possible. Not sure if there are some limitations way back in 2012. One thing to check would be: Do you save the class before trying to add it to your project? Edited to add: Since the connection between a member vi and a library is a 2 way connection, make sure you save both. I belive a Save All This Library.vi should handle that (it's in the hidden gems pallette if you have it installed, if not its buried somewhere in vi lib). Edited October 15, 2018 by Stagg54 Quote Link to comment
smithd Posted October 15, 2018 Report Share Posted October 15, 2018 I'd suggest looking at/borrowing from https://github.com/opengds/OpenGDS I believe theres a good amount of class scripting, including (I think) scripting from a template, so it probably has what you need. May have to dig a bit though. Quote Link to comment
Dan Bookwalter N8DCJ Posted October 16, 2018 Author Report Share Posted October 16, 2018 Ok , I decided to start over , turns out there is an invoke node LVClassLIbrary.Save a copy... this copies everything to a new directory , then I just need to replace the control(s) , set the parent and save the whole thing using Save All This Project.vi.... works perfect ... thanks for the pointers .... Dan Quote Link to comment
shoneill Posted October 16, 2018 Report Share Posted October 16, 2018 which is basically just automating what I said above..... Do you really need to change the controls? When you do a Save As from LV, it changes the type of the controls for you..... Quote Link to comment
Dan Bookwalter N8DCJ Posted October 16, 2018 Author Report Share Posted October 16, 2018 8 minutes ago, shoneill said: which is basically just automating what I said above..... Do you really need to change the controls? When you do a Save As from LV, it changes the type of the controls for you..... Yep , basically all I did ... if I don't change the controls , it doesn't work correctly , I will investigate a little more and see if I can eliminate that step... Dan Quote Link to comment
shoneill Posted October 16, 2018 Report Share Posted October 16, 2018 Hmm, maybe the manual "Save As..." and the Programmatic "Save As..." are not equivalent? Or memory fails me. I thought it wasn't neccessary to replace the controls if doing a manual "Save As...". Quote Link to comment
Dan Bookwalter N8DCJ Posted October 16, 2018 Author Report Share Posted October 16, 2018 Well , your memory is working , I went back and disabled the part that replaces the DD control , and it works as expected , I think I will just rename it ... the 2 others on the front panel are of the Default class , (In/out) , it appears I have to replace them as I get the Connector pane doesn't match on the DD vi's if I don't .... it works , so now I will move on to the next issue on my list , I may come back and revisit it at a later date to see if I am doing something not quite correct... Dan Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.