logo

Connecting to other functions

One of the best things about Hypar is how easy it is to connect functions to each other and build sophisticated workflows.
Image without caption
Functions can do this by defining their Model Output and their Model Dependencies. (We cover more about this idea in the Hypar Core Concepts video)

I want other functions to use the elements my function creates

To allow other functions to depend on your function, all you need to do is specify a model output. With your function open, and the Hypar panel visible, click Edit Function Configuration.
Image without caption
Once the window opens up and loads, go to the Connections tab and choose Edit Function Details.
Image without caption
Choose a name for your Model Output. Any function with a Model Dependency that matches this will be able to access the Elements your function produces.
A function with a dependency on "Box" can access the elements this function produces.
A function with a dependency on "Box" can access the elements this function produces.
πŸ’‘
It's important to note that other functions may also have expectations about the kinds of elements your function produces. For instance, it is typical for a function with a Model Output of Levels to produce elements of type Level and LevelVolume. Take a look at a function's About page and visit its connections tab to see what Element Types it uses.
Once you're done adding element types, choose Save Changes, return to Grasshopper, and click OK.
Image without caption
The Outputs component will now have an input corresponding to the Model Output you specified.
Image without caption

I want to use elements from other functions in my function

To depend on the elements produced by other functions, you need to add a Model Dependency. With your function open, and the Hypar panel visible, click Edit Function Configuration.
Image without caption
Once the window opens up and loads, go to the Connections tab and choose Edit Function Details.
Image without caption
For each type of function you want to depend on, add a new dependency.
πŸ’‘
Turn on "autohide" for a dependency if you want the function you're depending on to be hidden when your function is present β€” useful to avoid overlapping geometry.
This function depends on Envelope and Levels, with an optional dependency on Core.
This function depends on Envelope and Levels, with an optional dependency on Core.
πŸ’‘
The functions you depend on might produce other element types β€” click the function's About button (in the Function Library or in a workflow), go to the Connections tab, and see what Element Types it produces β€” you might want to add these to your Element Types as well. See πŸšͺCreating Elements for details on Element Types.
Once you're done adding element types, choose Save Changes, return to Grasshopper, and click OK.
Image without caption
Your Inputs component will update automatically, with one new input for each dependency you added.
Image without caption
By default, there will be no information coming in through these inputs. You can construct your own example elements and feed them in on the left side, but in general it's easier and more useful to test your function in a workflow to develop against the real outputs of other functions.