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, 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 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 😉.


Entradas populares de este blog

SNMP library for LabVIEW

Base64 Encoding