Blog

Creating Cluster Type Def’s

Written by Ben Rayner | Nov 21, 2023 3:52:04 AM

I often find myself having to define cluster type def’s for use by sub-VI’s. On large clusters, the defining can be cumbersome because LabVIEW wants to add a number to controls that you control copy. The smart way to approach this is to control-copy the controls from the original GUI, and drop them directly into the cluster container. Since it is inside the cluster, LabVIEW does not change the name.

But when you want to use control refs, it gets more complicated. For control refs (like when you want to manipulate a GUI from a sbu-VI) you can pop-up on the control terminal (on BD) and select “Create ref”. The names of the refs match the original control (see Figure 1).

Figure 1 Control References

So far so good right? However, then you need real controls that can be dropped in the cluster container. I had previously accomplished this by right-clicking on the ref and selecting “Create Control” to get the correct ref type. The problem with this is the new control ref has the number “2” appended to the name. So, I would have to go through all the labels and edit out the “2”. Well, not anymore!

If you drop a “bundle” (NOT a BUNDLE-BY_NAME) on the diagram and just wire all the control refs to it (see Figure 2), and then right-click on the middle terminal and select “Create Control,” the result is a control of the proper type ready to be saved as a type def (see Figure 3).

Figure 2 Control References Wwired to a Bundle Node

Figure 3 Cluster Defined by the Bundle Node

We can then make that cluster a type def, and after saving it, we can right-click the “bundle” node and select “Replace with Bundle By Name”.

I hope this helps you save time as it has done for me.

Ben Rayner
LabVIEW Champion, Knight of NI, CLA