jgcode Posted December 16, 2009 Report Share Posted December 16, 2009 Howdy Following along the lines of this topic... does anyone here know how to change the icon of a LVOOP class .ctl or are they able to read the data in a tag in the XML file? I had a go at this tag: NI_IconEditor in this class Class.zip [LabVIEW 2009] Did this... And saw a bit of text! Does anyone know? Or can point me in the right direction? Cheers -JG Quote Link to comment
Ton Plomp Posted December 16, 2009 Report Share Posted December 16, 2009 Here's a method to open the actual control: I haven't checked if you can edit the icon with this ref. Ton 1 Quote Link to comment
vugie Posted December 16, 2009 Report Share Posted December 16, 2009 Howdy Following along the lines of this topic... does anyone here know how to change the icon of a LVOOP class .ctl or are they able to read the data in a tag in the XML file? I had a go at this tag: NI_IconEditor in this class Does anyone know? Or can point me in the right direction? Cheers -JG By taking a subset of this data and reading it as RGB data I got following picture: There is also NI.Lib.Icon tag, but after unescaping its content its size is only 727 bytes and plain text coded. I have no idea how it may be coded. Quote Link to comment
jgcode Posted December 16, 2009 Author Report Share Posted December 16, 2009 Here's a method to open the actual control: I haven't checked if you can edit the icon with this ref. Ton Yes you can! Quote Link to comment
jgcode Posted December 16, 2009 Author Report Share Posted December 16, 2009 By taking a subset of this data and reading it as RGB data I got following picture: Hi Vugie! Could you please post screenshot? Cheers -JG Quote Link to comment
Daklu Posted December 16, 2009 Report Share Posted December 16, 2009 does anyone here know how to change the icon of a LVOOP class .ctl Right-click -> Edit Icon. (Sorry, couldn't resist. ) Quote Link to comment
vugie Posted December 16, 2009 Report Share Posted December 16, 2009 (edited) Hi Vugie! Could you please post screenshot? Cheers -JG I didn't save it, but it's pretty simple: Get subset of data starting with many zeros (it is black line) - I had to remove one or two starting zeros to get straight image. Now for 1024 times (32*32) scan for 3 integers and join them with "RGB to Color.vi". You'll get 1024 long U32 array. Reshape it to 32x32 and draw as unflatten pixmap. But this image doesn't look like icon - it hasn't a border. I think that icon is coded within NI.Lib.Icon tag - there is no NI_IconEditor tag in classes I made in 8.2 Edited December 16, 2009 by vugie 1 Quote Link to comment
jgcode Posted December 16, 2009 Author Report Share Posted December 16, 2009 I didn't save it, but it's pretty simple: Get subset of data starting with many zeros (it is black line) - I had to remove one or two starting zeros to get straight image. Now for 1024 times (32*32) scan for 3 integers and join them with "RGB to Color.vi". You'll get 1024 long U32 array. Reshape it to 32x32 and draw as unflatten pixmap. But this image doesn't look like icon - it hasn't a border. I think that icon is coded within NI.Lib.Icon tag - there is no NI_IconEditor tag in classes I made in 8.2 Thanks Daklu Vugie Are you a genius? I think so! Thanks I understand what you mean now - great description That is the banner for the library you have reconstructed. Here it is: Quote Link to comment
Aristos Queue Posted December 16, 2009 Report Share Posted December 16, 2009 The tag is nothing special. It's the same tag used by all VIs for the Icon Editor. Go use the VIs there to manipulate it. Quote Link to comment
Francois Normandin Posted December 16, 2009 Report Share Posted December 16, 2009 Howdy Following along the lines of this topic... does anyone here know how to change the icon of a LVOOP class .ctl or are they able to read the data in a tag in the XML file? I know I'm late in this topic, but there's a utility in the CR that you can use to ease your pain: LVClass API. Quote Link to comment
jgcode Posted December 17, 2009 Author Report Share Posted December 17, 2009 I know I'm late in this topic, but there's a utility in the CR that you can use to ease your pain: LVClass API. Thanks François, I have downloaded this ages ago but forgot about it. I will revisit it... Quote Link to comment
Aristos Queue Posted December 17, 2009 Report Share Posted December 17, 2009 For the record, the icon directly in the .lvclass file is just the icon of the library itself. The icon of the .ctl file is embedded in the private data control, which is itself an entire .ctl file embedded inside the .lvclass file. Unfortunately, you can't just copy/paste that text directly into another file -- its a binary file that has been escaped in order to be saved inside the .lvclass file. Assuming you can somehow extract that from the .lvclass file, there are ways of extracting the icon of a VI without loading it into memory (I forget the name of the VI Server method that does this, but it does exist). I would *not* try loading the .ctl into memory directly -- control VIs that are tagged as private data controls make a lot of assumptions about the conditions under which they are loaded (notably that their owning library exists and is already in memory) and you'll almost certainly crash before the load finishes. But reading the icon data out of the file should work. Again -- the easiest way would be to just load the class into memory and then use the Icon Editor VIs to edit the icon. Quote Link to comment
jgcode Posted December 17, 2009 Author Report Share Posted December 17, 2009 Thanks AQ Quote Link to comment
PJM_labview Posted May 15, 2013 Report Share Posted May 15, 2013 Reviving that thread... ... its a binary file that has been escaped in order to be saved inside the .lvclass file.... I am wondering if anybody got more information about the escape (or encoding) mechanism. Nothing obvious (such as base64 for instance) comes to mind looking at it. I would love to be able to get (read) the class icon without loading the class in memory. Quote Link to comment
Darin Posted May 15, 2013 Report Share Posted May 15, 2013 Histogram it and you will immediately see that it is a form of Base-64 encoding. Shift back to zero (I forget the offset), extract the six real bits from each value, and repack into bytes and it is all right there. There is a deflate step which was added in LV8.6 I believe. I create Windows thumbnails of vi,ctl,lvclass,lvlib, and xctl files by reaching in and getting the icon. Quote Link to comment
PJM_labview Posted May 16, 2013 Report Share Posted May 16, 2013 Thanks Darin this will be useful. I think that the data need to be un-escaped too because I see a bunch of text like & and so on. On a side note, I did an histogram of the data but I did miss the 64 bit pattern.. Quote Link to comment
Darin Posted May 16, 2013 Report Share Posted May 16, 2013 Use the built-in parser to get the XML element and you do not have to worry the escaping. If I were you I would grab the icon element from the monster class, insert it into an empty class file and use the built-in functions. Quote Link to comment
PJM_labview Posted May 16, 2013 Report Share Posted May 16, 2013 Ya, I use the built-in parser to do that too. I am not entirely sure by what you mean about putting the icon from the "monster" class into an empty class but my goal is not to have our developer do extra work in order to be using an internal tool that, among other thing, get library thumbnails. Quote Link to comment
Darin Posted May 16, 2013 Report Share Posted May 16, 2013 I assume you are eschewing the built-in methods because opening the class involves the subsequent loading of a large number of VIs. What I have also done instead is get the class icon data from the lvclass XML file and replace the icon data in the XML file of a blank class or library. Now use the built-in functions to load the blank class file and get the icon image. The loading is pretty fast on a blank class or library. 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.