Goal of the Semester Project
I am part of a non-profit project called Kashitu School. This project works in a rural part of Sub-Saharan Africa, specifically in Zambia. We are working on the project with the local community, designing it in winter and realizing it in summer. Each year we encounter the same problem when preparing the roof plan. After three construction periods, we have settled on the principles that the structure should have, which are doable for both us and the locals. However, in the design process it always takes us a while before we can rule out all the options. That is where this script could come in handy for us, because it can be used for all the buildings in the future.

First-Year Truss — Photo Credit: Jan Stárek

Initial Sketches
Research
I wanted to write a script that would allow me to define the base of the truss (representing the ring beam) and the top surface or plate (representing the overall design of the roof).
This video shows how to work with the roof surface as an outline for the truss.
Working with a Truss Defined by a Single Curve
My script

The script merges the two together. There are components that work with the shape of the roof based on the shape, size, and orientation of the surfaces in its first part. In another part of the script, I was able to define the number of divisions of the truss and the orientation of the diagonals.
Here are three examples out of the infinite number of truss shapes based on changes to the top surface.



How the script works






In the script, you can define the number of divisions of the curves running on the surface. This way, you can control the level of simplicity of the geometry provided by the script.
Dispatch and Weave

The most difficult part of this script to to get your head around is the Dispatch and Weave components. Here is a link explaining the Dispatch component in detail: https://hopific.com/dispatch-in-grasshopper. In short, this component divides the list of numbers you give it into odd and even numbers. This way, you end up with zig-zag points above each other. These points can then be joined into a polyline by the Weave component.


Here you can choose the direction of the diagonals by changing the value from 0 to 1. This could be determined by a structural engineer.
Limits of the Script

The script simplifies the shape into rational lines. Therefore, a more complicated shape gets simplified too much, and the roof structure becomes unrealistic.
Another limitation arises if you want to use a polysurface instead of a surface. In that case, the script would have to be changed completely, since it does not work with the Brep component, which is intended for polysurfaces.
The Script:
Grasshopper file:
Rhino file:
Acknowledgements:
https://www.youtube.com/@ParametricHouse
Thanks to Šimon Prokop for mentoring