# Grasshopper 3D *Expanding Your Parametric Design Toolkit* ## Parametric Design in Grasshopper **What is parametric design?** A method where you define relationships between design elements using rules (parameters). Change one input, and the entire design updates automatically. ### Grasshopper Examples The images below show parametric patterns and structures created with Grasshopper: ![parametric_examples](https://hackmd.io/_uploads/BJLkTVfY1l.jpg) ![grasshopper_examples](https://hackmd.io/_uploads/SJ0V_lfKkg.jpg) These examples are from the **[Mode Lab Grasshopper Primer (PDF)](https://aae280.wordpress.com/wp-content/uploads/2014/10/mode-lab-grasshopper-primer-third-edition.pdf)** (Page 11) – a foundational guide for beginners. ### Example: Physics with Kangaroo **What is Kangaroo?** A plugin that adds real-time physics simulations to Grasshopper (e.g., gravity, tension, collisions). *Why use it?* To create dynamic structures like tensile membranes or bending beams. - **Tutorial**: [Kangaroo Tensile Structure Tutorial](https://www.youtube.com/watch?v=Sk-beAQb2Mc) ## Example: Loft **How Grasshopper improves on Rhino’s "Record History"** In Rhino, if you loft curves and later edit them, you must redo the loft. Grasshopper automates this: 1. Draw curves in Rhino 2. Loft them in Grasshopper 3. Edit curves → Grasshopper updates the loft automatically ## Opening Grasshopper Type `Grasshopper` in Rhino’s command line to open the visual programming interface. ### Input: Parameters **What are parameters?** Components that reference geometry or data from Rhino (e.g., curves, points, numbers). - **Types matter**: Grasshopper distinguishes between *points*, *curves*, *surfaces*, etc. Mismatched types cause errors! ## Data Flow **How components communicate** - **Wires**: Connect components to pass data (left = input, right = output). - **Add/Delete Connections**: Click+drag to create wires; Cmd (or Ctrl) + drag to remove them. - **Naming**: Right-click components → Type to label them (e.g., "Base of prism"). ### Naming Components / parameters Right click on the component ### Toggling names/icons "View" menu ## Plugins ### Food4Rhino A repository for Grasshopper plugins, scripts, and resources: [Food4Rhino Website](https://www.food4rhino.com/) ### Installing Plugins 1. Download `.gha` files from Food4Rhino. 3. Place them in Grasshopper’s **Components Folder**: `File → Special Folders → Components Folder` [Installation Guide](https://www.food4rhino.com/en/faq#users-install-grasshopper-plugin) There's also a `PackageManager` in Rhino, but it's a bit of a crapshoot. ### Bifocals Great plugin for clarity. ## Key Components ### Panel Displays raw data flowing through your script. Use it to debug or inspect values. ## Example: Divide Curves 1. Draw two curves in Rhino. 2. Use `Divide Curve` to split them into points. 3. Connect corresponding points with lines. *Result*: A parametric “ribbon” structure. ### Baking Right-click the final output → `Bake` to turn Grasshopper geometry into Rhino objects. ## Example: Polygon Array **Step-by-Step** **Polygon Component**: Define a polygon with sliders for radius (`R`), sides (`N`), etc. ### Inputs: sliders R / N / E / O ![image](https://hackmd.io/_uploads/rJ5I0XbFyl.png) ### Boundary Surface Creates a surface from edge curves ### Extrusion / cap Just like our old Rhino friends ### Rectangular Array Duplicate shapes in a grid. - `Cell` input: Defines spacing between copies (requires a *Rectangle*). ## Organizing our Grasshopper Definitions ### Grouping & Preview - **Group Components**: Select components → Right-click → `Group` (name groups for clarity). - **Toggle Preview**: Use the eye icon (top-right) to hide/show geometry. ### Radial Menu Center click the canvas for quick access to tools. ## Attractors A concept commonly used in parametric design is that of *attractors*". These are points or curves that influence geometry (e.g., scaling objects based on distance). ### Scaling with Distance Use `Curve Closest Point` to measure distances to an attractor curve. There are other "closest components": `pull point`, etc. ### Fine tuning with arithmetic Division, multiplication... Let's do a square root or a logarithm. We can also use `Graph Mapper` to non-linearly map distances to scaling factors. ## Exercise Copy and modify the definition so that it's the distance to a curve, not a point, what determines scaling. ## Exercise Copy and modify the definition from the previous exercise so that the distance to the curve determines rotation rather than scaling. Modify it also so that its input is a single curve going mostly up in the z axis. Hint: look up the `sweep1` component. To give you an idea, this is the sort of thing that we're after: ![hair_example](https://hackmd.io/_uploads/r1OowvGYke.jpg) ## Example: The press-fit kit Examples in [Fab Lab Barcelona local docs](https://fablabbcn-projects.gitlab.io/learning/educational-docs/fabacademy/classes/03-Computer-controlledCutting/#grasshopper). ### Opening Linked Files Grasshopper files (`.gh`) are separate from Rhino files (`.3dm`). To edit: 1. Open the Rhino file. 2. Open Grasshopper from Rhino. 3. Open the Grasshopper file → It will reference the Rhino geometry. ## Advanced Concepts ### Data Trees - **Flattening**: Simplifies nested data (e.g., merging lists). - **Grafting**: Preserves data structure (e.g., keeping branches separate). ## References - **Grasshopper Basics**: [Grasshopper3D.com](https://www.grasshopper3d.com/) - **Parametric Bench Tutorial**: [Parametric House](https://parametrichouse.com/parametric/parametric-bench-2/) - **Plugin Hub**: [Food4Rhino](https://www.food4rhino.com/) - **Grasshopper Kangaroo Tutorial** [Tensile Structure](https://www.youtube.com/watch?v=Sk-beAQb2Mc) - **The Mode Lab's** [Grasshopper Primer](https://aae280.wordpress.com/wp-content/uploads/2014/10/mode-lab-grasshopper-primer-third-edition.pdf) (pdf)