Facade design and optimisation using Grasshopper
This is a case study for generating and optimising facade designs in the Generative Platform using Grasshopper.
The Grasshopper file creates a set of houses with variable dimensions and shading, and measures their incoming solar radiation. When connected to the Generative Platform, this allows design space exploration and optimisation.
You can explore the results of an existing optimisation for yourself in the app and use the Grasshopper file to generate more designs.
Explore the project in the app
You can access the results of an existing exploration using this Grasshopper facade design in the app:
- Go to the app.
- Open a copy of the tutorial project ‘Facade design (Grasshopper)‘
Experiment set up
On the Experiment tab, select the most recent Experiment from the dropdown. You can see the parameters that were used to set up that exploration. For the inputs, most variables controlling the house design were allowed to vary. For the outputs, the solar radiation per house was maximised for summer and minimised for winter, while the house area was aimed to be within a certain range and the area of covered decking was set to be above a certain target.
Designs
Navigate to the Designs tab, where you can see an already curated Insight tab. On this page you can also create your own plots and views to explore the data further.
The two plots on the left hand side show the geometry and the winter simulation result of the selected design, allowing you to see each geometry created and the analysis results.
The plot on the right shows the best designs - those that maximise the solar radiation during winter and minimise it during summer, whilst meeting the other constraints. You can see that there’s a trade off to be made between needing more heating in winter and less air conditioning in summer.
In the table on the right, you can see for the selected design what the values for the four key result are.
Generate further results
If you want to generate more designs or extend the functionality, you’ll need to get the Generative Function running locally.
Setup
Make sure you’ve got all the prerequisites installed from the First Experiment tutorial (Windows OS, Rhino 8 or above with the Hops plugin, ASP.NET 7.0, and Python).
Initialise a repository
You need some simple Python code to run a Grasshopper file from the app. Create a repository or folder to store this Python code in.
If you’re using VS Code, see some pointers for help on what you’ll need to know for this step.
Create an empty folder
Call it something like GenerativeEngineering
Open the folder in your IDE
If you’re using an IDE (Integrated Development Environment) like VS Code, open your folder in it.
If you’re not using an IDE, skip this step.
Open a terminal at your folder
If you’re using an IDE, you can most easily do this there.
Make sure the terminal is open at the folder you’ve created. In the terminal prompt you can normally see the folder the terminal is running in.
Install the Generative packages
Install Generative packages generative-core
, generative-server
and generative-server-grasshopper-connector
from pypi.generative.vision.
Open a terminal window, navigate to the folder you created, and run:
If this is successful, the version of generative-server
will be printed.
If you’re not using a virtual environment (venv), this installs Generative packages globally - so you’d only need to do this once per machine. If you are using a venv then you will need to install generative server inside the venv.
Install Generative packages generative-core
, generative-server
and generative-server-grasshopper-connector
from pypi.generative.vision.
Open a terminal window, navigate to the folder you created, and run:
If this is successful, the version of generative-server
will be printed.
If you’re not using a virtual environment (venv), this installs Generative packages globally - so you’d only need to do this once per machine. If you are using a venv then you will need to install generative server inside the venv.
This initialisation method assumes you have a Python package manager set up - see the ‘Advanced’ track in the Setup guide for how to set one up.
The steps given are for UV or Poetry, but will be similar for whichever package manager you’re using.
Initialise package manager
In the same folder, run:
Follow the instructions to initialise an empty repository.
Add the Generative packages
Run the following to install the generative-core
, generative-server
and generative-server-grasshopper-connector
Python packages as dependencies:
Create a folder within your repository
Make a folder, for example called functions
, within your repository.
This will hold your Python code.
Create a Python file within your folder
Create a file, for example called generative_functions.py
within your folder to hold the Python code.
Download and open the Grasshopper file
Download the Grasshopper file to the repository or folder you’ve just created.
Open it and install any missing plugins that Grasshopper prompts you to.
Keep Grasshopper open for the next steps to keep a Rhino Compute server running in the background.
Create the Generative Function
Copy the below to a Python file in the folder or repository created.
Make sure the file path is the correct relative path to where you saved the Grasshopper file.
Start a function server
Run the following command from a terminal at the root of your repository or in the folder your Generative Function is in:
Navigate to the 'Facade design (Grasshopper)' project in the app
Open app
Copy the template project ‘Facade design (Grasshopper)’.
On the Experiment page, make sure the Generative Function available on the function server has been discovered.
Generate more designs!
Edit the Experiment setup as you like and click Generate to explore the design space further!
If you get failed designs, check the troubleshooting page.
More learning
Now you’ve run your first experiment, if you want to learn more, check out the key concepts for using the Grasshopper connector.