How to display text outputs

A how-to guide for displaying text outputs.

Introduction

Would you like to display certain outputs from your Grasshopper model as text, for example to show numerical results? Then add text outputs to your solution by following these steps.

Prerequisites

  • You configured the frames and routes for your solution.
  • You configured the relevant contents such as the model(s), control panel(s), viewer(s) and datastore.
  • You have a Rhino Grasshopper definition using the Text output component(s). See the display text outputs guide for the studio for instructions.

1. Retrieve the outputs from the model

  • Subscribe the control panel to the model
  • Add text outputs with the setOutputs entity.
  • Define type as setText for outputting text.

2. Add text control to the control panel

  • Define controls with names matching the Text outputs in the Rhino Grasshopper definition and kind:Text.
  • Set the text to "" since it is retrieved from the model.

The configuration should look similar to the example below:

params:
  kind: ControlPanel
  controls:
    sphere-volume: # must match GH model output
      kind: Text
      text: ""
    box-volume: # must match GH model output
      kind: Text
      text: ""
  subscribe:
    - kind: Model
      frame: home-frame
      source: model
      setOutputs:
        sphere-volume: # must match GH model output
          type: setText
        box-volume: # must match GH model output
          type: setText

See the image below as an example.

Configuration

See the controlPanelModelSubscribe configuration docs and textControlConfig configuration docs for more information.