Jump to content

LVOOP .ctl Icon


Recommended Posts

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?

post-10325-12609512496_thumb.png

I had a go at this tag: NI_IconEditor in this class

Class.zip

[LabVIEW 2009]

Did this...

post-10325-126095093056_thumb.png

And saw a bit of text!

post-10325-126095097135_thumb.png

Does anyone know? Or can point me in the right direction?

Cheers

-JG

Link to comment

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:

post-7450-126095742205_thumb.png

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.

Link to comment

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 by vugie
  • Like 1
Link to comment

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 :shifty:

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:

post-10325-126097355266_thumb.png

Link to comment

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.

Link to comment
  • 3 years later...

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.

Link to comment

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.

Link to comment

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.

Link to comment

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.

Link to comment

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.