Parametric football stadium with Grasshopper

VIKTOR

by VIKTOR

Parametric football stadium Grasshopper
This open-source web app is an example of how you can make Grasshopper scripts more accessible with VIKTOR. Use the application to parametrically design a football stadium through an integration with Grasshopper, without opening the grasshopper interface at all. The sample app provides a clear visualization of the stadium, calculates the maximum number of seats, and lets you download the model as a .gtb file.
Download the white paper and get INSPIRED

Learn how collaborative parametric design models allow you to work together for better solutions.

Pros and cons of Grasshopper

Grasshopper is a strong tool when it comes to 3D modelling and quickly developing scripts to manipulate geometries. Grasshopper seamlessly integrates with Rhino, which makes it possible to visualize changes in 3D models immediately, and is famous when it comes to architecture and BIM. Over the past years, different plug-ins have made it possible to integrate Grasshopper software with other software as well.

However, sharing Grasshopper scripts internally is difficult, and externally impossible without revealing any of your source code. Additionally, managing and processing large amounts of data or performing numerical calculations and matrix operations for the optimization of designs can be difficult as well.

A Grasshopper web app

That is why VIKTOR enables the development of web applications that you can use to link Grasshopper models to an interface and share these with internal and external users without requiring any downloads or knowledge about Grasshopper.

In this article, we give an example of such an application. You can find the open-source Python code in our GitHub repository.

Using the functionality

You can use the code out-of-the-box with VIKTOR.

When using the web app with VIKTOR, you should:

  1. Make sure you have Rhino installed at C:\Program Files\Rhino 7\System\Rhino.exe
  2. Install a generic worker found on https://docs.viktor.ai/docs/worker. Make sure you select generic.
  3. Replace the config.yaml file in your worker folder with the file found at app/grasshopper/data/config.yaml.
  4. Copy the file found at app/grasshopper/data/run_grasshopper.bat in the same worker folder.

Below, you see a snippet of the Python code that shows how little lines of code are needed to run Grasshopper analysis and retrieve files.

1# Run the analysis on grasshopper 2generic_analysis = GenericAnalysis(files=files, executable_key="run_grasshopper,output_filenames=["output.txt", "output.obj", "output.mtl"]) 3generic_analysis.execute(timeout=300) 4 5# Retrieve all files from the analysis 6grass_hopper_data_bytes = generic_analysis.get_output_file("output.txt") 7object_file = generic_analysis.get_output_file("output.obj") 8material_file = generic_analysis.get_output_file("output.mtl")

In the video, you can see how a football stadium is parametrically created through an integration with Grasshopper. On the left side of the application are all input parameters and a download button, in the middle you can see a 3D view of the mesh, and on the right side you can find all calculated information.

Parametric football stadium in 3 steps

Complete the following three steps to parametrically design a football stadium with Grasshopper using the sample application.

  1. Define input parameters, such as the shape, pitch width, offset from pitch, depth factor, asymmetrie along length and width, and height.
  2. Create a 3D model. Based on the input parameters, the field width, field length, and number of seats are calculated.
  3. Download the 3D model. Unfold 'downloads' to download a .glb (Graphic Language Bytes) file of the design.

Parametrically design football stadium grasshopper

illustration of free trial

Start building apps now

Try for free
Share

Related Blog Posts

Connecting Grasshopper & VIKTOR apps

Read more

Enhance Designs and Simulations with Geometry Interaction in VIKTOR

Read more

How to Make Complex 3D Models with Python

Read more

Build and share web apps

Get your free account now
Start for free