LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Odd Snippet

seen Herehttp://forums.ni.com/ni/board/message?board.id=170&thread.id=467574

Hmmm.PNG

funest.png

Why two tunnels?

Why is the ref not passed on a SR?

Why the conversion at all?

BUG?<<<Code error on bad referance Snippet does not run correctly

Message Edited by Jeff Bohrer on 01-12-2010 12:04 PM

"Should be" isn't "Is" -Jay
0 Kudos
Message 1 of 7
(2,987 Views)
The creation of the reference is a known behavior for the snippet creation. Not sure about the double tunnels, though.
0 Kudos
Message 2 of 7
(2,979 Views)

To get a snippet that is NOT broken I had to code THIS to do the original

WOW WTF?

 hmmmm2.png


"Should be" isn't "Is" -Jay
Message 3 of 7
(2,967 Views)
Hahah, deliberate Rube Goldberg?
Cory K
0 Kudos
Message 4 of 7
(2,962 Views)

This is very similar to what happens when you copy code to the clipboard. The clipboard doesn't support the implicit property node binding (perhaps because there really isn't a front panel in the clipboard), so it disconnects all implicit property nodes and references.

 

A similar thing would happen if you created a subVI from the selected block diagram area instead of creating a snippet.

 

I am guessing the snippet function piggy-backs on one of these existing routines to get the intermediate code that gets copied to the PNG file.

Jarrod S.
National Instruments
0 Kudos
Message 5 of 7
(2,947 Views)

Cory K wrote:
Hahah, deliberate Rube Goldberg?

It's not RG if it is the simplest way to make a snippet that works is it?Smiley Wink

 

Still- the behavior needs a look into Smiley Sad I don't mind if implicit nodes are change to explicit nodes but I DO MIND when a snippet of functioning code is broken. Smiley Tongue

 

The Irony of the String indicator name just struck me.....funny

Message Edited by Jeff Bohrer on 01-12-2010 05:12 PM

"Should be" isn't "Is" -Jay
0 Kudos
Message 6 of 7
(2,914 Views)
Jarrod is correct, the Snippet creation code borrows from the Create Sub-VI method. I am a fan of the method used by the CCT, so that is my first reccommendation. When I 'roll my own' snippets I also check for implicit property nodes and automatically add them to the selection. This avoids the switch that can occur with copy and paste.

As an aside, some people preferred the create subVI method to my copy/paste version so I rolled my own using that method as well. I found a little trick to fix this reference problem and it handles this case well. I don't remember what it was, but while testing this method I encountered yet another annoyance with the snippet behavior. At this point I threw up my hands. I am on my iPhone now, so maybe I will post my code when I return home and get a chance to hide the brown parts.
0 Kudos
Message 7 of 7
(2,892 Views)