Loginskip to content

Advanced NXT-G Block Techniques - Part I

news/
software/
NXT Repository/Tutorials/

As promised, I will try to describe for you some “advanced” features of NXTToolkit NXT-G block coding. These features were either omitted from the documentation and examples or just wasn’t put at all due to lack of time and NI desire for clarity. In any case, these are “unofficial” and thus “unsupported” by NI. What does that mean? It means that (a) NI uses these techniques a lot in the NXT-G blocks you have, and (b) they may change the VIs at will without telling us… Anyway, till that happens, there are some very useful tricks you can use to make impressive, smart and user friendly (i.e. Kids friendly) NXT-G Blocks.

So, the first question I’ll answer is:  

How to disable/enable a control if NXT-G diagram terminal is wired ?

Look at the following picture showing the diagram of the Config VI:

IsWired VI

There are several simple steps which you should follow to make the necessary changes:

1. Increase the size of the SubVI Propery node at the left, and select “Terminals[]” property for the new element.
2. Add a VI called “IsTerminalWired.vi”. This VI resides in “LabView\vi.lib\addons\NXTToolkit\Block Templates\Support” directory. Recommended: copy the file into your Block directory, NI may change/remove it in future versions.
3. Wire the Terms[] output and create a constant string with the label of the control/indicator in the Implementation VI you want to check if wired.
4. Right click the control in the Config front panel, select “Create/Propery Node” from the popup menu.
5. Move the new propery node, change it to “Disabled” and set it to Write mode (again, by right clicking on it).
6. Wire the “Disable if Wired” terminal of IsTerminalWired to the Disabled propery node. 

That’s all, folks! A very useful trick, which is used extensively in standard NXT-G blocks.