Automate AEC workflows using Webhooks with Speckle.
The project template to deploy a Speckle<-->Rhino.Compute workflow and all of the documentation necessary to cook this cake.
The example in this project uses Speckle to panellise a Wall according to custom Revit parameters that control a Grasshopper definition running on rhino-compute.
To test it, follow the instructions below.
- Revit 2023/2024/2025
- Speckle server / account
- A deployed Rhino Compute Server
- A Fly.io account
Speckle Revit Plug-in Installed.
A bot account and its token. I have already deployed a "computebot" that we can all use. After adding it as a collaborator, ask me to accept the invitation to the projects in which you want it to be able to read / write.
Fly.io account - https://fly.io/docs/
Install Lunchbox plug-in (or any required to run your gH definition).
Use example.ghx as a template. Always save as .ghx
Make sure the name of the Revit parameters you use match the ones existing in your Revit file.
- Clone this repo
- Replace
example.ghxwith your own .ghx script. - Change fetch.py to point to your own Speckle Projects and gHscript.
- Generate requirements.txt
pip install pipreqsand thenpipreqs <your-project-dir>
-
Install fly
brew install fly(mac)powershell -Command "iwr https://fly.io/install.ps1 -useb | iex"(windows) -
Authenticate to your account:
fly auth login
- in terminal:
cd <your-project-dir> fly launch- pick app name
- choose region
- Use the
fly.tomlfile provided in this repo (simply change the app name in the beggining to match your own) or make the following changes to the autogenerated file:kill_signal = "SIGUSR1”kill_timeout = 300- before
[env], place:[build] builtin = "python" [build.settings] pythonbase = "3.9-slim-buster"
[env] PORT = "8080"
- Deploy your app -
fly deploy - Wait until
deployed successfully
- Create two Projects and add
computebot(computation@iaac.net) as a collaborator:- Where you will send your geometry:
Send_to_Compute - Where you will receive your geometry:
Receive_from_Compute
- Where you will send your geometry:
- In
Send_to_Computego to Webhooks>New Webhook:- URL: https://
<your-app-name>.fly.dev/webhook - Events:
version_create
- URL: https://
-
Use the example
Project1.rtvor create your own Revit file, don´t forget to create the shared parameters that your gH definition will reference. In this example:- xdir =
Float - ydir =
Float
- xdir =
-
Set
Receive_from_Computeto Auto-Receive if you want to see updates from Rhino.Compute in real time. -
Send your geometry (with parameter information!) to
Send_to_Compute
It is reccomended that you run tests locally before attempting to deploy to Fly. The simplest way to check if yout gH script is properly setup is to edit it and have it run with an Auto-Receive and an Auto-Send (this will mimick the behavior of the compute server). Make sure Auto-Receive is getting its data from the Send_to_Compute Project, and Auto-Send is connected to Receive_from_Compute. If your webhook is property setup, this script will trigger a new commit everytime you send new data do Send_to_Compute.
If this works well, then you need to debbug the Fly-side. Log in to the platform, go into your App Dashboard and check the Logs. You will see print statements that match the ones in main.py.
Las but not least, you can always use ngrok as a webhook mirror to your apps local address and run Rhino.Compute locally.
- In terminal:
ngork http http://0.0.0.0:8080 - Set your Speckle webhook URL as
http://<your-given-hash>.ngrok.io/webhook

