Jump to content


Photo
- - - - -

Code snippets don't always work


  • Please log in to reply
6 replies to this topic

#1 EricLarsen

EricLarsen

    Very Active

  • Members
  • PipPipPip
  • 60 posts
  • Version:LabVIEW 2011
  • Since:1992

Posted 25 February 2010 - 05:36 PM

I suspect there is a simple answer to this, but I'll be darned if I can figure it out. Why don't code snippets always work? For example, I can drag and drop every snippet on this page just fine:

http://zone.ni.com/d...a/tut/p/id/9330

But when I try and drag and drop this snippet:

http://decibel.ni.co...t/docs/DOC-9812

I get the "circle with a line through it" cursor. No error, no explaination, just no drop. It happens all the time on snippets. Is it a version issue? I'm using LV9f2.

#2 neBulus

neBulus

    LV Survivalist

  • Members
  • PipPipPipPipPipPip
  • 1,389 posts
  • Version:LabVIEW 2009
  • Since:2009

Posted 25 February 2010 - 05:44 PM

I suspect there is a simple answer to this, but I'll be darned if I can figure it out. Why don't code snippets always work? For example, I can drag and drop every snippet on this page just fine:

http://zone.ni.com/d...a/tut/p/id/9330

But when I try and drag and drop this snippet:

http://decibel.ni.co...t/docs/DOC-9812

I get the "circle with a line through it" cursor. No error, no explaination, just no drop. It happens all the time on snippets. Is it a version issue? I'm using LV9f2.

Snippets only work ofr the most trivial examples. Virtually every Snippet that uses a property nodes is bad because it repalce the explicitly linkedproperty node with a ref and a property node where the ref is not for the original control.

If you want to make it work, pop-up on the control and select create ref and use THAT ref instead of the one used in the Snippet.

Confirmed bug by the way,

Ben





#3 EricLarsen

EricLarsen

    Very Active

  • Members
  • PipPipPip
  • 60 posts
  • Version:LabVIEW 2011
  • Since:1992

Posted 25 February 2010 - 06:19 PM

Thanks for the reply, Ben

Property nodes may be part of it, but I found some other examples that also don't work. This one uses a strict type def which may be causing the problem:

http://decibel.ni.co.../state-machines


This one, even the 2-D array constants (which worked in the link in the orginal post) don't work:

http://decibel.ni.co...t/docs/DOC-6108

#4 neBulus

neBulus

    LV Survivalist

  • Members
  • PipPipPipPipPipPip
  • 1,389 posts
  • Version:LabVIEW 2009
  • Since:2009

Posted 25 February 2010 - 06:27 PM

Thanks for the reply, Ben

Property nodes may be part of it, but I found some other examples that also don't work. This one uses a strict type def which may be causing the problem:

http://decibel.ni.co.../state-machines


This one, even the 2-D array constants (which worked in the link in the orginal post) don't work:

http://decibel.ni.co...t/docs/DOC-6108


Just look at Snippets as if they where a "Public BETA" for the time being. THe good news is that "Create Sub-VI" did not get damaged along the way. Posted Image

Ben






#5 smenjoulet

smenjoulet

    Very Active

  • Premium Member
  • 125 posts
  • Location:Dallas, TX
  • Version:LabVIEW 2010
  • Since:1992

Posted 25 February 2010 - 07:32 PM

Eric, Ben,
The issue in this case is not with VI snippets, but how they are attached and/or displayed in forums or web pages. Often the image is just a placholder for the real image file. The placeholder image doesn't contain any of the VI code for the snippet feature to work. When you drag it, you get the circle with line through it (operation not allowed).

When you find these cases, right click on the image and select "Save Target as..." (not "Save Picture as...") to save it to you computer. Then drag the resulting image file to your LabVIEW VI and the snippet should work fine.

I was able to get all the snippets you referenced into LabVIEW, though some searched for missing VIs or typedefs that aren't saved in the snippet.

-Scott
Simple <> Easy. Just because it may be simple, does not mean it is easy!

#6 Ton Plomp

Ton Plomp

    How many lines per hour? Zero!

  • Premium Member
  • 1,973 posts
  • Location:Netherlands
  • Version:LabVIEW 2012
  • Since:2000

Posted 25 February 2010 - 07:57 PM

I suspect there is a simple answer to this, but I'll be darned if I can figure it out. Why don't code snippets always work? For example, I can drag and drop every snippet on this page just fine:

http://zone.ni.com/d...a/tut/p/id/9330

But when I try and drag and drop this snippet:

http://decibel.ni.co...t/docs/DOC-9812

I get the "circle with a line through it" cursor. No error, no explaination, just no drop. It happens all the time on snippets. Is it a version issue? I'm using LV9f2.

Your second image doesn't look very 'sharp' an indication the image is rescaled. A good image editor would remove the VI snippet during the scaling. (here's why)

Ton

#7 neBulus

neBulus

    LV Survivalist

  • Members
  • PipPipPipPipPipPip
  • 1,389 posts
  • Version:LabVIEW 2009
  • Since:2009

Posted 25 February 2010 - 08:07 PM

Eric, Ben,
The issue in this case is not with VI snippets, but how they are attached and/or displayed in forums or web pages. Often the image is just a placholder for the real image file. The placeholder image doesn't contain any of the VI code for the snippet feature to work. When you drag it, you get the circle with line through it (operation not allowed).

When you find these cases, right click on the image and select "Save Target as..." (not "Save Picture as...") to save it to you computer. Then drag the resulting image file to your LabVIEW VI and the snippet should work fine.

I was able to get all the snippets you referenced into LabVIEW, though some searched for missing VIs or typedefs that aren't saved in the snippet.

-Scott


Confession time!

I only looked at the links from the original post and the second one takes you to "Groovy Thermometer" which simply can not work.

Ben