LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting binary information from PNG decoration on BD

The latest version of the Code Capture Tool makes wonderful snippets in LabVIEW versions as far back as 7.0, but only LV 2009 users benefit from them.  With Ton's help, I wrote a VI to extract the VI information from a CCT generated PNG file, allowing me to use pre-2009 snippets in LV 8.6.  The next step I'd like to take is to convert the PNG to code directly on the block diagram.  So, I have two questions:

  1. How can I get from a BD reference of a PNG decoration to the binary information inside the PNG file?  (The snippet below is from the beginning of my RCF plugin.)
  2. I've thought that I could write a JKI RCF plugin to convert this decoration into actual code, but this is one extra step that I'd rather eliminate.  Is there any way to detect a PNG dropping on the BD?

Thanks,

Jim

GetSnippet - Plugin -_BD.png

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 1 of 3
(3,345 Views)

It is funny that you struck upon this method of extracting the snippets.  When I originally started probing snippets I explored various ways to get them back out in earhtlylier LV versions and this is one of them that I explored.  It is not bad, I slightly prefer the helper application I included on the NI rforum thread.  Anyway, here is some code I threw together way back when, and like my other snippet/fragment software it is written during coffee breaks, etc. so debugging and style points were not high on my list.  You can either pass a VI name or reference and it will convert all snippets on the BD to their code equivalents, some crude version control is included as well.  Seems to work reasonably well, you may want to polish it up a little.

I use the size information to link the snippets to the corresponding decoration reference, potential for trouble with two different snippets with exactly the same size.

Let me know if this helps.

As to detecting the drop, I also went down that path.  It takes a little work to get Windows Messaging set up, but it finally worked for me with one caveat.  I could not intercept drops if LV was already handling it, for instance, a block diagram in edit mode.  I could drop snippets just fine in LV8.6 and 8.2 as long as the target BD was not in Edit mode.  Not preferred behavior and I didn't really dig any deeper.  Fun to see, nonetheless.

0 Kudos
Message 2 of 3
(2,531 Views)

Thanks, Darin.

I quickly tested (as a JKI RCF plugin) it and it looks like just the thing I need.

Jim

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 3 of 3
(2,531 Views)