Francois Normandin Posted August 6, 2008 Report Share Posted August 6, 2008 I'm trying to get the class hierarchy of many lvclass files that are not loaded in memory (some kind of plugin architecture). However, I could not find a way to do it without using VI scripting. It's simple to get the answer if I drop the object constants on the block diagram, . My goal is to read the directories, find all lvclass files and extract their hierarchy. Using "To More Specific Class" to compare to existing classes prior to code distribution and monitoring errors is okay, but I don't know if the user has added/cloned a new class to extend functionalities. Actually, it's a feature of the code I'm developing (cloning and editing a template class). When reading a lvclass file using "Get LV Class Default Value.vi", I end up with the generic LV Object and cannot detect hierarchy because I cannot typecast. (not knowing what is the object type I need to typecast) The snapshot above is a temporary VI that I create using scripting and it works fine. But I found it executes in about 50ms and I need to loop it (n^2) where n is the number of classes it detects. For 8 classes detected, it takes more than 3 seconds... Is there a simpler way to achieve this? Here's the code (sorry: LV 8.6 already!) :thumbup: Download File:post-10515-1217971233.zip Quote Link to comment
Yair Posted August 7, 2008 Report Share Posted August 7, 2008 I'm not an 8.x user, so I don't have any experience with this, but here are a couple of guesses: Give each class a method returning its name. Then, use the call parent implementation node on the class you loaded and you will get the name of its parent. Hack the lvclass file. The parent seems to be in there, but its data is binary. Quote Link to comment
Francois Normandin Posted August 7, 2008 Author Report Share Posted August 7, 2008 QUOTE (Yair @ Aug 6 2008, 01:44 PM) Hack the lvclass file. The parent seems to be in there, but its data is binary. I thought it was in that file. I'll give it a shot. thanks EDIT: lvclass is an XML file, however its properties are not text. I think this is the one I need to sort out: <Property Name="NI.LVClass.ParentClassLinkInfo" Type="Bin">#'#!!1!!!!)!"1!&!!!-!%!!!@````]!!!!"!!%!!!!Q!!!!!1Z198*F<H1O<(: D<'&T=Q"16%AQ!!!!&!!"!!)!$F"B=G6O>#ZM>G.M98.T!!!!!!</Property> I'll spend a nice evening tonight... Quote Link to comment
Darren Posted August 7, 2008 Report Share Posted August 7, 2008 Here's a VI that will give the top-down inheritance hierarchy of a .lvclass file. It reads the linkage information from the file on disk, so there's no VI Server or scripting code (although I do use a private method to get the linkage info, so the VI is password-protected). I tested the VI in 8.5 and 8.6 and it seems to work. Hope this helps, -D Quote Link to comment
Francois Normandin Posted August 7, 2008 Author Report Share Posted August 7, 2008 QUOTE (Darren @ Aug 6 2008, 04:35 PM) Here's a VI that will give the top-down inheritance hierarchy of a .lvclass file. It reads the linkage information from the file on disk, so there's no VI Server or scripting code (although I do use a private method to get the linkage info, so the VI is password-protected). I tested the VI in 8.5 and 8.6 and it seems to work.Hope this helps, -D Works like a charm. I'll echo Chris: "How do you find the time during NI Week?" :thumbup: Quote Link to comment
Darren Posted August 7, 2008 Report Share Posted August 7, 2008 QUOTE (normandinf @ Aug 6 2008, 04:15 PM) I'll echo Chris: "How do you find the time during NI Week?" :thumbup: My week was very heavily front-loaded due to all the prep work for the Tuesday keynote. I've still got stuff going on today and tomorrow, but the hardest stuff is over (for me, anyway). -D Quote Link to comment
Darren Posted April 27, 2010 Report Share Posted April 27, 2010 It looks like my attachment to this thread was lost during the LAVA site redesign. Here it is again (saved in LabVIEW 8.6). -D Get Class Hierarchy from Disk.vi 1 Quote Link to comment
Jon Kokott Posted April 27, 2010 Report Share Posted April 27, 2010 It looks like my attachment to this thread was lost during the LAVA site redesign. Here it is again (saved in LabVIEW 8.6). -D I've seen a couple of these VI's which return the class hierarchy floating around but in all cases they are locked. Where is this VI coming from? Does anyone know what it is actually doing? I really can't use a VI that is locked unless it comes with LabVIEW or is released by NI in some form. ~Jon Quote Link to comment
Darren Posted April 27, 2010 Report Share Posted April 27, 2010 I've seen a couple of these VI's which return the class hierarchy floating around but in all cases they are locked. Where is this VI coming from? Does anyone know what it is actually doing? I really can't use a VI that is locked unless it comes with LabVIEW or is released by NI in some form. The VI uses a private VI Server method that can read linkage information from the .lvclass file on disk. As a general rule, we (that is, LabVIEW R&D) password-protect any VIs that contain private functionality when we post them on public forums. -D Quote Link to comment
Jon Kokott Posted April 27, 2010 Report Share Posted April 27, 2010 The VI uses a private VI Server method that can read linkage information from the .lvclass file on disk. As a general rule, we (that is, LabVIEW R&D) password-protect any VIs that contain private functionality when we post them on public forums. -D Will this VI be part of LV2010 or is it allready in LV2009? -on 8.6 for now... Quote Link to comment
Darren Posted April 27, 2010 Report Share Posted April 27, 2010 Will this VI be part of LV2010 or is it allready in LV2009? -on 8.6 for now... To my knowledge, this VI does not ship with LabVIEW. I wrote it myself for this thread back in '08, and it's been sitting in my "VI_Utils" folder on my computer ever since. -D Quote Link to comment
Jon Kokott Posted April 28, 2010 Report Share Posted April 28, 2010 To my knowledge, this VI does not ship with LabVIEW. I wrote it myself for this thread back in '08, and it's been sitting in my "VI_Utils" folder on my computer ever since. -D Darren, I find myself creating decendent classes quite often and have wanted to automate the creation of these (using vi scripiting.) Do you have any fancy private VI's that would assist me in doing this? ~Jon Quote Link to comment
Darren Posted April 28, 2010 Report Share Posted April 28, 2010 I find myself creating decendent classes quite often and have wanted to automate the creation of these (using vi scripiting.) Do you have any fancy private VI's that would assist me in doing this? There is a private property of the LVClassLibrary class called "ParentClass" that lets you set the parent of a given LV Class. I asked the architect of LV Classes about this property, and he said: "The ParentClass property should have been public all along. It is public in LV 2010." So I see no reason not to share it. Here's a VI saved in 8.6 that contains the applicable property nodes. -D ParentClass Property.vi Quote Link to comment
Francois Normandin Posted April 28, 2010 Author Report Share Posted April 28, 2010 There is a private property of the LVClassLibrary class called "ParentClass" that lets you set the parent of a given LV Class. I asked the architect of LV Classes about this property, and he said: "The ParentClass property should have been public all along. It is public in LV 2010." So I see no reason not to share it. Here's a VI saved in 8.6 that contains the applicable property nodes. -D Great, now I can upgrade the LVClass API in CR to its latest version without infringing some taboo. Quote Link to comment
Jon Kokott Posted April 28, 2010 Report Share Posted April 28, 2010 Really appreciate the help guys. I'll put this to good use. ~Jon Quote Link to comment
Genki Posted June 7, 2010 Report Share Posted June 7, 2010 How is the LVClass object reference generated for this property node? Best regards, Chris Quote Link to comment
Darren Posted June 7, 2010 Report Share Posted June 7, 2010 How is the LVClass object reference generated for this property node? Here's the easiest way I can think of: -D Quote Link to comment
Francois Normandin Posted June 7, 2010 Author Report Share Posted June 7, 2010 How is the LVClass object reference generated for this property node? Best regards, Chris Invoke Node >> LabVIEW Class >> Open 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.