3.9.20 Key Listener

In certain structural design workflows, it is desirable to switch seamlessly between different views or states of a model in the Rhino viewport without interacting directly with Grasshopper. For these situations, the Key Listener component provides an effective solution.

This component triggers updates to downstream components whenever the user presses Shift plus a function key. Its output "Counter" returns the number of key presses since the definition was opened. By default, the component listens for the Shift + F1 combination. Through the Fn input, you can specify a number between 1 and 12 to make it respond to the corresponding function key.

Fig. 3.9.20.1: Using a Key Listener component for switching free handedly between different views of a model.

Figure 3.9.20.1 illustrates a section of a definition where a Key Listener, combined with a Stream Gate, controls which aspects of the model are displayed. In the first variant, the user cycles through available views by repeatedly pressing Shift + F1. In the second variant, Shift + F1 advances to the next view, while Shift + F2 returns to the previous one.

Last updated