Learn how collaborative parametric design models allow you to work together for better solutions.
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.
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.
You can use the code out-of-the-box with VIKTOR.
When using the web app with VIKTOR, you should:
C:\Program Files\Rhino 7\System\Rhino.exe
app/grasshopper/data/run_grasshopper.batin 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.
Complete the following three steps to parametrically design a football stadium with Grasshopper using the sample application.