From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW APIs Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Annotate Code - Add text to BD and FP?

Hi,

I'm using vi scripting to generate code for a user. I was wondering how I can programmatically annotate the code in the block diagram and front panel so the user understands it better.

Thanks.

0 Kudos
Message 1 of 4
(3,995 Views)

(recanted in favor of a superior answer below)

0 Kudos
Message 2 of 4
(2,942 Views)

You can create free labels fairly easily.  Here is a snippet and a LabVIEW 8.6 version.  You will want to do some positioning to get the labels in the right spots.  That is usually the most tedious part.

CreateFreeLabel.png

0 Kudos
Message 3 of 4
(2,942 Views)

The New VI Object primitive has the ability to drop objects relative to other objects. There are several things you can wire to the "relative position/next to" input on the New VI Object primitive:

  • a point
  • an object reference to create the new object next to
  • a cluster of a reference, offset, etc (image below)

This third style will make it much easier to drop labels next to other objects. Here is a modified version of DFGray's code. Notice the cluster that is wired into the second New VI Object.

CreateFreeLabelRelativeToObject.png

There are some typedefs to make creating this cluster easier but I think we forgot to ship them with scripting. I'll look into seeing if we can get those out somehow (or in a future release). Until then, you can create these clusters by hand. Be sure to copy the relative direction enum around.

0 Kudos
Message 4 of 4
(2,942 Views)