One of the best things about Hypar is how easy it is to connect functions to each other and build sophisticated workflows.
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.
Once the window opens up and loads, go to the Connections tab and choose Edit Function Details.
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.
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.
The Outputs component will now have an input corresponding to the Model Output you specified.
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.
Once the window opens up and loads, go to the Connections tab and choose Edit Function Details.
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.
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.
Your Inputs component will update automatically, with one new input for each dependency you added.
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.
See Debugging your function for details!