Below we provide a Grasshopper file containing a pre-built Python node, which connects to the CalcTree API. All you need to do to use the node is set:
- CALCTREE_API_KEY - paste your API key
- CALCTREE_PAGE_ID - paste your Page ID
- Output_param_name - set the output value you want to receive results for.
- Input_param_names - set your input params
- Input_param_values - set your input param values
Download
How to use
To use the pre-built python nodes, you should set up your input data as shown below. Lists of input parameters and values should be entered in csv format in a single line, rather than multiline format.
Here's a video showing how to use CalcTree with Grasshopper
Please note that you cannot use the CalcTree API with your API key on public pages that do not belong to the workspace of which you are a member. For example, to use a published example calculation via the API, you should first duplicate the page into your own workspace, making a private version of the page, and using this new pages ID in API calls.
Multiple Inputs
To update multiple inputs in one call, their names and values should be respectively formatted as one line of variables separated by commas. For example:
- Parameter input panel: param1, param2, param3
- Values input panel: param1_value, param2_value, param2_value
Troubleshooting
Problem: I filled out all of the input panels in the GrassHopper example project, but the output panels didn't get updated
GrassHopper example before filling with data
Solution: Sometimes GrassHopper fails to run the Python node, therefore it doesn't update the output panels. Restarting Rhino solves this issue.
GrassHopper example with example data
The calculation used in the above example