Ir al contenido principal

Required Outputs Wizard

It's an old LabVIEW programmer's dream to be able to make VI outputs required, just as can be done with inputs. Some years ago I discovered a way of achieving it, through a deprecated scripting method. I checked with NI staff and they said it was clever but could cause unexpected problems, so I set it aside.

But the time goes by and the functionality is still not available, so here we go, the Required Outputs Wizard is yours. I've been using it on and off for a long time and no errors have arisen, even when applying it to connectors with modern data types, such as classes (OOP). But I guess the risk is still there, so be cautious and test it first with unimportant VIs.

Download (LLB for LabVIEW 2016)

The bowels of the code

So, how it works? Launch the top VI in the LLB, you can leave it there running. When a connected front panel indicator is selected, the "REQUIRED" button will be available. Just press it. Yeah, that's all, now your indicator connection is required. When you use it in another VI and leave it unwired, LabVIEW will launch an error, is quite funny:

Alright, but surely you're asking what's the trick? You can study the code by yourselves, it's pretty straightforward. The magic is in adapt vi.vi, where we get the connector type descriptor, manipulate it at bit level (cautiously, of course) and replicate it in a dummy VI. The we use the scripting SetConPane property to put it in the actual VI. Observe the red color in both connector-pane-by-typedesc functions, indicating they're deprecated.

Going deeper, in correct typdedesc.vi the essential bit is set to true:

Use in LabVIEW IDE

The standard way to add elements is well described here: Integrating into the LabVIEW Menus.

While this works good enough, now I'm thinking we could use the new shortcut menu plug-ins that became available with LabVIEW 2015 to make the process even smoother. I'll try it if I get some free time 馃槈.

Comentarios

Entradas populares de este blog

SNMP library for LabVIEW

SNMP (Simple Network Management Protocol) is a fairly common protocol for communicating with network equipment. It's fast, lightweight and standardized. Unfortunately it's not quite as simple as its name implies and LabVIEW doesn't support it natively.Some years ago I was in the necessity of using SNMP from a LabVIEW system to control some hardware. I started looking for already implemented solutions and found a library developed by Mark Yedinak (great work!). It was useful since it demonstrated it could be done and how, but I needed more control over the operations, so I had to read the protocol down to the low level bytes and implement what I need by myself. Yeah, pretty hard and with time constraints no less. Anyway, here it is.Download (Library in LLB file for LabVIEW 2016)See the examples folder to grasp the basic use. Probably you'll need no more than these sets of VIs to send and retrieve data and to get traps sent by your equipment. To integrate in a program, u…

CIDR to netmask

To begin with, something basic but useful, a LabVIEW VI for converting CIDR suffix to a standard IP mask. As you know, in CIDR format the number after the IP indicates the bits that address uses. If you need to convert to a traditional subnet mask, this VI comes handy.So, a CIDR of 24 will return a 255.255.255.0 mask, 28 is 255.255.255.240, etc. Pretty simple, but a lot of applications demand netmasks in this format.Download (VI for LabVIEW 2016)LabVIEW still only supports IPv4, so I haven't delved into the complexities of IPv6 (we'd need a U128 data type for that).