Jump to content
Sign in to follow this  
LAVA 1.0 Content

Using SuperSecret to Access Palettes

Recommended Posts

I had a bit of free time today and started to look at and think about the Palette API and the Polish VIs.

I then thought about my feable attempt to create a library of [wiki]Block Diagram Images[/wiki] and all the cut/paste/save & name and then TRIED to create a VI that would extract the images for a given palette using the LabVIEW name.

It's simple to get the icon image for a VI, but the "built-in" functions expose their graphics as a 1D array of U8s. I'm not a bitmap/image type of guy, so here is what I've got so far.

I used LabVIEW 8.2 and the SuperSecret?! ini setting to access the Palettes:Get Menu Information method.

http://forums.lavag.org/index.php?act=attach&type=post&id=6181

Share this post


Link to post
Share on other sites

QUOTE(LV Punk @ Jun 21 2007, 12:56 PM)

...but the "built-in" functions expose their graphics as a 1D array of U8s.

Wow, I'm impressed. I tried to reverse-engineer the palettes a few months ago with that method and I didn't get nearly as far as you. Looks like your images are correct other than the coloring, which is a lot farther than I was able to get. Anyway, here's a hint I learned...if you write the U8 "image" array of a palette object to a binary file, you'll have a .emf file that contains the palette image of that object. I studied the .emf file format and was able to extract all the header information in G, but I gave up when I tried to start parsing the actual .emf drawing commands that appear in the file after the header. At that point I looked around for a G-based EMF file reader, and the only one I could find was in George Zou's G Toolbox. And at that point, I actually took a different direction in the project and didn't need to take the EMF approach anyway.

Nice work,

-D

Share this post


Link to post
Share on other sites

I've played a bit more, I've created a VI to parse out the EMF header and the BitBLT record types. An Image Data instance is created that can be added to a standard LV picture.

See attached...

I wrote the EMF files to disk as Darren's post suggested, and I could view them with M$ utils, but the background of the "built-in" functions doesn't seem to map. I've been playing with the EOF record from the EMF file and trying to apply that to the colors section of Image Data but no luck.

http://forums.lavag.org/index.php?act=attach&type=post&id=6324

Share this post


Link to post
Share on other sites

QUOTE(LV Punk @ Jul 6 2007, 08:18 PM)

Just a suggestion, but if the aim is to generate images of all possible block diagram objects, why not use vi scripting to generate each possible object one by one, then use the bounds property of the GObject class and the Block Diagram image method of the vi-class to get a flattened pixmap of the created BD object ? (A word of warning, I tried to do this quickly but keep crashing LabVIEW - I suspect it doesn't particularly like me trying to create and delete one of every possible object on the same BD in one run...)

Edit: Ok - I've generated png for all the LV objects that I can do without LV crashing on me - here they are if someone wants to sort them into catagories (perhaps that can be done using the pallete menu api to work out which images belong where...)http://forums.lavag.org/index.php?act=attach&type=post&id=6325

Share this post


Link to post
Share on other sites

I've been trying to accomplish a couple of things; create a wiki libary of block diagram components, learn a bit more about LabVIEW picture controls and spend some time looking at undocumented features.

I think I'm starting to snag my shirt on these "Rusty Nails". I'm gonna experiment a bit more, but considering the fact that an NI guy like Darren (post above) took a different path tells me that there is a better way of doing this and that there isn't much chance of accomplishing anything useful.

I did learn that you can't use Get VI.Icon on an XNode; the Get Palette Info cluster indicates that the Path Item Type is VI but the method doesn't work; the U8 array does contain the image though (with the same transperancy/color table issue I have with the other built-ins...)

Share this post


Link to post
Share on other sites

QUOTE(LV Punk @ Jul 9 2007, 06:17 AM)

I did learn that you can't use Get VI.Icon on an XNode; the Get Palette Info cluster indicates that the Path Item Type is VI but the method doesn't work; the U8 array does contain the image though (with the same transperancy/color table issue I have with the other built-ins...)

Hm... you should probably file a bug report on this.

Share this post


Link to post
Share on other sites

QUOTE(Aristos Queue @ Jul 9 2007, 09:37 AM)

Hm... you should probably file a bug report on this.

The error occured on the file

C:\Program Files\National Instruments\LabVIEW 8.2\vi.lib\regexp\Match Regular Expression.xnode

The error reported was:

Error 8 occurred at Invoke Node in Palette Icon Extractor.vi

Possible reason(s):

LabVIEW: File permission error. You do not have the correct permissions for the file.

=========================

NI-488: DMA hardware error detected.

Method Name: Get VI:Icon

Error 8 occurred at Invoke Node in Palette Icon Extractor.vi

Possible reason(s):

LabVIEW: File permission error. You do not have the correct permissions for the file.

=========================

NI-488: DMA hardware error detected.

I did poke around a bit and found this VI; Match Regular Expression_Image.vi. It creates an LV image of the function for use on the block diagram.

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
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.

Sign in to follow this  

×
×
  • Create New...

Important Information

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