Page 1

EXLABBEND workshop manual


EXLAB:BEND Introduction EXLAB: BEND  8 Workshop Research Agenda  9 Elseware 10 NURBS 12 Grasshopper 13 Elseware & Web Resources  14 Morning Schedule  16 Evening Schedule  17

Seminar Guides

Tutorial 1 -

Interface and Parametric Workflow  18

Tutorial 2 -

Geometry, Data Types, Parameters and Objects.  20

Tutorial 3 -

Association, space, mapping and functions  22

Tutorial 4 -

Data Structures and the esoteric nature of visual code  24

Tutorial 5 -

Dissecting Datatrees  26

Datatree Resources  28 Tutorial 6 -

Documentation and Rationalisation  30

Tutorial 7 -

Planar Detailing  32

VB.NET Resources  34 Tutorial 8 -

Generative Detailing  36

Tutorial 9 -

Simulation  38

Tutorial 10 -

Algorithmic Environments  40

Python Resources  42


Project Outline Birdcage Model  44 Vine Model  46 CNC Wire Forming  48 Fabrication Project  50 Presentation Template  52 BEND Exhibition  54 Thanks 56


Appendix - Tutorial files Tutorial 1 - Make a polyline from points  58 Tutorial 1 - Rotate with multiple angles using a Range  62 Tutorial 1 - Rotate with multiple axes using Plane Components  65 Tutorial 2 - Create bezier curves from reference geometry  68 Tutorial 2 - Rebuild a curve as polyline  71 Tutorial 2 - Extract isocurves from a surface  74 Tutorial 2 - Section a surface with horizontal planes  77 Tutorial 2 - Section a polysurface with planes at variable angles  80 Tutorial 2 - Move an object with a series component  83 Tutorial 2 - Orient objects around a circle  87 Tutorial 3 - Create a 3d grid of points  90 Tutorial 3 - Move a grid of points using a mathematical function  94 Tutorial 3 - Move a grid of points using a graph  98 Tutorial 3 - Move a grid of points using a random function  102 Tutorial 3 - Move a grid of points using surface UVs and an image sampler  105 Tutorial 3 - Compound transformations using an attractor  108 Tutorial 4 - Extract specific collections (items, branches)   112 Tutorial 4 - Transform with multiple attractors  116 Tutorial 4 - Draw curves through a grid of points in two directions  120 Tutorial 4 - Interpolate between a list of polylines  124 Tutorial 5 - Create tool to display datastructure  129 Tutorial 5 - Pathmap with string components  133 Tutorial 5 - Iterate through a tree in VB  137


Appendix - Tutorial files Tutorial 6 - Find angles between segments of a polyline  140 Tutorial 6 - Find the lengths of segments of a polyline  143 Tutorial 6 - Labelling a 3d model using text tags  146 Tutorial 6 - Orient objects to a grid  149 Tutorial 7 - Create a proximity network on a surface  152 Tutorial 7 - Create planes around nodes  154 Tutorial 7 - Fit circles through node points  160 Tutorial 8 - Create a substitution script in VB.NET  163 Tutorial 8 - Create a recursive transformation in VB.NET  169 Tutorial 9 - Convert curves to spring objects  173 Tutorial 9 - Create Power Law forces using VB.NET 176


EXLAB: BEND

ExLab is a design and research collective that promotes creative utilisations of computation in art, architecture, engineering and related design disciplines. Based in Melbourne, Australia, the collective organises experimental collaborative research projects and exploratory workshops that focus on learning through making with digital fabrication at its core. BEND will explore the formal potential of designs produced using CNC Wire Forming machinery. It is the first of a series of workshops coupling parametric tools with a specific industry fabrication process. The investment in flexible fabrication technologies in local industry is currently limited to areas of efficiency, or else prohibitively expensive. These technologies do exist but their use is limited. It is often the translation of fabrication constraints into design and from the design to documentation where communication between designers and fabricators breaks down. Parametric tools allow a new way of communicating with existing processes. The workshop will begin by introducing students to parametric geometry and investigate the language of wire forms through a pair of physical prototypes designed and documented using Grasshopper and built using wire-bending jigs. Finally students will be asked to speculate on the advantages of using a CNC driven process and more advanced parametric tools through short design esquisses, culminating in the fabrication and installation of the final design and exhibition at the studio space.

8


Workshop Research Agenda

CNC wire forming is a well established industry that is typically used for the mass manufacture of identical components. As such the delivery process is relatively archaic, with clients supplying 2d documentation to the fabricator who instructs the machine through a process of trial and error. Machine code is simplistic and this workshop seeks to extend and contribute to the recent work of others (such as the ACADIA paper by Park MacDowell and Diana Tomova) in harnessing the potential automation of this process of code generation. Elseware have developed a see-saw script that generates CNC gcode from splines, and allows the forming process to be simulated from this code to avoid defects produced by bending the part into the machine. By generating code automatically the labour time for part production is reduced (eliminated), increasing cost efficiency for unique parts. Part complexity is facilitated by rationalising curves into faceted splines, allowing for double-curved geometries that would have been near-impossible to fabricate through 2d documentation and limited labour resources. The purpose of this book is to introduce students to the fundamentals of parametric design in Grasshopper through a series of tutorials and exercises specific to the design and CNC fabrication of a wire installation. In doing so we hope to contextualise some of the more esoteric aspects of the Grasshopper environment and demonstrate how designing with parametric tools has its own unique set of key concepts and stages.

9


Elseware

Gwyllim JAHN - completed his B.EnvDes at the University of Western Australia before completing his Masters of Architecture at RMIT in 2010. He practiced at Minifie Nixon architects and LAB Architecture Studio. He leads workshops and studios at RMIT, Melbourne and Monash universities, extending his design expertise in complex architectural geometry and behavioural systems, parametrics and digital fabrication. Jas JOHNSTON - is the Digital Fabrication Facility Coordinator at the Faculty of Architecture Building and Planning, University of Melbourne. He also tutors, assists with design studios and facilitates workshops focused upon digital design techniques through the Experimental Design Lab and digital fabrication techniques through the FabLab. Jas is particularly interested in new forms of digital art and their interaction and enhancement of architecture.

10


David LISTER - completed his Masters in Architecture in 2010 at the University of Melbourne. His academic pursuits include tutoring design and the use of parametric and other digital tools at the University of Melbourne and RMIT. In 2011 he ran the FPS masters thesis studio investigating the use of digital and parametric design, analysis, feedback systems and mass customisation approaches utilizing flexible fabrication methods. Stanislav ROUDAVSKI - Is a Lecturer in Digital Architectural Design at the University of Melbourne, he holds degrees of MArch/MFA from the Academy of Arts in St. Petersburg (Russia), MSc CABD from the University of Strathclyde (UK) and PhD from the University of Cambridge (UK). His current interests include generative designing of complex architectural geometries, bioinspiration, virtual and augmented environments, place and performance studies, spatial narrative, practice-based research methodologies and participatory, distributed creativity.

11


NURBS in Rhino

Rhino is a NURBS (Non Uniform Rational Bezier Splines) modelling package produced by McNeel. Modelling using NURBS is well suited to describing complex geometries for fabrication, as curved forms are not approximated to faces or segments as they are when modelling using meshes/polygons (3ds Max, Maya) or splines (AutoCAD). Instead curves and curved surfaces are described by interpolating between ‘control points’. This characteristic of NURBS geometry is most evident by the fact that no matter how far you zoom in on a nurbs curve or surface, it will never appear exactly flat or faceted. As such we have a lot of control over how we manipulate the parameters of objects in Rhino, and how we use them to generate and connect to the geometries of further objects. For example, curves and surfaces can be divided into exactly equal segments, simplified accurately, used to precisely measure angles and curvature etc.

12


Grasshopper

Grasshopper is a plugin for Rhino that makes the history of all of your modelling operations and geometric properties explicit to the designer (in early stages of development it was called ‘Explicit History’). This flow of geometry and data is represented as a graph of connected nodes, and is commonly referred to as a Visual Programming Interface. Modification of a node in the graph causes this change to flow through to all connected nodes downstream, updating the output of each of these nodes. This allows designers to retrospectively modify parameters and operations and instantly1 observe their influence on the final design, without the need to redraw the geometry. Grasshopper (and other scripted design processes) allows you to draw using data. A few key international practices whose designs will be discussed during the workshop are: Asymptote - (Hani Rashid) http://www.asymptote.net TheVeryMany - (Mark Fornes) http://www.theverymany.com Matsys - (Andrew Kudless) http://www.matsys.com

Not always. Grasshopper creates a plethora of traps for beginners to fall into, especially when generating polysurfaces or calculating intersections. 1

13


Elseware Resources

DDA Repository - A collection of student work, scripts, reference projects and inspiration digital design work. Previous teaching material is also available on the site. http://scripts.crida.net/gh Exlab - Grasshopper tutorials http://www.exlab.org/category/resources/ The Leda Atomicus - Gwyll’s digital design blog. Contains links to other digital design portfolios, blogs, studios, workshops and practice. http://ledatomica.wordpress.com

14


Web Resources

Grasshopper3d - Official grasshopper web page and resource for tutorials, events, downloads and discussion. http://www.grasshopper3d.com Food4Rhino - Grasshopper and Rhino third party plugins. Kangaroo, Weaverbird, GHowl etc can all be found here and are frequently updated. http://www.food4rhino.com/ Designreform - Video tutorials on series, lists, datatrees and common grasshopper functions. http://designreform.net/learning/grasshopper

15


Morning Schedule

11

12

1pm 2

10am 9

3 8

4 7

6

5

Monday

Tuesday

Wednesday

Thursday

Interface

Geometry

Association

Data Structure

Monday

Tuesday

Industry

Planar Joinery

Wednesday Generative

Applications

Joinery

Seminar Exercises Help/Fabrication Lecture Lunch/Drinks

16

Friday Documentation

Thursday

Friday

Emergence

No Class


Evening Schedule

11

12

1 2

10 9pm

3 8

4 7

6pm

5

Monday

Tuesday

Wednesday

Thursday

No Class

Geometry

Association

Data Structure

Monday

Tuesday

Industry

Planar Joinery

Applications

Wednesday Generative

Friday Documentation

Thursday

Friday

Emergence

Interaction

Joinery

Workshop classes run from 10am - 1pm and 6pm - 9pm. Participants are free to attend all classes.Classes are structured as a lecture/seminar, folowed by individual and group design exercises. Participants are free to use the studio out of workshop hours and time has been allocated for further software and fabrication help. NOTE: There will be no evening class on the first Monday due to the guest lecture. Likewise there will be no morning class on the final Friday - morning students should attend the evening class for tutorials and workshop wrap up drinks. On all other days evening sessions will run to the same schedule as morning classes.

17


Monday, February 6th

Tutorial 1 - Interface and Parametric Workflow

Seminar: Walk through the grasshopper toolbars, context menus and icons. Learn how to use parameter components to begin working with Rhino geometry in Grasshopper. Generate a parametric loft from referenced geometry in Rhino, and from points created in grasshopper. Use Panels to observe how Grasshopper components process inputs and outputs, and to document the definitions workflow and learning process. Outcomes: Understand the advantages and disadvantages to generating objects parametrically. Develop an aptitude for using the graphical interface and viewing data. Document a definition for later use. Discussion: How might we use (or ignore) surface geometry in a wire bending project? Why are certain functions and geometries ignored during the workshop? What are the strengths and weaknesses of a parametric design process? Exercises: 1 - Make a polyline from points 2 - Rotate with multiple angles using a Range 3 - Rotate with multiple axes using Plane Components

18


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

19


Tuesday, February 7th

Tutorial 2 - Geometry, Data Types, Parameters and Objects.

Seminar: Introduce participants to fundamentals of vector geometry (coordinates, addition, subtraction and multiplication). Evaluate two curve objects to produce a blend, join and explode the curves. Extend the definition to blend between several curves. Specify input parameters using object properties and using referenced objects from rhino. Outcomes: Understand the difference between primitive data types and the concept of an object/parameter. Learn about object hierarchy, and gain the skills to extract simple information from complex geometry (bounding boxes, points on curves, measurements etc). Understand the principles of NURBS geometry, vectors and simple transforms. Discussion: What would be the challenges to blending between closed curves using beziers? Exercises: 1 - Create bezier curves from reference geometry 2 - Rebuild curve as polyline 3 - Extract isocurves from a surface 4 - Section a surface with horizontal planes 5 - Section a polysurface with planes at variable angles 6 - Move an object using a series component 7 - Orient objects around a circle

20


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

21


Wednesday, February 8th

Tutorial 3 - Association, space, mapping and functions

Seminar: At the beginning of this class, students have selected the outcomes of one of the previous exercises with the intention of extending it for fabrication. The seminar will present various approaches to associating parameters of one object (points, images, graphs etc) with the properties of another - in this case polylines. This allows designs to become responsive to conditions: sun angles, wind loads, ornamental patterns, fabrication constraints etc. Refer to Python Primer Section 8.3 Outcomes: Experiment with vectors, planes, transforms, images, functions and graphs as means for creating relationships between geometrical properties of two objects. Learn about surface (uv) and curve (t) space and how to map objects from one space to another. Discussion: Associating form with data allows architects and designers to evaluate the strengths of their designs - a reduction in cost, a gain in structural efficiency, better solar performance etc. What are other advantages to ‘materialising the invisible’? Exercises: 1 - Create a 3d grid of points 2 - Move a list of points using a mathematical function 3 - Move a list of points using a graph 4 - Move a list of points using a random function 5 - Move a grid of points with surface UVs and an image sampler 6 - Create compound transforms with an attractor

22


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

23


Thursday, February 9th

Tutorial 4 - Data Structures and the esoteric nature of visual code

“The basic idea of the Grasshopper data structure (trees, as they are lovingly known) is that you can take any algorithm and apply it to a larger amount of data. At least in principle this is always possible. If you can make a line between two points, you should be able to create a whole bunch of lines between a whole bunch of points.” - David Rutten Seminar: Discuss analogous systems to Grasshoppers data structures. View and manipulate lists and path objects using common Grasshopper components Create ‘a whole bunch of lines between a whole bunch of points’. Outcomes: Understand the limitations of Grasshopper’s data structures compared to a scripting environment. Be able to perform operations on specific items and lists of items. Recognise how structure effects the operations and outputs of Grasshopper components. Discussion: Encourage students to search the Grasshopper forum and explore the references on the following pages. Exercises: 1 - Extract specific collections (items, branches) 2 - Transform with multiple attractors 3 - Draw curves through a grid of points in two directions 4 - Interpolate between a list of polylines

24


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

25


Friday, February 10th

Tutorial 5 - Dissecting Datatrees

Seminar: In anticipation of more complex documentation this seminar will introduce some of the more advanced tools for manipulating datatree objects in Grasshopper. Students will be exposed to simple programming concepts such as string manipulation in order to produce flexible and powerful associations between sets of data. Outcomes: Understand how to reference, create, manipulate and convert path objects as strings (lists of characters). Discussion: Strings operate as the plain English of the computer world. They are very useful for creating patterns and mappings from one space or object to another. How might we use the tools in the exercise to create patterns or mappings? Exercises: 1. Create a tool to display structure information in rhino viewport 2. Use string components to create a more flexible path mapper 3. Iterate through a tree in vb.net

26


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

27


Datatree Resources

TU Delft wiki page - Pretty good description of the way grasshopper operates on data and the differences between a visual programming environment and scripting. http://wiki.bk.tudelft.nl/toi-pedia/Template:Grasshopper_Data_Tree_editing Modelab primer files - Grasshopper definitions available for download that outline the functionality of some of the common list and tree manipulation components. http://modelab.nu/?cat=3 Pathmapper Help Thread - Discussion on the grasshopper forum with some very useful images and explanations of how the pathmapper works. http://www.grasshopper3d.com/forum/topics/path-mapper-help-1

28


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

29


Monday, February 13th

Tutorial 6 - Documentation and Rationalisation

Seminar: Use orient, textlabel and grid components to parametrically layout and label 3d geometry. Explain various methods for breaking geometry into discrete units for documentation. Break down the feed simulation definition step by step to understand the process of iteratively measuring rotations, bends and feed lengths. Outcomes: Following this class students will be confident in design, layout, and documentation of 3d curve geometries for fabrication on the three axis jig. Discussion: How could the process be optimised (reduce material waste and fabrication time)? Is there an optimum balance between complexity/variation and ease of construction? How can we use parametric tools to predict material behaviour? Exercises: 1 - Find angles between segments of a polyline 2 - Find the length of each segment of a polyline 3 - Label a 3d model using text tags 4 - Orient objects to a grid

30


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

31


Tuesday, February 14th

Tutorial 7 - Planar Detailing

Seminar: It is often simpler (or the only option) to design a joinery logic between parts after the overarching form has been finalised. An example of this is the ‘waffle grid’ structure, which approximates a surface geometry using perpendicular slices and slots. Such a design process is linear and consequently error prone - the size, curvature or topology of the surface, for instance, is not affected by the logic of the slotted joint. In this class participants will be lead through a definition that rationalises joints between 3d curves as linked, planar geometries. Students will bring to class a model consisting of branching geometries (max 3 connecting parts per intersection). We will then apply joinery definition, and experiment with the exposed parameters. Finally, students will attempt to further rationalise and model additional joint geometries as per individual design goals. Outcomes: Learn how to locally rationalise complex geometry with respect to specific fabrication constraints. Understand that script components can be used to shortcut requirements for complex definitions. Discussion: Should the geometry of the joint become a defining aspect of the design? How do parametric details (which have to be flexible enough to satisfy a range of situations) differ from conventional details (which are commonly unique to a specific situation)? Exercises: 1 - Create a proximity network on a surface 2 - Create a script to find unique nodes in the network 3 - Fit circles through node points

32


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

33


VB.NET Resources

RhinoCommon SDK - This is the go to place to begin learning how to script in rhino. It contains a reference for all rhino classes and interfaces, describing their properties and methods with examples. http://www.rhino3d.com/5/rhinocommon/ VB.net School - Reference for Visual Basic syntax, variable decleration, functions, loops, conditional statements etc. http://www.programmersheaven.com/2/VB-NET-School Essential Mathmatics For Computation Design - An excellent document to use as a reference for NURBS geometry, vectors, space syntax, matrix transforms, curvature etc. http://download.rhino3d.com/en/Rhino/4.0/EssentialMathematicsSecondEdition/ Grasshopper Tutorials - Further reference material. Also see the forum! http://www.grasshopper3d.com/page/scripting-and-code-tutorials

34


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

35


Wednesday, February 15th

Tutorial 8 - Generative Detailing

Seminar: In this tutorial we will attempt to incorporate a parti for the joinery into the elements which make up the design by using tangential connections and crimps. Participants will be finalising their Model 2 designs and will be familiar with the constraints of the fabrication process. During the seminar participants will be introduced to the generative principles of Lindenmayer (L) systems, and two implementations of the system in VB.net in grasshopper. The first will extend earlier tutorials on strings and substitution in order to create an abstract L system using defined rules. The second will replace abstract characters with geometry to attempt to respond to the brief for the model. Outcomes: Understand the difference between inherent joinery systems (where the connection logic becomes a property of the part and thus determines the whole) and post-processed joinery systems (where an algorithm determines locations for joints and subsequently modifies the parts). Understand how iterative processes facilitate ‘intelligent’ components and relationships. Discussion: Compare and contrast the two systems. How does Grasshopper limit the potential of ‘inherent’ joinery systems? How could the two joinery systems be combined in a single project? Exercises: 1 - Create a substitution script in VB.NET 2 - Create a recursive function that performs Transforms in VB.NET

36


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

37


Thursday, February 16th

Tutorial 9 - Simulation

Seminar: At this point in the workshop most of the design and fabrication constraints will have been discussed and explored through a series of digital and physical prototypes. We will now attempt to explore rule-based solutions to these constraints by approximating the wires as a collection of fibres - similar to experiments done by Frei Otto. This will allow the final form of the project to emerge from these rules. The seminar will demonstrate a range of precedent projects exploring how natural systems can inform architectural ones. Students will be introduced to how simple physics operate via the examples in the Kangaroo Manual, and how to create dynamic constraints and force objects. Participants will then be guided through the process of rationalising a collection of polylines for simulation of a fibre network. Outcomes: Understand how algorithms can produce complex designs that emerge from simple rules and design constraints. Develop a methodology for evaluating the strength of the chosen algorithm. Discussion: Should all designers be able to code? How do we translate design complexity to fabrication simplicity? What is lost in the process? How might designing with Daniel Piker’s ‘pseudophysical materials’ facilitate a new design process?

Exercises: Part 1 - Convert curves to spring objects Part 2 - Create and control power-law force objects using a supplied script component Part 3 - Generate a fibre network from existing site and programmatic constraints

38


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

39


Friday, February 17th

Tutorial 10 - Algorithmic Environments

Seminar: In the previous class students implemented an out of the box generative system to produce complex and highly varied geometries. Participants will now be introduced to the concepts and tools which allow expert designers and programmers to write and control their own unique algorithmic environments. Students will leave the grasshopper environment and will be exposed to IronPython, its advantages and limitations, and how it operates within Rhino. Outcomes: Recognise when problems require an iterative process to find a solution. Understand that such process can work as design generators as well as optimisers. Introduction to Object Oriented principles and why they are essential to coding rule based behaviours and environments. Discussion: Anything that moves over time generates a path. What natural processes or phenomena generate complex patterns or paths that may be hijacked by the architect working with wire? Demonstration of Marc Fornes’ work using IronPython. Exercises - Requires Rhino 5.0 WIP: http://download.rhino3d.com/Rhino/5.0/evaluationtimed/download/ Refer to Python Primer

40


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

41


Python Resources

IronPython 101 Primer - An introduction to scripting in rhino 5 using python. “Python offers exciting new potentials for programming in Rhino with Object-Oriented functionality, simple syntax, access to the .NET framework and a vast number of userbuilt libraries to extend Rhino’s functionality.” http://download.rhino3d.com/IronPython/5.0/RhinoPython101/ RhinoPython Programmers Reference - Contains a reference for using the rhinoscript package in ironPython. http://www.rhino3d.com/5/ironpython/index.html Python Community - Further reference material. Also see the forum! http://python.rhino3d.com/

42


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

43


Tuesday, February 8th

Model 1 - Birdcage

Utilising the techniques learned in the tutorials during days 1-3 participants are asked to design, fabricate and build a small bird cage. The bird cage is to be composed of 2d bent wire profiles that radiate from a central axis connected by standardised prefabricated brackets. This highly constrained design, fabrication and construction process is intended to illustrate the possible formal variation using flexible modelling techniques. As a starting point participants are asked to select from the list of adjectives below in order to embody the form of their birdcage with a particular purpose: Twisted, Squeezed, Blown, Continuous, Squashed, Jagged, Punk, Gentrified, Exuberant, Symmetrical, or another of your choosing. Design, Fabrication and Construction Considerations: Base and top connection bracket is standardised Must use a set number of wire profiles in order to connect with brackets Maximum length of the wire is fixed Wire profiles must be 2D Deliverables: (Due Thursday Wk1) One completed model for photography and exhibition. One set of drawings using supplied template. Outcomes: Introduction to flexible parametric design using Grasshopper Illustration of workflow from parametric model to fabrication and the materialization of the physical object. Familiarisation with the process of CNC wire forming through the simulation of the process using a (rudimentary) analogue 2d jig Understand the advantages and limitations of using 2d components and joints

44


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

45


Friday, February 10th

Model 2 - Frame

Participants are to design a model that expresses a series of events. This model will be constructed using tangential connection details and/or the standardised bracket detail from model 1, using 3D bent wire profiles. The design techniques required to produce this model will be provided during tutorials 1 - 8 Consider what avarian architecture might look like. Imagine architecture as a series of materialised events. Our material is wire and the events that may occur are: Flocking, perching, singing, feeding, attracting, defending... How might one type of bird interact with your model differently from another? How might the site, the public or the environment impact on the design? Deliverables: (Due Thursday Wk2) One completed model for photography and exhibition. One set of drawings using supplied template Outcomes: Translate 3d geometry for documentation Understand the relationship between rule based design and rule based description Optimise the fabrication process by simplifying 3d geometry Speculate on the advantages and disadvantages of different joinery types

46


________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ ________________________________________________________________________ _______________________________________

47


CNC Wire Forming

The final project will be materialised using the digital fabrication process of CNC wire forming. CNC wire forming is an established industrial fabrication process typically used to produce wire products such as shopping trollies, display racks, hooks, brackets and many other common wire products. To fabricate a component using this process designers produce 2 dimensional documentation of the intended components, often from a 3 dimensional model, which are then translated by the fabricator into code to direct the CNC forming machine. This archaic process is suggested due to the limitations of the process (described below) requiring each component to be tested by the operator to ensure accuracy with the original design. Because of this labor intensive approach products or components are produced in large runs to achieve efficiency and affordability. Following this process however prevents the use of the equipment to produce individually customised or designs of high complexity in a cost effective manner. Through testing with our fabrication partner, Ace Wire, using this optimised process Exlab has been able to obtain fabrication quotes at 1% of the standard cost. Ace Wire Ace wire design and manufacture wire and metal products using a range of processes including the latest technology in wire forming including range of 2d, 3d and robotic CNC forming equipment. Their CNC wire formed products are typically retail and display stands, handles, hooks, rings, brackets, springs and links. i.e. mass produced large run items.

48


Limitations and advantages - design considerations Helicoidal twist -as wire and metai rod is manufactured a twist can naturally form. This twist is further exagerated when the wire is coiled. This heliculal twist can cause unexpected deflections or deformations in the wire as it is bent using the a CNC former. Due to this industrial CNC forming services prefer larger runs of a single component to allow the testing and correction of this twist. This testing is typically done using a drawing or jig. Deflection - As wire is fed through the CNC former and bent into the desired geometry the weight of the wire can cause deflection due to gravity. Logically this deflection increases as the amount of wire or the length of the wire increases. The wire typically is not supported beyond the bend head as maximum range of movement is optimal to allow for complex pieces to be built. Fouling - This occurs when the component is bent back into the machine causing the component to hit or foul against the machine. Fouling must be avoided as it prevents the accurate forming of components. Spring back - When wire is bent to a specified angle it will ‘spring back’ to a lower angle due to the elastic nature of the material. The wire must therefore be bent to a greater angle to allow it to ‘spring back’ to the intended angle. This amount of spring back must be accounted for within the code and is typically input by the fabricator. and is typically accomplished by trial and error. Thermal deformation/variation - The air temperature within the space the wire former is operating within will affect the malleability of the wire and therefore the bending of the wire via spring back. This must be tested and accounted for before the commencment of a component run.

49


Fabrication Project

The workshop will focus on the design possibilities of using parametric tools to drive a CNC wire forming process. The outcomes of the workshop will inform a final design that will be completed following the workshop, installed at Elseware Studio and presented as part of a public exhibition. Workshop participants are asked to consider and contribute to the requirements for the final installation using the following brief: Formal Brief: Following the exhibition the feeder is to be installed in a public place. It must be accessible to install, clean and replenish feed. The geometry of the feeder should be designed to accommodate characteristics of local bird life (see Feeder Descriptions as a starting point). The feeder should provide a means of public display. It should include some mobile elements and become activated/mobile while in use. The feeder should prevent access to unwanted pests (rats, possums, crows). Architectural Agenda: The project also has a design agenda in order to explore the complexity made possible by an automated design and fabrication process. As a starting point participants are asked to consider the form of the feeder being: At once open and closed, or acting as an aperture. Comprised of multiple formal languages. A different function (or consider the events from the second model) should generate a different form. Contextual and site responsive. The structure of the feeder should in some way relate to its immediate environment. Expressive of a sequence of events.

50


Feeder Types

Tube feeders attract smaller, perching birds. As they effectively contain seed, they are easily possum-proofed. They are long hollow cylinders that can be mounted on a pole or hung from a tree or window. The tubes are mostly clear plastic and have perches on each of several feeding ports so that multiple birds can feed at the same time. Tube feeders allow the birds to see the seed inside and are virtually spill-proof. Hopper feeders allow for a large amount of seed to be dispensed bit by bit to feeding birds. These are universal feeders, catering to all sorts of birds. Hopper feeders are refillable dispensers that typically provide some form of shelter for both the birds and the feed in the form of a roof. These feeders attract a number of different types of birds who like to perch or eat from tables. Hoppers tend to attract all birds that won’t feed at a tube feeder - they allow the bigger birds to land in the feeder tray and eat comfortably. But, they have the disadvantage of being accessible to animals - if big birds can land easily, then possums can access your bird food as well. Platform feeders are the simplest form of feeder; essentially a raised platform containing seed. Platform feeders attract the largest number and variety of birds. These feeders can be raised on legs or suspended anywhere, and are typically roofed to provide shelter. Provision must be made for protection from predators using a clear surrounds or barrier.

51


Exhibition Documentation

Presentation Template

For each project we will also utilise scripts and scripted components to develop exhibition materials of design explorations. The template allows you to represent multiple iterations of your parametric model in a single drawing by gradually increasing the opacity of each iteration with the change of a number slider. The online Grasshopper community aids the development of the software by adding functionality, pointing out and fixing bugs and suggesting improvements. Some users develop their own plugins, some of which are used in the workshop and others create scripted components which are made available through their own websites and blogs. This documentation process uses a scripted C# component developed by Giulio Piacentino (who also created the mesh tools plugin WeaverBird) to bake iterations of a design to separate layers. This plugin, script and others can be found: www.giuliopiacentino.com Then using a JavaScript written by Gwyl to alter the opacity of layers in Adobe Illustrator to present your work in a supplied template.

52


Using the bakeAttributes component: Connect your final curve geometries to the object input. Use a function component with a single input. Set the ‘Expression to solve’ as: “Layer “ & x Connect the slider which is altering your geometry to this function, and connect the component to the layer input. Create a Boolean Toggle component and set to True Right-click the slider you chose and select Animate... This will create images somewhere on your computer (which you may want to compile into an animation) but it will also move the slider in even increments across the slider. Select the curves in the appropriate Rhino viewport and go to File > Export selected... Save as an Adobe Illustrator file (.ai)

Preparing the final file in Illustrator: Open both the file you created and the presentation template provided. Select “Paste Remembers Layers” from the dropdown layer options menu (see right) and copy all the curves from your file into the template. To activate the script, go to File > Scripts > Other scripts... and select the file from where it is stored on your computer. Choose the layer of your chosen iteration and increase its line weight. Add you and your project’s name and you’re done! Almost. Just upload it to our website: http://www.elsewarecollective.com/bend/upload.php 53


BEND Exhibition

Student work will be curated for exhibition by following the presentation template provided. The format is demonstrated on the right. The exhibition will showcase both the digital exploration of the wire forming process through categorised prints of each tutorial, together with the final fabricated project to be installed in the space. A publication documenting this process will be available on the night. The exhibition will be hosted at Elseware Studios in March. All are welcome.

54


55


Thanks

Acewire, for donating their time to discuss the CNC process and facilitating the exploration of new and novel use of their machines. SONA, for publicising the workshop. Melbourne University, for donating equipment and assisting in promotion to students and faculty staff members. Roland Snooks, for donating his time to give a public lecture and kick off the workshop. Loren Adams, for providing photography and documentation.

56


57


Idea

Tutorial 1 - Make a polyline from points

This tutorial introduces students to the Grasshopper (GH) interface and some concepts of parametric design by creating a simple polyline. Most objects in cad software are combinations of simpler data types, or ‘primitive’ types. In this instance a line is defined by the shortest distance between two points. A polyline is composed of a series of lines connecting a sequence of points. The primitive data required to define a line are points located using coordinates within 3d space, or x,y,z locations. Rhino geometry, in this case the points, will be ‘referenced’ into Grasshopper and used to create the polyline. Grasshopper doesn’t change referenced geometry, it will always remain, as is, in Rhino. In fact, Grasshopper won’t make any Rhino geometry until we ‘Bake’ a component. Variable sliders will then be used to define the primitive geometry, or points, used to create the polyline.

58


Exercise Reference a number of points from Rhino into Grasshopper by creating the points in Rhino’s model space. Add a POINT parameter component to the Grasshopper canvas.

(PARAMS/GEOMETRY/POINT) The point component displays with an orange fill. This warning indicates that the component is under defined and more information is required. To assign the points you created in rhino to this component, right-click on the component and select ‘set multiple points’. Within rhino model space select the points you wish to use to define the polyline.

The points have now been referenced to the component and should appear in the standard display colours (Gh default is grey). Note that the order you select the points in Grasshopper will be how they are stored in the component. This will become apparent soon.

To create a polyline, add the POLYLINE component from the curve/spline menu to the canvas. You can also double-click in the canvas and search ‘polyline’. The component will appear on the canvas with two available inputs. Hover the mouse cursor over the ‘V’ or the ‘C’ to see what the component requires.

(CURVE/SPLINE/POLYLINE) The ‘V’ input indicates that the input requires the points that will be the vertices of the polyline. Click and drag on the output of the point component to create a wire. Attach this to the ‘V’ input. Note that the path of the polyline follows the order the points were selected. This is because the data is stored in a list ordered in the sequence the points were selected.

59


Exercise When a component has multiple inputs it is good practice to find out and experiment with additional functionality. In this case, the ‘C’ input gives an option to ‘Close Polyline’. Right-click on the input, go to set boolean and select ‘True’.

View your polyline which has a display preview in Rhino. This geometry only exists in Grasshopper for now. Click and drag your points within rhino model space and watch the preview update. Referencing geometry like points into Grasshopper allows for greater interaction within the Rhino interface ,as illustrated, by being able to drag the points by hand. Another option is to generate the points within Grasshopper. This lets us be specific in defining the point’s coordinates.

Add POINT XYZ from the vector/point menu to the canvas. Note that if you double-click and search ‘point’ there are a number of options presented. You will become familiar with these with time. Like before, hover the mouse cursor over inputs to decipher what the component is expecting you to pass to it.

(VECTOR/POINT/POINT XYZ) This component allows the user to define a point via its Cartesian coordinates. Connect a number slider to one of the inputs to provide the required data for the coordinates. You can also double-click and enter a number into the ‘search by keyword’ (I.e.. 3.5) To obtain a slider with that value set as current

(PARAMS/SPECIAL/NUMBER SLIDER) By right-clicking on a slider you can ‘edit’ the properties of the slider to control the type of numbers (floating point, integers, even,odd), degree of accuracy/rounding, the numeric domain and the current value set.

60


Exercise Copy and paste these components (Ctrl+c, ctrl+v or holding alt+click/drag) to define 3 more points. Check in rhino to see them move as you change a value on a slider. Note that some inputs have default values assigned to them. The default coordinates for the x and y-axis are set to 0.0

Connect the first point xyz component to a polyline component. The polyline component needs a minimum of two points to create a line and therefore remains orange as a warning.

(CURVE/SPLINE/POLYLINE) Now connect the remaining 3 point xyz components. To do this you will need to hold down the shift key if you wish to connect multiple wires to a single input. Like when we referenced earlier, the order in which points are connected to the polyline determines the path of the polyline.

Change the value of the sliders and watch the display update in rhino simultaneously.

As mentioned above, most objects in cad software are created using combinations of primitive data types through a hierarchy of the manipulation of this data. For example; points are used to define lines, lines are used to define surfaces. In this workshop participants will be manipulating lines through a range of processes to simulate wire profiles. This tutorial introduces participants to the primitives required to define a line which will be expanded upon in future exercises

61


Idea

Tutorial 1 - Rotate with multiple angles using a Range

This tutorial will illustrate how to rotate a curve profile around a central axis a number of times using a range component so that they are always evenly spaced. This will create a revolved ‘form’ from profiles, similar to a typical cylindrical bird cage.

62


Exercise In Rhino front view model space draw a curve that will become the profile to be rotated around an axis. Also designate the origin of the axis of this rotation using a Point. Reference both the Curve and Point into Grasshopper using a CURVE and POINT component.

(PARAMS/GEOMETRY/CURVE,POINT) Add a ROTATE 3D component to the canvas.

(CURVE/UTILITY/ROTATE 3D) To specify the axis of rotation add a X UNIT VECTOR component to the canvas and connect it to the axis of rotation input (X). This will rotate the curves on the YZ plane.

(VECTOR/VECTOR/X UNIT) The amount the curve is to be rotated around the axis can be specified by providing a rotation angle in radians to the (A) input. This angle can be passed into the (A) input via a slider.

(PARAMS/SPECIAL/NUMBER SLIDER) Right click on the slider and select ‘edit’. Set the slider to a max of 360 using floating numbers. The slider must be converted into degrees for the ROTATE 3D component to operate as expected.

(PARAMS/SPECIAL/SLIDER)

63


Exercise The RADIANS component converts degrees into radians allowing you to specify the rotation angle in degrees. Place the ‘radians’ component between the slider and the ‘rotate 3d’ component.

(MATHS/TRIG/RADIANS) Now replace the single slider with a sequence of numbers within a specified domain. To do this use a range component and add a domain component as well.

(SETS/SEQUENCE/RANGE) (MATH/DOMAIN/DOMAIN) Use PANEL components to set the minimum and maximum bounds of your range. We want the curve profile to rotate all the way around the central axis, so set minimum to zero and maximum to 360. Note. When using a panel component in this way make sure not to add extra lines (hitting enter) as this will cause the domain component to fail.

(PARAMS/SPECIAL/PANEL) Now set the number of steps within this range with a number slider.

(PARAMS/SPECIAL/NUMBER SLIDER)

64


Idea

Tutorial 1 - Rotate with multiple axes using Plane Components

This tutorial will use the ‘Plane Components’ analysis tool to decompose a plane into 3 individual axes and then use two of them to rotate some profile curves.

65


Exercise In Rhino front view, draw a curve that will become the profile to be rotated around an axis. Reference the Curve into Grasshopper using a CURVE geometry component.

(PARAMS/GEOMETRY/CURVE) Add a ROTATE AXIS component and pass the initial profile curve to the (G)eometry input.

(CURVE/UTILITY/ROTATE AXIS) Use a PERP FRAME component to create a plane perpendicular to the curve at a location we can choose. Right-click on the (C) input and select ‘Reparameterize’. This will be covered in detail in later tutorials. Add a number slider to the (t) input.

(CURVE/ANALYSIS/PERP FRAME) (PARAMS/SPECIAL/NUMBER SLIDER) From this single plane we can extract 3 axes of rotation using an analysis component called PLANE COMPONENTS.

(VECTOR/PLANE/PLANE COMPONENTS) The ROTATE AXIS component requires a line geometry as the axis, so use the origin point of the plane and an axis to create a line. There are a number of ways to do this, here we are using the ‘Start, Direction, Length’ line component. Note that the length has a default value.

(CURVE/PRIMITIVE/LINE SDL)

66


Exercise Now we have the axis for rotation we just require the angle of rotation itself. Like the previous tutorial we will use a RANGE component to create a set of values.

(SETS/SEQUENCE/RANGE) Set the domain of the range component between zero and 360.

(MATH/DOMAIN/DOMAIN) Specify how many numbers are in the range sequence with a NUMBER SLIDER.

(PARAMS/SPECIAL/NUMBER SLIDER) If you hover the mouse cursor over the (A)ngle input of the rotation component you will see that this angle is defined in radians. It is sometimes easier to visualise in degrees so I often use them and then translate to radians using a math component.

(MATHS/TRIG/RADIANS) This completes the first rotation transformation. Now just choose another axis to create another line, and pass it to another ROTATION AXIS component. Then connect the geometry that has been rotated once to the (G)eometry input.

(MATHS/TRIG/RADIANS)

67


Idea

Tutorial 2 - Create bezier curves from reference geometry

This tutorial introduces bezier curves. Bezier curves are a type of parametric curve that are commonly used in vector graphics to model smooth curves that can be scaled indefinitely. Within Rhino bezier curves are used to create NURBS surfaces that can be smooth in two directions. Bezier curves are defined by a start and end point and tangent directions at each end that defines the curvature.

68


Exercise Create two curves in Rhino and reference them into Grasshopper using two CURVE geometry components.

(PARAMS/GEOMETRY/CURVE) Select and add a BEZIER SPAN component. This curve is created from both endpoints and the tangential directions at the end points. A tangent can be thought of as a straight line that represents the direction of the curve at a particular point.

(CURVE/SPLINE/BEZIER SPAN) Evaluate the curves at a specific point with the EVALUATE LENGTH component from the curve analysis menu. You can evaluate via distance or use the default which uses a length factor, where the curve is reparameterised so that 0 (zero) is the start of the curve and 1 is the end. This will return to us a point as well as the tangential direction of the curve at that location.

(CURVE/ANALYSIS/EVALUATE LENGTH) Use a number slider to specify the which end of each curve to draw the bezier curves from.

(PARAMS/SPECIAL/NUMBER SLIDER) Connect the appropriate outputs to the bezier span component. Depending on how far apart you created the curves will determine how curved the bezier is. This is because the vector from the evaluation component is a unit vector, meaning it has a direction and a magnitude of only one.

(PARAMS/SPECIAL/NUMBER SLIDER)

69


Exercise To add further control to the bezier curve the vector amplitude can be altered to change the curvature.

(VECTOR/VECTOR/VECTOR AMPLITUDE) Specify the magnitude with a slider.

(PARAMS/SPECIAL/NUMBER SLIDER)

70


Idea

Tutorial 2 - Rebuild a curve as polyline

Rebuilding allows the modification of a curves parameterization; control points and curve degree. This can be a useful rationalisation tool for fabrication in the case where straight segments must be used.

71


Exercise Reference a number of curves from Rhino into Grasshopper by creating the curves in Rhino’s model space using the ‘control point curve’ tools. Add a CURVE parameter component to the Grasshopper canvas.

(PARAMS/GEOMETRY/CURVE) Add a REBUILD component onto the canvas. Rebuilding a curve allows you to specify the number of control points and the degree of curvature. The affect of these parameters will become clear when the definition is completed.

(CURVE/UTILITY/REBUILD) Add a number slider to the canvas. By rightclicking on a slider you can ‘edit’ the properties of the slider to control the type of numbers (floating point, integers, even,odd), degree of accuracy/ rounding, the numeric domain and the current value set. Set the slider to odd (O) with a maximum of 7. Connect the slider to the degree input (D).

(PARAMS/SPECIAL/SLIDER) As you increase the degree of curvature (D input) the curve becomes smoother where a degree of 1 connects the curves control points by straight lines.

(PARAMS/SPECIAL/SLIDER) Add another number slider to the canvas. This slider will be used to set the number of control points used to define the curve. Edit the properties of the slider to have a maximum of 15 and a minimum of 2 (min must be greater than or equal to 2 as a curve requires 2 or more points to exist)

(PARAMS/SPECIAL/SLIDER)

72


Exercise Add a CONTROL POINTS component to the canvas and connect it to the rebuilt curves.

(CURVE/ANALYSIS/CONTROL POINTS) Bezier curves are defined by a start and end point and one or more control points that define the curvature. You will notice as the degree of the curve increases the control points move further from the curve creating a smoother representation of the curve.

Add a BOOLEAN TOGGLE to the canvas and connect it to the t input of the rebuild component. This toggle allows you to preserve end point tangents and use this to define your curve. Play around with the sliders and different settings to see how they influence the shape of the curve.

(PARAMS/SPECIAL/TOGGLE)

73


Idea

Tutorial 2 - Extract isocurves from a surface

This tutorial introduces surface domain, surface uv points, reparameterizing a domain and the range component. These tools will be used to extract the isocurves from a surface.

74


Exercise Create two curves in Rhino model space to loft and reference them into Grasshopper using a single CURVE geometry component and ‘Set Multiple Curves’.

(PARAMS/GEOMETRY/CURVE) Use the loft component to create a surface. Note that by right-clicking on the ‘O‘ input, the loft can be changed to closed.

(SURFACE/FREEFORM/LOFT) Iso curves are created from U and V parameters of each direction of a surfaces domain. Specifying these coordinates to an ISO CURVE component returns a curve in each (U and V) direction.

(CURVE/SPLINE/ISO CURVE) We will use a POINT XYZ component to create some point coordinates.

(VECTOR/POINT/POINT XYZ) We want to create a series of points with coordinates between 0 and 1. The reason for this will become apparent when we use them to sample the surface. Use two RANGE components with (D)omain set between zero and 1. v

(SETS/SEQUENCE/RANGE)

75


Exercise Connect sliders to control the number of points created.

(PARAMS/SPECIAL/NUMBER SLIDER) Pass these point coordinates to the ISO CURVE component. The domain of the surface you created is dependant on its dimensions. With Grasshopper, it is preferable to be able to use definitions again and again in differing situations to save the time taken to create them. To do this, we want to alter our script so that it works on any surface we create in the future.

To do this, we will ‘reparameterize’ the surface. This will change the domain of the surface to between 0 and 1 in both U and V directions. Right-click on the (S)urface input and select this option near the bottom of the menu.

Now, the series of points created lie within the target domain, and the ISO CURVE component gives us isocurves spaced evenly in each direction.

76


Idea

Tutorial 2 - Section a surface with horizontal planes

This tutorial introduces students to intersection component in Grasshopper. This example uses horizontal planes as the intersecting geometry, commonly utilised in architecture to generate floor plates from the geometry of a building envelope.

77


Exercise Reference a group of curves from Rhino into Grasshopper using a CURVE geometry component. These curves will be used as the primitive input to create the surface from and to extract the isocurves.

(PARAMS/GEOMETRY/CURVE) Add a LOFT component to the canvas and pass the CURVE output to the curve (C) input of the loft component. This will create a nurbs surface flowing between the primitive or defining curves.

(SURFACE/FREEFORM/LOFT) Add a SECTION component to the canvas. This component will solve intersection events between a plane and a brep, in this case the lofted surface, and will produce a curves and points where the intersections occur. For this component to work the planes to intersect through the surface need to be created and inputted into the component. (INTERSECT/MATHEMATICAL/BREP/PLANE) Add a BOUNDING BOX component to the canvas. Pass the lofted surface (L) output to the geometry (C) input. The bounding box creates a box around oriented geometry and will be used to specify where these intersecting planes are to occur by placing perpendicular planes along two perpendicular edges of the box.

(SURFACE/PRIMITIVE/BOUNDING BOX) To specify the edges of the box to be we will need to decompose the box into its constituent points and create lines along the desired edges. This is achieved by using the BOX CORNERS component.

(SURFACE/ANALYSIS/BOX CORNERS)

78


Exercise To specify the edges to place the intersecting planes on lines will be created between box corners. Add a LINE between two points component to the canvas. As you connect different outputs of the ‘box corners’ component you can specify the edges of the box to be used. (CURVE/PRIMITIVE/LINE) Perpendicular frames which the planes of intersection will be located at can then be solved along the curve at specified locations.

(CURVE/ANALYSIS/PERP FRAME) To specify these locations we will create a range of numbers within a numeric domain using the RANGE component. The numbers within domain will be spaced evenly to give equal distribution of the intersection planes. The domain (D) of the component is set to 0.0 1.0 By default. By connecting a slider to the (N) input you can specify the number of steps, or number of frames. (SETS/SEQUENCE/RANGE) Pass the output (F) of the PERPENDICULAR FRAME component to the section plane (P) input of the section component and section curves through the surface will be created running in one direction.

To create section curves running perpendicular to the previous section curves copy the LINE, SLIDER, RANGE and PFRAME components. Pass different points from the BOX CORNER component in the line components until you have found to required edge.

79


Idea

Tutorial 2 - Section a polysurface with planes at variable angles

This tutorial introduces using multiple variable inputs to achieve unique and variable results.

80


Exercise Use the BREP (boundary representation) geometry component to reference in a 3d solid from Rhino. A BRep can be thought of as similar to a polysurface in Rhino. This component can also be used to contain/convert a standard nurbs surface.

(PARAMS/GEOMETRY/BREP) To section a BRep we need to find the intersection between the solid and a flat plane or surface. Creating surfaces solely for this purpose is computationally expensive so we will use a plane instead. A plane is the mathematical representation of a flat surface, so the intersection we require is in the mathematical drop down menu.

(INTERSECT/MATHEMATICAL/BREP|PLANE) We now need to create a plane to perform the intersection. At this stage which axes you select isn’t important for the definition to work properly, choose either a vertical (yz/xz) or horizontal (xy) plane.

(VECTOR/PLANE/YZ-PLANE) To add more variety to the possible outcomes reference a point from Rhino to be the origin of the initial intersection plane. This will be able to be moved around in the model space at any time for different results. Right-click and select ‘Set one point’. The location of the point will inform where the section is taken.

(PARAMS/GEOMETRY/POINT) To achieve the radial intersections of the solid we need to rotate the intersection plane. There are a number of rotation components to choose from, in this case the tool which rotates in a plane.

(TRANSFORM/EUCLIDEAN/ROTATE)

81


Exercise Assign a plane for the rotation to occur in. Choose a different plane to the one chosen for the section plane.

(VECTOR/PLANE/XY-PLANE) Connect the referenced point to this plane so that the rotation occurs around the same origin point that was assigned to the section plane.

Specify a rotation value using multiples of pi (Ď€). Pi has a default value of one (180 degrees from original position)

(MATH/UTILITY/PI) For an easily variable rotation value, connect a slider to the pi component.

(PARAMS/SPECIAL/NUMBER SLIDER) Create multiple sliders to achieve a number of variable section planes. Ensure to hold the shift key when connecting wires as the standard connection method overrides those previous.

82


Idea

Tutorial 2 - Move an object with a series component

This tutorial introduces using a sequence generated with a series component as an input parameter for a simple geometric transformation, in this case a move transform. Creating a uniform array of components we can design using linked but cheaply manufactured elements.

83


Exercise Model a 2d or 3d ‘chain link’ in the top view of Rhino. This will be arrayed in 2 directions to create a woven surface. Use the CURVE geometry component to reference the curve from Rhino.

(PARAMS/GEOMETRY/CURVE) In Grasshopper, ‘move’ is effectively the same as ‘copy’ as it creates a new geometry in the same or a different location. To array a geometry, simply move it a number of times.

(TRANSFORM/EUCLIDEAN/MOVE) Geometry is moved with a vector which is defined with a direction and a magnitude (ie. Move ‘n’ far in a ‘m’ direction). Use a unit vector (magnitude 1.0) In the direction of the x-axis to move the original curve. You will now see two curves. We can change the amplitude (or magnitude) of this vector by assigning a factor of multiplication.

(VECTOR/VECTOR/UNIT X) Rather than using a series of numerical inputs like sliders or integer parameters, use a series component to generate a sequence of variables. A series is a sequence of numbers where the first number is defined (S), each subsequent number in the series increases by a step size (N), and the number of values in the sequence is constrained (C).

(SETS/SEQUENCES/SERIES) This component has default settings to generate a series from 0 to 9, step size of 1. Ten links should now be previewed in Rhino model space.

84


Exercise The step size for your chain link is dependant on its dimensions. There needs to be sufficient overlap to ‘link’ but also to appear taut. Use a slider component to adjust the spacing of the arrayed components.

(PARAMS/SPECIAL/NUMBER SLIDER) Now create copies of this row of links in the other direction to create a two dimensional array.

(TRANSFORM/EUCLIDEAN/MOVE) This time use a unit vector component in the y-axis direction.

(VECTOR/VECTOR/UNIT Y) Connect the same series as was used in the initial move and view the results. You will notice some unexpected results. Instead of copying all of the 1d array up the distances specified it has moved the first copy up zero, the second copy up 1.0 and so on.

Right-click on the output ‘G’ from the first MOVE component and select ‘Graft’. This changes the structure of the data being passed into the second MOVE component. (for more information see Tutorial 04 and 05 on structure and manipulation of data) Check the results. Now every link is moved by every distance specified into a 2 dimensional array.

85


Exercise Again, adjust the array to match the dimensions of your ‘chain link’. You can also manipulate your initial curve so that adjoining elements are 3 dimensional and properly intertwine / link together.

(SETS/SEQUENCES/SERIES)

86


Idea

Tutorial 2 - Orient objects around a circle

This tutorial introduces ‘Orient’ and ‘Perpendicular Frames’ components to create a revolved form from an initial 2d profile curve.

87


Exercise Reference a profile curve from Rhino into Grasshopper.

(PARAMS/GEOMETRY/CURVE) We will use the orient tool to array the initial curve around a circle. Connect the curve component to the geometry input of the orient component. Hover the mouse cursor over the other inputs to see what the other inputs require.

(TRANSFORM/EUCLIDEAN/ORIENT) Input ‘A’ requires a plane which will be source location for the orient command. To give this plane an origin we can manipulate, we will create a point in the same viewport of Rhino and reference it into GH. Create a Point geometry component and reference the point from Rhino by right-clicking and selecting ‘Set one point’

(PARAMS/GEOMETRY/POINT) Create a plane in the YZ axis. This plane is infinite but we can assign an origin point to be the one we referenced from rhino. Then pass this plane to the orient component input ‘A’ to be the source plane.

(VECTOR/PLANE/YZ) Now create the circle to orient our curve around. Note that there are a number of components for creating a circle. Select ‘CIRCLE CNR’ which requires a centre point, a normal (vector direction) and an input radius.

(CURVE/PRIMITIVE/CIRCLE CNR)

88


Exercise Create a point from x,y, z coordinates and pass it into the centre point input for the circle. This component has default values set to zero for all inputs, so unless a variable is connected to one of the inputs, a point will be created at the origin point.

(VECTOR/POINT/POINT XYZ) There is also a default value set for the normal direction of the circle (a vector in the z direction) which we will keep. Create a number slider and connect it to the input for the circle radius. You may need to right-click on the slider and edit its properties to ensure it is at an appropriate scale for the profile curve you created earlier.

(PARAMS/SPECIAL/NUMBER SLIDER) Input ‘B’ of the orient component asks for the ‘final plane’ which the geometry will be oriented to. In this case we will create multiple planes which are perpendicular to the circle we created so that our profile curve appears to revolve around a central axis. Add a ‘perpendicular frames’ component. (Note the plural)

(CURVE/DIVISION/PERP. FRAMES) Connect these frames to the orient component to be the goal locations of the orient command.

Pframes has a default value of 10 for ‘N’ which will divide the curve ‘10’ times, creating frames evenly spaced along the circle. Add a slider to increase/ decrease this number and view the outcomes in Rhino. You can edit how large these planes appear in the view menu (view/ plane radius)

(PARAMS/SPECIAL/NUMBER SLIDER)

89


Idea

Tutorial 3 - Create a 3d grid of points

This tutorial shows how to create a 3d grid of points in two ways. The first example creates a 2d grid constrained to a cartesian plane and moving in a perpendicular axis. The second example uses data extracted from a surface. Both of the outcomes can be used in the following parts of this tutorial.

90


Exercise Reference a Point from Rhino into Grasshopper. To do this, first create a Point in Rhino. Then create a Point parameter component in Grasshopper and add it to the canvas. Right-click on the component and select ‘Set one Point’. Select the Point in Rhino.

(PARAMS/GEOMETRY/POINT) To create a 2d grid of points use the Square Grid component.

(VECTOR/GRIDS/SQGRID) The number of grid cells but have default values of 5. Add number sliders to these inputs and rename the sliders ‘Rows’ and ‘Columns’ by right clicking on the component and by clicking and typing in the top of the drop down menu. Rename the Point component as ‘Pt(reference)’.

(PARAMS/SPECIAL/NUMBER SLIDER) To create the 3d grid, we will array the 2d grid vertically using the Move component with vectors in the Z direction.

(TRANSFORM/EUCLIDEAN/MOVE) (VECTOR/VECTOR/UNIT Z) Like the additional control we added to the ‘Square Grid’ component with number sliders, multiple input values will be used to array the grid. Use a Range component with a number slider input for ‘n’- the number of steps.

(SETS/SEQUENCE/RANGE)

91


Exercise To achieve the desired proportions for your grid the output from the Range component (currently between a domain of 0 and 1) needs to be multiplied by an additional factor before being passed to the Z Unit vector.

(MATH/OPERATORS/MULTIPLICATION) The number of Move transformations achieved is defined by the ‘Layers’ slider going into the Range component. The data structure of the 2d grid of points however, causes an unexpected outcome. Use a ‘graft’ component so that each of the move transformations are applied to every point. For more information on this topic see Tutorial 4 Data Matching.

(SETS/TREE/GRAFT TREE) The second example uses a Surface as the base geometry. Reference a Surface from Rhino into Grasshopper by right-clicking a Surface component and selecting ‘Set one Surface’. Select the Surface in Rhino.

(PARAMS/GEOMETRY/SURFACE) To create a grid of points use the ‘Divide Surface’ component.

(SURFACE/UTIL/DIVIDE SURFACE) The number of divisions in the u and v directions of the surfaces domain are variable but have default values of 10. Add number sliders to these inputs and rename the sliders ‘Rows’ and ‘Columns’. Rename the surface component as ‘srf(reference)’.

(PARAMS/SPECIAL/NUMBER SLIDER)

92


Exercise To create the 3d grid, we will move the grid of points on the Surface in the direction of the surface ‘Normal’, the direction perpendicular to it at each point. For clarity it is often useful to disable the preview of previous components, in this case, the referenced Point. Right-click on the component and select the ‘preview’ option. Repeat this to enable again. (Shortcut ctrl+Q) (TRANSFORM/EUCLIDEAN/MOVE) To control the magnitude of the movement use the vector amplitude component. This maintains the original vector direction.

(VECTOR/VECTOR/AMPLITUDE) Add a Range component with a number slider input for ‘n’- the number of steps, for multiple transformations.

(SETS/SEQUENCE/RANGE) Use a multiplication component to scale the size of the transformation to suit the size of your surface.

(MATH/OPERATORS/MULTIPLICATION)

93


Idea

Tutorial 3 - Move a grid of points using a mathematical function

This tutorial introduces the use of a mathematical function to create a complex set of numerical data from a simpler range of numbers. This number set will then be used to inform multiple transformations on a set of points.

94


Exercise Reference a Point from Rhino into Grasshopper.

(PARAMS/GEOMETRY/POINT) Create a 2d grid of points with the Square Grid component. The number of grid cells have default values of 5 and a cell size of 1. Add number sliders to these inputs personalise them.

(VECTOR/GRIDS/SQGRID) Use a ‘flatten’ component to remove the data structure created by the component. For more information on this topic see Tutorial 4 Data Matching.

(PARAMS/SPECIAL/NUMBER SLIDER) Connect the points from the ‘flatten’ component to the geometry input of a move component.

(TRANSFORM/EUCLIDEAN/MOVE) To affect a move transformation, the operation requires the geometry to be moved and a vector (direction and magnitude). To begin, create a unit vector in the z direction. All points should move up by 1 unit.

(VECTOR/VECTOR/UNIT Z)

95


Exercise Rather than moving all points the same distance in the z direction, we want to use a maths function to generate difference across the moved field of points. Use a function component with 3 variable inputs (f with an x, y and z)

(MATH/SCRIPT/F3) The ‘f’ input requires an expression to solve. We will use a sine function to create outcomes which fluctuate smoothly up and down. Use a ‘panel’ component to enter the expression “sin(x+y)*z” and connect to the expression input.

(MATH/SCRIPT/F3) To create differentiation across the moved points, one of the inputs to the expression needs to be varied. Use a range component leaving the default domain as between zero and 1.

(SETS/SEQUENCE/RANGE) As trigonometric (or circular) functions such as sine, cosine and tangent are functions of an angle we will make a transformation of the range sequence as if it was in radians, to degrees.

(MATH/TRIG/DEGREES) Use a ‘list length’ component to return the total number of points in our grid. This figure is then passed to the ‘n’ input of the range component to match the number of points to the number of different vector lengths we provide the move component.

(SETS/SEQUENCE/RANGE)

96


Exercise Finally, add two number sliders to the y and z inputs. This will allow for user control over the output size and range of numbers generated by the math function.

(PARAMS/SPECIAL/NUMBER SLIDER)

97


Idea

Tutorial 3 - Move a grid of points using a graph

This tutorial introduces sampling a range of values from a Graph Mapper and using the values to achieve transformation gradations.

98


Exercise Reference a 2d surface in the xy-plane from rhino into grasshopper.

(PARAMS/GEOMETRY/SURFACE) To create a 2d grid of points use the ‘divide surface’ component.

(SURFACE/UTIL/DIVIDE SURFACE) Add number sliders to the inputs of the ‘surface divide’ component and rename them.

(PARAMS/SPECIAL/NUMBER SLIDER) Connect the points from the ‘p’ output to the geometry input of a move component.

(TRANSFORM/EUCLIDEAN/MOVE) Create a unit vector in the z direction. All points should move up by 1 unit.

(VECTOR/VECTOR/UNIT Z)

99


Exercise To create differentiation among the moved points, the magnitude of the ‘move’ vector needs to provide this change. Add two ‘graph mapper’ components. We will sample these to affect the difference in vertical movement in the x and y direction across the grid of points.

(PARAMS/SPECIAL/GRAPH MAPPER) When a graph mapper component is added the default state has no graph loaded. To change this, right-click on the component and select the select a ‘Graph Type’ from the sub-list of options.

Connect each of the ‘Rows’ and ‘Columns’ number sliders to a range component. The domain of both the range component and the graph mapper are set from 0 to 1 and therefore will sample the graph at the desired number of places. (Entering a sample value greater than 1 won’t work) Red vertical lines in the graph mapper visualises where samples are being taken.

(SETS/SEQUENCE/RANGE) Use the multiplication component to combine the sampled values.

(MATH/OPERATORS/MULTIPLICATION)

The output of the ‘Divide Surface’ component returns all division points, but each row is grouped into a separate list of data. To match the structure of the group of vectors to their appropriate points, graft the output of the top graph mapper. For more information on data matching, see Tutorial 4 - Data Structures.

(SETS/TREE/GRAFT TREE)

100


Exercise Finally, another multiplication operator is used to moderate the final amplitude values for the move.

(MATH/OPERATORS/MULTIPLICATION)

101


Idea

Tutorial 3 - Move a grid of points using a random function

This tutorial introduces the random numeric generator component to easily create a number of iterations from random movement transformations.

102


Exercise Reference a 2d surface in the xy-plane from rhino into grasshopper.

(PARAMS/GEOMETRY/SURFACE) To create a 2d grid of points use the ‘Divide Surface’ component. The number of divisions in the u and v directions of the surfaces domain are variable but have default values of 10. Disable the preview for the referenced surface.

(SURFACE/UTIL/DIVIDE SURFACE) Add number sliders to the inputs of the ‘Surface Divide’ component and rename them.

(PARAMS/SPECIAL/NUMBER SLIDER) Flatten the tree structure of the list of points with a ‘flatten’ component. For more information see Tutorial 4 - Data Matching.

(SETS/TREE/FLATTEN TREE) Connect the points from the ‘flatten’ component to the geometry input of a move component.

(TRANSFORM/EUCLIDEAN/MOVE)

103


Exercise Create a unit vector in the z direction. All points should move up by 1 unit.

(VECTOR/VECTOR/UNIT Z) Rather than moving all points the same distance in the z direction, we want to use a set of randomly generated numbers to move the field of points. Select the random generator from the ‘sets’ menu

(SETS/SEQUENCE/RANDOM) Use a ‘list length’ component to return the total number of points in our grid. This figure is then passed to the ‘n’ input of the random component. This sets the number of numbers generated, matching the number of points to the number of different vector lengths we provide the move component.

(SETS/LIST/LIST LENGTH) Attach a number slider to the ‘s’ input of the random generator. This is the ‘seed’ of the generation and changing this will change the set of numbers generated.

(PARAMS/SPECIAL/NUMBER SLIDER) The domain of the set of numbers generated is using the default values of 0 to 1 so add a multiplication component to adjust the amplitude of the vector length.

(MATH/OPERATORS/MULTIPLICATION)

104


Idea

Tutorial 3 - Move a grid of points using surface UVs and an image sampler

This tutorial introduces sampling quantitative information from an image and using it to transform geometries in 3 dimensions.

105


Exercise Reference a 2d surface in the xy-plane from rhino into grasshopper.

(PARAMS/GEOMETRY/SURFACE) To create a 2d grid of points use the ‘Divide Surface’ component. The number of divisions in the u and v directions of the surfaces domain are variable but have default values of 10. Disable the preview for the referenced surface.

(SURFACE/UTIL/DIVIDE SURFACE) Add number sliders to the inputs of the ‘Surface Divide’ component and rename them.

(PARAMS/SPECIAL/NUMBER SLIDER) Connect the points from the ‘Divide Surface’ component to the geometry input of a move component.

(TRANSFORM/EUCLIDEAN/MOVE) Create a unit vector in the z direction. All points should move up by 1 unit.

(VECTOR/VECTOR/UNIT Z)

106


Exercise Add the ‘Image Sampler’ component from the ‘Special’ menu and connect the uv points output from ‘Divide Surface’.

(PARAMS/SPECIAL/IMAGE SAMPLER) The sampler comes without an image loaded. Right-click on the component and click ‘image...’ To select an image from your computer.

This can also be done by selecting ‘Settings’ and setting the file path. Here the domain of the image is also set, the tiling options and what channel of information is being sampled from the image. Ensure your image domain is set 0.0 To 1.0 In both directions and choose ‘Clamp’ from the tiling methods.

(SETS/SEQUENCE/RANDOM) Choose a channel to sample. This tutorial uses ‘Value (brightness)’. This can be changed at any time generating different results.

A multiplication operator with slider is used to moderate the final amplitude values for the move.

(MATH/OPERATORS/MULTIPLICATION)

107


Idea

Tutorial 3 - Compound transformations using an attractor

This tutorial introduces the use of transformation information from components rather than the procedural geometric nature of most definitions. This allows for group and compound transformations.

108


Exercise This tutorial uses the definition from the earlier tutorial ‘Create a 3d Grid of Points’.

Draw a curve in Rhino and create a Point at one end. Reference these geometries from Rhino using Curve and Point geometry components in Grasshopper and rename as Crv(objects to transform) and Pt(reference). Create another point near to the 3d grid of points and reference, renaming the component Pt(attractor)

(PARAMS/GEOMETRY/POINT) (PARAMS/GEOMETRY/CURVE) Begin by creating an ORIENT component. Pt(reference) will be the source plane for this transformation. The target planes will come from the location of the points in the 3d grid.

(TRANSFORM/EUCLIDEAN/ORIENT) Graft the grid points so each point is in a separate list. Pass the attractor point to the first input of a VECTOR 2PT component.

(SETS/TREE/GRAFT TREE) (VECTOR/VECTOR/VECTOR 2PT) Create a vector from the attractor point to every point in the grid.

109


Exercise Create a plane at each point facing away from the attractor using the ‘plane normal’ component.

(VECTOR/PLANE/PLANE NORMAL) Connect the planes to the orient component to make them the target planes for the operation.

The second transformation will be to scale the curves. Connect the grafted points to the scale centre point input ‘C’.

(TRANSFORMATION/AFFINE/SCALE) We want to scale the arrayed curves relative to the distance they are from the attractor point but the actual distance would be too large a factor so we will remap the values to a more applicable domain. Pass the vector lengths to the component as the numbers to be remapped.

(MATH/DOMAIN/REMAP) Set the source domain of the remap component by finding the bounds (largest and smallest numbers) of the distances. As each distance is in a separate list we need to flatten the tree to a single list so they are compared and return a single domain. Right-click on the input and select ‘flatten’.

(MATH/DOMAIN/BOUNDS)

110


Exercise A multiplication operator with slider is used to moderate the final scaling factors that now are all between zero and 1.

(MATH/OPERATORS/MULTIPLICATION) The transform component allows us to transform a group of objects with a single transformation or multiple transformations at once.

(TRANSFORM/UTIL/TRANSFORM) Connect the ‘Transformation Data’ outputs from both the orient and scale components to a ‘Compound’ component. Note that the data contained isn’t scaled or oriented geometry but a description of the transformation.

(TRANSFORM/UTIL/COMPOUND) Pass the reference curve into a group component.

(TRANSFORM/UTIL/GROUP) Connect the ‘Group’ and the ‘Compound Transformation’ to complete the definition.

111


Idea

Tutorial 4 - Extract specific collections (items, branches)

This tutorial introduces how to extract specific items and collections (branches) from a data tree.

112


Exercise Reference a 2d surface in the XY-plane from Rhino into Grasshopper. and create a 2d grid of points use the ‘divide surface’ component.

(SURFACE/UTIL/DIVIDE SURFACE) Use the PANEL component and the PARAM VIEWER to view properties of the data output from the divide component. Not only can we see the cartesian coordinates of the division points but also that they are grouped into lists (or branches in GH tree talk). In fact each ‘row’ is on its own branch, making 6 branches each containing 4 points.

(PARAMS/SPECIAL/PANEL OR PARAM VIEWER) To extract items from a list we use the LIST ITEM component and its index. The index of each item is shown on the left of the panel and is like a count but like most numeric systems in the digital realm, begins counting from zero. Using a slider and comparing the panel outputs extract the first item with a zero index, second with one and so on.

(SETS/LIST/LIST ITEM) Another way to extract pieces of data from a tree is to extract an entire branch. This is more complicated than just taking an item from a list as it requires the complete path describing it.

(SETS/TREE/TREE BRANCH) The PANEL and PARAM VIEWER show that the address of the first branch of our tree is {0;0;0}. This is the syntax of the path structure we must use to retrieve the branch and the data it contains.

113


Grasshopper has a number of instances of translation logic with which when something is passed to an input, the program tries to convert it into the correct data type for the component. In this instance, we pass the PARAM VIEWER to a PATH primitive component it converts the strings

Like previously, use the LIST ITEM component to extract one of the data paths. A number slider makes this easily changeable.

(SETS/LIST/LIST ITEM)

Use the path retrieved with the LIST ITEM as the path input into the BRANCH RETRIEVAL component.

114

(alphanumeric characters) to data paths. We now have a list of all of the branch data paths.

(PARAMS/PRIMITIVE/DATA PATH)


From this branch we can extract more specific data, again using the LIST ITEM component.

(SETS/LIST/LIST ITEM)

Alternatively, now we have this amount of specific item path and location information we can retrieve a single item in one step using the TREE ITEM component.

(SETS/TREE/TREE ITEM)

115


Idea

Tutorial 4 - Transform with multiple attractors

This tutorial used mathematical functions and flow control to create a single transformation created from the proximity of an object to multiple locations occupied by an attractor point. These methods will create a ‘cutoff’ distance where an attractor no longer influences the transformation and a blend of influence when multiple attractors influence a single transformation.

116


Exercise Create a point and a 2d surface in the xy-plane in Rhino and reference both into Grasshopper using their respective geometry components.

(PARAMS/GEOMETRY/SURFACE OR POINT) To create a 2d grid of points use the DIVIDE SURFACE component with number sliders specifying number of rows and columns.

(SURFACE/UTIL/DIVIDE SURFACE) Right-click on the ‘s’ of the surface input. Select ‘reparameterize’. This redefines the parameters used to describe/analyse/transform the geometry. In this case, it remaps the domain of the surface to be between zero and 1 in both u and v directions. The reparameterize icon will remain next to the input while this function is activated.

Use the MOVE component as the transformation that will respond dynamically to the point’s proximity to the multiple attractor points.

(TRANSFORM/EUCLIDEAN/MOVE) To remove the list structure created by the SURFACE DIVIDE component and so that every point will move independently, use the GRAFT component to put all items in their own list.

(SETS/TREE/GRAFT TREE)

117


Exercise Create vectors between each of the points in the grid to each of the attractor points.

(VECTOR/VECTOR/VECTOR 2PT) The AVERAGE component finds the arithmetic mean of a set of values. This works with vectors retaining both direction and amplitude information. Use this to embed association to each of the attractor points to the transformation.

(MATH/UTIL/AVERAGE) The values passed to the AVERAGE component need to be mediated with a mathematical function so that we can set a cutoff distance to an attractors influence, a falloff in influence and overall amplitude of the move transform. Add a MULTIPLICATION operator.

(MATH/OPERATORS/MULTIPLICATION)

Use a function component with two variables (x,y). Within this component we can set conditional statements to filter out selected data and make alterations. Use the vector length output as the x variable and create a number slider to set the cutoff value in the y input.

(MATH/SCRIPT/F2) (PARAMS/SPECIAL/NUMBER SLIDER)

118

Use a PANEL component to enter the statement ‘if(x<y, (y-x), 0.01)’ This reads: if ‘x’ is smaller than ‘y’, then subtract the ‘x’ value from the ‘y’ otherwise make the output 0.01. Use another PANEL component to view and compare outputs (PARAMS/SPECIAL/PANEL)


REMAP the values to a domain from zero to the cutoff value.

(SETS/DOMAIN/REMAP)

Use another function with two variables, this time to be able to effectively scale the vector outcome to the desired size relative to the grid of points. Input the function â&#x20AC;&#x2DC;y/log(x)â&#x20AC;&#x2122; and add a numeric slider to input y.

(MATH/SCRIPT/F2)

Multiply the original vectors with the new, mediated amplitude values and use the AVERAGE component to combine the forces from the multiple attractors into one vector for each point.

119


Idea

Tutorial 4 - Draw curves through a grid of points in two directions

This tutorial introduces interpolation of points and some of the functionality of the path mapper to invert a data matrix.

120


Exercise This tutorial uses the definition from Tutorial 04 - Part 02, Multiple Attractors.

After the move transformation there are 144 branches with 1 item in each. To draw a polyline through each row of points we need to return the data tree to the structure it had after the surface divide component, where each row of points was contained on its own branch.

(PARAMS/SPECIAL/PARAM VIEWER) The PATH MAPPER component is used to manipulate data structures through lexical operations. Double-click the component to open up the expression editor.

(SETS/TREE/PATH MAPPER) The source notation is the existing path structure and should match what is shown in the param viewer with variable alphabetic placeholders. Ie {0;0;1;1} becomes {a;b;c;d} or {g;h;i;j}, Which placeholder letters used does not matter. If you are using the data within the lists themselves to manipulate the structure, this should also be included. ie. {0;1} N = 4 BECOMES {A;B}(i) The target notation uses the same lexical placeholders to represent the intended structure. Changing the order of and removing placeholders will change how data is grouped into branches.

121


Exercise Looking closely at the param viewer diagram, we can see that the rows of points are grouped when the data path has three placeholders before being split into individual branches.

As discussed earlier, the source notation needs to match exactly with the path shown in the param viewer but with placeholders. Enter {a;b;c;d}(i) as the source code and {a;b;c} as the target. Note that semicolons must be used as the separators and curly brackets (or braces) enclosing the path rather than parentheses.

The PARAM VIEWER should now show the list length as being the number of points in a row as specified with the column slider for the DIVIDE SURFACE component plus one.

Use a POLYLINE COMPONENT to create a curve through each list of points.

(CURVE/SPLINE/POLYLINE) A common request is to change the direction of these polylines without extensive additional work. By including a placeholder to represent the index of data items in parentheses we can sort like indices into lists (ie items with index â&#x20AC;&#x2DC;0â&#x20AC;&#x2122; into the first list and so on) SOURCE CODE - {a;b;c}(i) TARGET CODE - {a;b;i}(c)

122


Exercise Note that now we have a list of points on each branch the same length as the number of branches we had previously, and vice versa.

Use a component to generate a polyline through each list of points.

(CURVE/SPLINE/POLYLINE)

123


Idea

Tutorial 4 - Interpolate between a list of polylines

Interpolation involves creating new data points within the range of a discrete set of known data points. Here we will create these points between known discontinuity points and use them to recreate â&#x20AC;&#x2DC;betweenâ&#x20AC;&#x2122; polylines which blend between two input polyline shapes..

124


Exercise Create a number of curves in Rhino and move them so that they are some distance apart. Reference them into Grasshopper using a CURVE geometry component. Rename the component as keyframe curves.

(PARAMS/GEOMETRY/CURVE) Rebuild the curves as polylines. To do this, use the REBUILD component and ensure the degree (input d) for the new curve is set to 1. Either attach a integer component set to 1 or right-click the letter and go to â&#x20AC;&#x2DC;set integerâ&#x20AC;&#x2122;. Use a number slider to set the resolution of the new curve (number of control points).

(CURVE/UTIL/REBUILD) To create the interpolation points between succeeding curves we need to be able to compare a curve to its neighbour. To do this we need to make a list from the original with all items minus the last, and one with all items minus the first. Use two SHIFT LIST components with the shift offset (input S) set to -1 and +1 respectively. Wrap (W) must be set to false.

(SETS/LIST/SHIFT LIST) Find the points of discontinuity along each of the polylines.

(CURVE/ANALYSIS/DISCONTINUITY) To create the between-points, we need to move the first list of points in the direction of the second using a MOVE component.

(TRANSFORM/EUCLIDEAN/MOVE)

125


Exercise Create a vector between lists of points using VECTOR 2PT.

(VECTOR/VECTOR/VECTOR 2PT) Graft both the list of points and the list of vectors.

(SETS/TREE/GRAFT TREE) Rather than a single vector the length of the distance between the points we want a number of between points, so use a MULTIPLICATION operation to create vectors a fraction of the initial magnitude.

(MATH/OPERATOR/MULTIPLICATION) Use a RANGE component with default domain (zero to 1). ‘N’ input, controlled by an integer number slider, will now control how many points are interpolated between curves.

(SETS/SEQUENCE/RANGE) Connect the range of vectors to the MOVE component and view the points created.

126


Exercise Connect the geometry output of the MOVE component to a PARAM VIEWER. This will display how the data is structured both in text form or graphically using a ‘tree’ diagram. Double-click the component to toggle between these views. The data is arranged in a number of lists, (or branches in GH tree-talk) the number being the product of the number of control points we assigned to the rebuilt curves and the number of

spans between curves (we have used 3 curves in this example ie. 9Points x 2spans = 18branches). The number of items on each branch has been informed by the number of steps we assigned our range component (Note. 6 Steps = 7 values including 0.0)

(PARAMS/SPECIAL/PARAM VIEWER)

As each branch contains 7 items (n = 7) we know that the points are arranged in branches related to the original points of discontinuity and the range of vector amplitudes we supplied the move component.

Use a POLYLINE component to confirm this as it will create a straight interpolation through the points in each list.

A common request is to be able to change the direction of these polylines without extensive additional work. Using the PATH MAPPER we can manipulate how the data is structured. Doubleclick the component to open up the expression editor.

definition we want the indices of the items in each list to be sorted into their own lists. All the items with index ‘0’ in their own list and so on.

(CURVE/SPLINE/POLYLINE)

Enter {a;b;c;d}(i) into the source notation and {c;i}(d) to the target

(SETS/TREE/PATH MAPPER) The source notation is the existing path structure and should match what is shown in the PARAM VIEWER with variable alphabetic placeholders. Ie {0;0;1;1} becomes {a;b;c;d} or {g;h;i;j}, The placeholder letters don’t matter. If you are using the data within the lists themselves (as we will next) to manipulate the structure, this should also be included. Ie. {0;1} N = 4 becomes {a;b}(i) The target notation uses the same lexical placeholders to represent the intended structure. To flip the direction of the polylines created in the

127


Exercise Connect the moved points to the input and then onto the polyline. The data matrix should now have been flipped.

128


Idea

Tutorial 5 - Create tool to display datastructure

This exercise will demonstrate how to convert grasshoppers Data Structure objects to Strings (text) for displaying in the rhino viewport. It will introduce concepts of string operations such as concatenation that will be integral to later tutorials.

129


Exercise The exercise will produce a definition that works with any type of geometry, but as an example create several points in rhino and reference them into a POINT component. To remind ourselves that the definition will work with other geometry, connect the points to a GEOMETRY component. Finally, connect the output of the geometry component to a PARAM VIEWER to display its tree structure.

(PARAMS/SPECIAL/PARAMVIEWER) Next we use a neat trick in grasshopper to extract the path objects from the viewer. If you connect the param viewer output to a PATH component, the path component will contain a list of all of the branches in the tree. We then GRAFT this list, to ensure that for each branch in our datastructure, we can still map a list of indexes to it (This sounds confusing - it will become more clear later in the tutorial). Finally we connect our grafted list to a PANEL component, which will convert any input to Strings (text). This gives us half of the structure information we need - telling us which branch our geometry is on. We still need to find out which index our geometry is located at on each branch.

(PARAMS/PRIMITIVE/DATAPATH) (SETS/TREE/GRAFTTREE)

List indexes cannot be created using clever tricks like with the param viewer, so to find the index of the geometry, we need to create a new list that mimics the length of the one we are trying to display. Use a LIST LENGTH component to calculate the total number of items in a list, then use the SERIES component to create a series of numbers from 0 to the total number of items in our list. The series component generates decimal numbers, which in this case are superfluous to our needs as we are only counting indexes and therefore only need whole numbers. Connect the output of the series to an INTEGER component to convert the decimal numbers to whole numbers.

(SETS/LIST/LISTLENGTH) (SETS/SEQUENCE/SERIES)

130


Exercise Now we are going to use a function component in order to present our data in a more readable way (we are going to do the fairly menial task of adding a space to the beginning of each of our strings). This joining of one string (“ “) to another (the string representing the index of our geometry in a list) is called concatenation, and using the “&” syntax in a function component is one way to achieve this in grasshopper.

Connect the output of our INTEGER component to a panel to convert the numbers to strings. Then create a F(1) component, and connect the strings to its x input. Create a panel (shown in grey) to define the function for the component to run, and input (“ “ & x) without the brackets.

(MATH/SCRIPT/F1)

Now, as a means of demonstration, we can use a CONCATENATE component to join our path information string to our list index string. You could also use an F(2) component and use the “&” syntax to concatenate the x and y inputs to the function. Likewise you could also do it with a script component...

(SETS/STRINGS/CONCATENATE)

131


Exercise Finally, we are going to display this structure information in the rhino viewport using a TEXT TAG 3D component. Drop one of these onto the canvas and take a look at its inputs. Most importantly it requires a location (L) for the text - we don’t necessarily have this yet, and the text to display (T) which will be the output of our concatenated strings. Connect this to the T input.

(VECTOR/POINT/TEXTTAG3D)

To produce a point to display our structure at, we are going to use some bounding box components. We do this so that if we are trying to display data structure of more complex objects (such as curves or surfaces), the structure information will always be displayed in the corner of the geometries bounding box. Create a BOUNDING BOX component to find the bounds of an object, then create an EVALUATE BOX component to find the point at (0,0,0) in ‘box space’. This will be one of the corners. Lastly, we can connect out PT output from the evaluate box component to the L input of our tag component. Depending on the size of your model you may need to specify a different size for the text using the (S) input.

(SURFACE/PRIMITIVE/BOUNDINGBOX) (SURFACE/ANALYSIS/EVALUATEBOX)

132


Idea

Tutorial 5 - Pathmap with string components

This tutorial demonstrates how use string components to replace data structure information in a tree. This essentially mimics the functionality of grasshoppers path mapper, whilst allowing for more control during the process. It further introduces concepts such as character arrays that will be utilised in later exercises. It is worthwhile referring to the online reference material on grasshoppers data structures while attempting to work your way through this tutorial. It introduces a generic situation in order to expose students to some of the methods for resolving more design-specific data mapping problems.

133


Exercise To begin with lets create a data structure similar to earlier tutorials with the pathmapper. Draw three curves in rhino, reference them into a CURVE component, then divide the curves using a DIVIDE CURVE component. This will give us a data structure with three branches, and 10 points on each branch.

(CURVE/DIVISION/DIVIDECURVE) Now lets use the PATH MAPPER to flip the data structure of the points. If we map from {a;b}(i) -> {a;i}(b) Grasshopper will create a new branch for each index in the list of points, and place the old index on this new branch. Therefore, all of the points that were index 0 on several different branches become one list on one branch. Our new tree structure should have 10 branches with 3 points per branch. Then use a CURVE component to fit a curve through these newly structured lists of points.

(SETS/TREE/PATHMAPPER)

The problem with the path mapper is if we change the input structure of points, then we need to go ahead and manually change the mapping - not a very parametric process. We are also restricted to global mappings - everything in the datatree is mapped in the same way. We will try to learn a new way of manipulating data structures using very simple script components and strings. Graft the output of our divided points, and connect the result to a PARAM VIEWER to get a feel for the tree structure. We graft the tree because this creates new path information for list indexes, and makes our custom mappings a little easier. Unlike the previous exercise, we are going to try to play with the path structure without mimicking the lists using series components.

134


Exercise Time for another new component, CHARACTERS. This component explodes a string into a list of individual characters, something we will be doing a bit of later on in VB.NET. We use it here to get a list of each bit of information in the path object. For example, a path defined as {0;1;5} (the 6th point on the second curve) when exploded will give a list as follows: 0. { 1. 0 2. ; 3. 1 4. ; 5. 5 6. } Because this is essentially just a list of numbers, we can either perform mathematical operations on the information itself (addition, division, multiplication), or we can shuffle the order of the list around to produce different mappings.

(SETS/STRING/CHARACTERS) Shuffling is exactly what we want to do. If you think about it, in order to produce the same mapping as the path mapper in the example provided on the previous page, we need to take whatever information we have at index (3) in our list, and replace it with the information we have at index (5). The simplest way to do this is to use a script component - but donâ&#x20AC;&#x2122;t get scared - we are only going to write one line of code. Create a VB.NET component, and right click its x input and choose LIST ACCESS. Then double click the script component and input the following line:

The brackets refer to an index in the list of data called x. So this one line of code essentially creates a new string by joining the 0th item in x ({), then the 1st (0), the 2nd (;), the 5th (5) and then the 6th (}). Easy. Flatten the output of the component so that we have a single list of path objects trying to map trees of trees would get extremely complex!

(MATH/SCRIPT/VBSCRIPT)

a = x(0) & x(1) & x(2) & x(5) & x(6)

135


Exercise Finally, we use a REPLACE BRANCHES component to perform the actual mapping. This component works by taking two lists of path objects one representing the original paths, and one representing the paths they should be replaced with. Connect our data to be mapped - the grafted points, and the path object representing their structure. Then connect the flattened list of new paths to the component. The output should be a list of points organised in exactly the same way as our pathmapper - try it by connecting it to a curve component.

(SETS/TREE/REPLACEBRANCHES)

136


Idea

Tutorial 5 - Iterate through a tree in VB

This exercise introduces how to access items and branches within data structures using a VB script component.

137


Exercise Firstly, we set up a set of data to pass to the input of the script component. Reference some curves from Rhino and use a REBUILD component to rationalise them into segmented polylines. Create a number slider to inform the number of segments.

(PARAMS/GEOMETRY/CURVE) (PARAMS/SPECIAL/NUMBER SLIDER) (CURVE/UTIL/REBUILD) Next, find the points of discontinuity of each of these curves.

(CURVE/ANALYSIS/DISCONTINUITY) Attach a PARAM VIEWER component to view the data structure. We have referenced 3 curves from Rhino and rebuilt them with 13 control points so have created 3 branches of data each containing 13 items.

(PARAMS/SPECIAL/PARAM VIEWER) (PARAMS/SPECIAL/PANEL) Pass this data stream into a VB.NET component. Right-click the (X) input and select ‘Tree Access’.

(MATH/SCRIPT/VB SCRIPT)

138


Exercise First we will create a comment to help work out what we are doing and so that when others or our future selves look back over the script it is apparent what the script does.

‘create a loop that iterates over the ‘path objects in x (as generated by the ‘paramviewer component in grasshopper)

Use (‘) apostrophes to comment code in VB. Comments are lines that the computer doesn’t read - you do. Be careful with syntax - make sure you type each line very carefully and watch out for spelling and grammar errors. We will use a For Each statement to loop through every branch in the tree. Declare a variable p As GH_Path. Use the Paths method of our dataTree object (x), which gets the list of all the data Paths in the tree and our statement will run through all the paths that exist in the list.

‘create a loop that iterates over the ‘path objects in x (as generated by the ‘paramviewer component in grasshopper) For Each p As GH_Path In x.Paths

‘do something inside the loop Next

This will iterate through each branch of the dataTree, now we want to iterate through each object in each list in the same manner.

‘create a loop that iterates over the ‘path objects in x (as generated by the ‘paramviewer component in grasshopper)

Declare another variable o As Object and iterate through all the object in the list of the current path.

For Each p As GH_Path In x.Paths

Note: A path is like an address. A branch is a list of objects at that address.

‘create another loop that iterates over all ‘of the objects on this branch For Each o As Object In x.Branch(p) Next Next

Now to see the object data of each item that we cycle through, we will print the String (a series of alphanumeric characters) description of that data.

‘create a loop that iterates over the ‘path objects in x (as generated by the ‘paramviewer component in grasshopper) For Each p As GH_Path In x.Paths

‘create another loop that iterates over all ‘of the objects on this branch For Each o As Object In x.Branch(p)

‘make sure it works.... print(o.ToString()) Next Next

139


Idea

Tutorial 6 - Find angles between segments of a polyline

One of the strengths of digital modelling during the design process is that the information required for documentation and fabrication is embedded in the geometry and can be easily extracted. This information extraction process can be as flexible as the modelling methods we have shown, updating automatically as the geometry changes. In this tutorial we will take one, or a collection of polylines, and extract angle information between segments along them.

140


Exercise Reference one, or a collection of polylines into grasshopper using a CURVE geometry component

(PARAMS/GEOMETRY/CURVE) To decompose the polyline into a series of straight segments we need to find points of discontinuity (where the curve changes direction).

(CURVE/ANALYSIS/DISCONTINUITY) Make a list from the original with all items minus the last, and one with all items minus the first, use two SHIFT LIST components with the shift offset (input S) set to -1 and +1 respectively.

(SETS/LIST/SHIFT LIST) Redraw the polyline as a series of lines drawn between 2 points.

(CURVE/PRIMITIVE/LINE 2PT) To find the angle between adjacent segments we need to compare them, by creating two lists with the segments to be compared sharing the same index. Use two SHIFT LIST components again with the same shifting offset values.

(SETS/LIST/SHIFT LIST)

141


Exercise Now we have the segments we can start to think about comparing them to find the angle between. We use the angle component but must understand what the component actually does before we can trust the results. This component compares two vectors, so we know that the direction of the line (how it was drawn) matters.

(VECTOR/VECTOR/ANGLE) Both vectors should be originating at the same point to get the correct angle between. This means the direction of one of the vectors (which we are translating from a line) needs to be reversed.

(VECTOR/VECTOR/REVERSE) Angles are returned in radians. The ANGLE component also has an optional plane input to ensure that the angle is taken in the manner you would like. Ie you could find the angle between two vectors in the XY plane only, as they would be seen in plan.

(MATH/OPERATORS/MULTIPLICATION) To try and ensure accuracy, we will supply a plane as well as the vectors to be compared. In the plane drop down menu there are a number of geometric combinations that can be used to create a plane. Select LINE + LINE. Add another shift list component with shift offset set to -1.

(VECTOR/PLANE/LINE + LINE) The SHIFT LIST component will give us the points at the location where the angles are being measured. Use the PLANE ORIGIN component to locate them and pass the planes to the ANGLE component. (VECTOR/PLANE/PLANE ORIGIN) Finally, use a â&#x20AC;&#x2DC;degreesâ&#x20AC;&#x2122; component to convert the angle found from radians to degrees. (MATH/TRIG/DEGREES)

142


Idea

Tutorial 6 - Find the lengths of segments of a polyline

In this tutorial we will take one, or a collection of polylines, and extract length dimensions of each straight segment.

143


Exercise Reference one, or a collection of polylines into Grasshopper using a CURVE geometry component.

(PARAMS/GEOMETRY/CURVE) To decompose the polyline into a series of straight segments we need to find points of discontinuity (where the curve changes direction).

(CURVE/ANALYSIS/DISCONTINUITY) The ‘t’ output returns the parameters of the curve, with each straight segment having a domain of 1. Use this to shatter the curve at the points of discontinuity.

(CURVE/DIVISION/SHATTER) Use the CURVE LENGTH component to measure the length of each segment. The returned values appear unitless, but this is inherited from the properties of your Rhino file.

(CURVE/ANALYSIS/LENGTH) To rationalise and add further information to this list of values, use a function component with two variable inputs to perform a number of string operations.

(MATH/SCRIPT/F2)

144


Exercise Using two PANEL components we can concatenate strings to add notation describing the dimension and as well as unit information.

(PARAMS/SPECIAL/PANEL) Translating the decimal (or floating point) data to an integer rationalises the documentation to a reasonable level for fabrication.

The PANEL component can stream its contents to an external spreadsheet making this information directly transferable to a number of fabrication equipment. Right-click and select â&#x20AC;&#x2DC;stream contentsâ&#x20AC;&#x2122;

145


Idea

Tutorial 6 - Labelling a 3d model using text tags

In addition to having a real time streaming document containing dimensional information which can be used for documentation, pricing and fabrication, we can display the same information within the 3 dimensional display of rhino. This tutorial introduces 3d text tags.

146


Exercise This exercise uses definitions from the previous two tutorials: Tutorial 05 - Part 01 Find angles between segments of a polyline Tutorial 05 - Part 02 Find lengths of segments of a polyline.

To label the lengths of each polyline segment at its midpoint we require the string output from the function component and the segments themselves from the SHATTER component output. Pass the strings to a STRING data component and the segments to a CURVE geometry component.

(PARAMS/PRIMITIVE/STRING) (PARAMS/GEOMETRY/CURVE) To display data like strings in the Rhino model space, Grasshopper has two TAG components. One is 2d and displays in the XY-plane at the point supplied and the other 3d tag can be assigned a plane to be oriented to. The string is supplied as ‘text to display’

(VECTOR/POINT/TEXT TAG 3D)

Use the POINT ON CURVE component to evaluate each segment at 0.5 (Midpoint).

(CURVE/ANALYSIS/POINT ON CURVE) The orientation to display the text depends on the geometry being dimensioned. Choose and supply the points on curve as the plane origin points. Text size can also be manipulated by right-clicking on the ‘S’ input and entering a value.

(VECTOR/PLANE/XZ PLANE)

147


Exercise To display the angle information in Rhino we will use two pieces of data from the analysis definition. Pass the angle to a INTEGER data component and the points from the bottom shift list to a POINT geometry component as shown.

(PARAMS/PRIMITIVE/STRING) (PARAMS/GEOMETRY/POINT) Use a function with a single variable input to perform another string operation to add dimension information.

(MATH/SCRIPT/F1) Supply the string to a 3D TAG component.

(CURVE/ANALYSIS/POINT ON CURVE) Orient the tag as before.

(VECTOR/PLANE/XZ PLANE)

148


Idea

Tutorial 6 - Orient objects to a grid

As part of the process of preparing geometries for fabrication it is often necessary to array the objects into a grid of evenly spaced geometries. This aids the sequencing and labelling procedures of parts pre and post manufacture.

149


Exercise This exercise uses the definition from Tutorial 04 - Part 04 Interpolate between a list of polylines

Pass the curves from the POLYLINE component to a CURVE geometry parameter and remove the existing data structures by right-clicking the component and selecting ‘flatten’.

(PARAMS/GEOMETRY/CURVE) We will be orienting this list of curves using the ORIENT component which uses source and target planes.

(TRANSFORM/EUCLIDEAN/ORIENT) The source planes will be frames taken perpendicularly at the start of the curve. Use the PERP. FRAME (note singular) with the evaluation parameter set to zero.

(CURVE/ANALYSIS/PERPFRAME) The target planes will be created from a grid of points. Use a rectangular grid component and create number sliders to manipulate the size of the grid cells.

(VECTOR/GRIDS/RECTANGULAR)

150


Exercise To ensure there is always enough cells in the grid to orient curves to we will use a FUNCTION component. if(sqrt(x) > int(sqrt(x)), int(sqrt(x))+1, int(sqrt(x))) This is a complicated way of rounding the numbers we have.

(PARAMS/PRIMITIVE/STRING) (PARAMS/GEOMETRY/POINT) Use a LIST LENGTH component to return the number of curves in the list. The function component then defines the grid dimensions to be just more than the square root of this figure.

(SETS/LIST/LIST LENGTH) Flatten the list of cell curves and use the AREA component to find the centre point of each cell. This is our target plane as the ORIENT component assigns a plane in the XY-axis at this point.

(SURFACE/ANALYSIS/AREA) If the ORIENT component has more target planes that curve geometries it repeats the orientation of the final curve to the additional planes. To remove these, right-click on the component and select â&#x20AC;&#x2DC;shortest listâ&#x20AC;&#x2122;. Now when the curves run out, the orient component stops.

151


Idea

Tutorial 7 - Create a proximity network on a surface REQUIRES KANGAROO PLUGIN

This is the first in a series of tutorials that will deconstruct the â&#x20AC;&#x2DC;planar joineryâ&#x20AC;&#x2122; definition demonstrated during the seminar. The definition finds intersecting points (nodes) in a network of curves, and modifies the ends of these curves to describe a planar connection for fabrication. This simple definition generates a random proximity network on a surface and is intended primarily to demonstrate the functionality of the planar joint.

152


Exercise Use the CURVE tool in Rhino to draw three closed curves. Use the MOVE tool in Rhino to move two of the curves vertically to create a top, middle and bottom of our loft. Reference all three curves into a grasshopper CURVE parameter component.

(PARAMS/GEOMETRY/CURVE) Place a LOFT component on the canvas. The component will interpolate a surface through the inputted curves, and the order in which they are referenced is important.

(SURFACE/FREEFORM/LOFT) Place a FREEFORM CLOUD and NUMBER SLIDER on the canvas. This component creates points on the surface of a given geometry. It is useful for very quickly generating points on a shape without needing to define a grid or a UV mapping. You should see a random cloud of points on your lofted surface.

(VECTOR/GRIDS/FREEFORM CLOUD Now we are going to use a PROXIMITY 3D component to draw lines between the points in the cloud based on a the distance between them and a maximum number of neighbours. In this tutorial we simply want to generate an arbitrary network as quickly as possible, but proximity is also useful for triangulating fields and diagramming relationships between nodes among other things.

(MESH/TRIANGULATION/ PROXIMITY3D) Lastly a little clean up. Right click on the G input of the proximity component and choose Set Number to set it to 2. This should prevent grasshopper from creating more than 3 lines from each point, a key constraint to the rest of the definition. Then add a REMOVE DUPLICATE LINES component (from kangaroo). This remove double ups in our network that would otherwise break future tutorials.

(KANGAROO/UTILITY/REMOVEDUPLICATELINES)

153


Idea

Tutorial 7 - Create planes around nodes REQUIRES KANGAROO PLUGIN

This exercise demonstrates how to use a vb.net component to find curves that share a ‘node point’, and to use simple methods to create points a specific distance away from the node. Whilst this functionality exists in normal grasshopper land, it is much easier to write a script to handle ‘search, check, evaluate object’ algorithms. It is intended as a means of exposing students to the specific elements that make up a more complex parametric model, and should not be thought of as an introduction to scripting in grasshopper. However, before beginning the exercise, students should be familiar with the vb script interface, the concept of loops and conditional statements. For reference material, refer to the EXLAB:BEND manual.

154


Exercise Use the outputted network of curves from the previous exercise, and connect them to a CURVE PARAMETER component in order to organise your definition. Using these separate parameter components at key moments in a definition makes it slightly easier to identify where you can replace an input with something else. (Later tutorials)

(PARAMS/GEOMETRY/CURVE) Use and END POINTS component to get the start and end points of every inputted curve. Next use a REMOVE DUPLICATE POINT component (from kangaroo) to generate a list of unique point locations. This is extremely useful for search algorithms. Imagine having 5 apples on a bench and being asked to pick the closest apple. Easy? Now image 4 of the 5 apples being in EXACTLY the same place. How do you choose the closest apple? (CURVE/ANALYSIS/END POINTS) (KANGAROO/UTILITIES/REMOVEDUPLICATEPTS) Now we jump into setting up our VB SCRIPT component. By default this component has two inputs, x and y, but you can add as many inputs and outputs as you like. Connect them as shown, and then we can get on to telling the component how to read the data that we are providing it. (MATH/SCRIPT/VBSCRIPT)

Setup: Right click on the x input and choose list access. This forces the script to ignore datatrees and lets us loop through whatever we input. Do the same for the y input, and also choose flatten to make sure we are ignoring tree structures (we don’t care where the points came from, we just need all of them and their locations). Lastly, we need to create a third input for the component. Zoom in on the component until the small plus signs appear, and click on one on the left hand side to add an extra input. Finally, you can rename your component and its inputs to something more familiar. Right click on the inputs, and change the name of x to ‘crvs’, y to ‘pts’ and z to ‘distance’. These will become the variable names once we start scripting, and we will quickly get lost (as beginners) if we need to be constantly checking just exactly what ‘x’ is. We will also need a number slider for our distance input.

155


Exercise First things first. You are going to write a script that other people are going to want to read, share, extend and credit you for. Make sure they know who you are. Use (‘) apostrophes to comment code in VB. Comments are lines that the computer doesn’t read - you do. Be careful with syntax make sure you type each line very carefully and watch out for spelling and grammar errors.

‘Code by Gwyllim Jahn ‘elseware 2012 ‘Educational Use

Next we write some real code, and in doing so make the variables that will store information while our script is running, and then output it to the outside grasshopper definition once we are done. Dim outCrvs As New dataTree(Of Curve) creates a variable (Dim) called outCrvs which is a dataTree that stores curve objects ((Of Curve)). By using the New keyword, we tell vb to create a blank copy of a datatree object. For more info on this, read up on Objects and Classes.

‘Code by Gwyllim Jahn ‘elseware 2012 ‘Educational Use

After we have created our variables, we are going to start sifting through the data that we have inputted to our component. These lines create what is called a ‘loop’, a section of code that executes over and over again until a condition is met. In this case we are going to go through our points one by one, and find all of the lines that share an end point with this point. Because we are using a loop, we only need to write the code that checks this once. It will then be ran over and over again for each point. For more info on this, read up on Iteration and Looping.

‘Code by Gwyllim Jahn ‘elseware 2012 ‘Educational Use

Dim outCrvs As New dataTree(Of Curve) Dim outParams As New dataTree(Of Double) b = outCrvs c = outParams

Dim outCrvs As New dataTree(Of Curve) Dim outParams As New dataTree(Of Double) ‘loop through unique points For i As Integer = 0 To pts.Count() - 1

‘looped code here Next

b = outCrvs c = outParams

156


Exercise Now we create another loop - nested inside our first one. For every single point in the list, we are looping through every single curve in order to find the two or three that share an end point with the one we are checking. We also create a path object here, in order to create a tree structure that ‘remembers’ which point we are working on. That way once the script has finished running, we will have a datatree that is organised with each branch representing a node in our network, and containing a list of lines that connect at that node. Tedious, but clever.

‘Code by Gwyllim Jahn ‘elseware 2012 ‘Educational Use Dim outCrvs As New dataTree(Of Curve) Dim outParams As New dataTree(Of Double) ‘loop through unique points For i As Integer = 0 To pts.Count() - 1 Dim p As New gh_path(i) ‘for each point, find the t value of ‘the two curves that share the point For j As Integer = 0 To crvs.Count() - 1 Next Next b = outCrvs c = outParams

In these few lines we start working with the data we are looping through. Inputs to the script component are passed in ‘By Value’, which means that we cannot change them at all inside the script. (Changing objects requires a ‘By Reference’). So instead, we create a new curve object called tCrv and use its duplicate method (a ‘method’ is a function specific to an object) to copy our inputted curve. Then we can start changing it - in this case we reparameterize the curve by changing its Domain property. Properties are like methods, they are object specific. Then we create a variable called t, which we will use in a minute.

‘Code by Gwyllim Jahn ‘elseware 2012 ‘Educational Use Dim outCrvs As New dataTree(Of Curve) Dim outParams As New dataTree(Of Double) ‘loop through unique points For i As Integer = 0 To pts.Count() - 1 Dim p As New gh_path(i) ‘for each point, find the t value of ‘the two curves that share the point For j As Integer = 0 To crvs.Count() - 1 Dim tCrv As Curve = crvs(j).duplicate tCrv.Domain = New interval(0, 1) Dim t As Double = 0 Next Next b = outCrvs c = outParams

157


Exercise Here we use another method of the Curve object to find the closest point on the curve (tCrv.ClosestPoint). Methods have specific parameters called ‘arguments’. For the closest point method, we need to provide some information on which point we want to check from (pts(i)), the parameter of the curve which represents the closest point on the curve (t), and the maximum distance to bother searching. In this case the max distance is very small as we are only really interested in points that are already on the curve (distance 0). This ClosestPoint method sets the value of t, but it is also a Conditional statement. If no points are found that are less than 0.01 away, then the method returns false. This is useful, because we can use the function to find only the curves that terminate at a node (our grand aim).

‘Code by Gwyllim Jahn ‘elseware 2012 ‘Educational Use Dim outCrvs As New dataTree(Of Curve) Dim outParams As New dataTree(Of Double) ‘loop through unique points For i As Integer = 0 To pts.Count() - 1 Dim p As New gh_path(i) ‘for each point, find the t value of ‘the two curves that share the point For j As Integer = 0 To crvs.Count() - 1 Dim tCrv As Curve = pts(j).duplicate tCrv.Domain = New interval(0, 1) Dim t As Double = 0

For more info on selecting items from lists in vb.net (pts(i)), refer to the datatree section of the EXLAB:BEND manual.

‘check to see if point is less than ‘0.01 away from the curve If(tCrv.ClosestPoint(pts(i), t, 0.01)) Then End If Next Next b = outCrvs c = outParams

158


Exercise Next we add another conditional statement to make sure we are only working with the start point of a curve, and if not, flip it. This code prevents our script outputting geometry that is difficult to work with using standard grasshopper components. Finally, we use another method of the Curve object to find the parameter of a specific distance along a curve (tCrv.LengthParameter). Once this is done, all we need to do is add our objects to the dataTrees we created at the start of the scripting tutorial. Adding is a method of the dataTree object, and has two parameters. The object to be added (tCrv, tDist), and the path to store the object at (p).

‘Code by Gwyllim Jahn ‘elseware 2012 ‘Educational Use Dim outCrvs As New dataTree(Of Curve) Dim outParams As New dataTree(Of Double) ‘loop through unique points For i As Integer = 0 To pts.Count() - 1 Dim p As New gh_path(i) ‘for each point, find the t value of ‘the two curves that share the point For j As Integer = 0 To crvs.Count() - 1 Dim tCrv As Curve = crvs(j).duplicate tCrv.Domain = New interval(0, 1) Dim t As Double = 0

Your script should now be fully functional! But you won’t see much geometry yet, we will be working with this crucial information in the next tutorial.

‘check to see if point is less than ‘0.01 away from the curve If(tCrv.ClosestPoint(pts(i), t, 0.01)) Then If(t > 0.1) Then ‘flip the curve and fix the param tCrv.reverse tCrv.Domain = New interval(0, 1) t = 1 - t End If Dim tDist As Double = 0 tCrv.LengthParameter(distance, tDist) outCrvs.add(tCrv, p) outParams.add(tDist, p) End If Next Next b = outCrvs c = outParams

159


Idea

Tutorial 7 - Fit circles through node points

This exercise uses the output from the script created in Part 02 to define the size and locations of circular geometries around nodes. Circles are used because grasshopper has some convenient tools for fitting circles through three points and thus they are always planar, allowing us to easily define a connection between 3d lines. However, this limits the geometry of the network as it is not always possible to fit a circle through more than 3 points/connecting lines. The exercise demonstrates how to create a flexible definition that accounts for 2 and 3 intersections at a node. This requires breaking the definition into two halves using dispatch components.

160


Exercise Continue the definition from the previous exercise by using the data from the script component with an EVALUATE CURVE component. This will find the point and tangent at a set parameter on a curve.

(CURVE/ANALYSIS/EVALUATECURVE) Next we need to find out if we have two or three connecting lines at the node, as this will effect how we generate our circles. We use a LIST LENGTH component to test how many lines we have at each node. Then we use an EQUALITY component to test if we have 2 lines. This component generates boolean values (true if 2, false if not), which we can use as an input for a DISPATCH component.

(SETS/LIST/LISTLENGTH) (MATH/OPERATORS/EQUALITY) (SETS/LIST/DISPATCH) The dispatch component takes an input List (L) and an input pattern (P). In this way, we can use one pattern to dispatch any data we like, so long as they share the same structure. We use two dispatch components, one dispatches our curves, and one dispatches our points. The A output of the dispatch will be lists that have true value to the pattern (in this case, true values are lists that have exactly 2 curves). The B output will be lists that have a false value (anything other than 2 curves). Later on in our definition we will fit a circle through a list of points. When we have 3 connecting lines at a node, this will conveniently produce a clean, reasonably sized circle. But if we only have two nodes, it will fit an enormous circle through those two points. What we are trying to do here is generate a third point for this case, that will result in a reasonable sized circle.

We then evaluate the curve at 0 to get the start point of the curve, and use a bunch of CLEAN components to remove nulls and empty branches from our data.

(SETS/TREE/CLEANTREE)

161


Exercise Finally, we are going to create vectors (VECTOR2PT) between the two points on our lines that will define the circle, and our new point that was created by the eval curve component. We then AVERAGE the vectors to find a new vector that will MOVE our point out from the node location an equal amount from each of the other points. We can then connect this new moved point, and the points from our cleaned dispatch (A) to a FIT CIRCLE component. The points from our (B) dispatch are good to go. Voila!

(VECTOR/VECTOR/VECTOR2PT) (MATH/UTIL/AVERAGE) (CURVE/PRIMITIVE/CIRCLEFIT)

162


Idea

Tutorial 8 - Create a substitution script in VB.NET

This exercise introduces the concept of substitution rules through a recursive function written in VB.NET. As with previous VB.NET tutorials it is not intended as an introduction to scripting but instead should demonstrate how particular design goals or computation concepts can be achieved using script. Unlike Tutorial 8-Part 02, l systems cannot be created using standard grasshopper components and dataflow as they require feedback between the inputs and outputs of the system in order to continue to â&#x20AC;&#x2DC;growâ&#x20AC;&#x2122; the output of the script. This exercise will not produce any geometry but will demonstrate the principle of an L System whereby characters in a string are substituted with further characters based on rules inputted by the designer. In later tutorials the string characters will be replaced with geometry and a connection logic in order to produce form.

163


Exercise Firstly, we set up the inputs for the script component. Use PANELS to quickly create the rules for the Lsystem. We define the rule using a String of characters. Inside the script we can use string methods to split the string into two parts at the comma, in order to distinguish between the identifying character (e.g. ‘a’) and the substitution rule (‘abc’). Connect all the rules to a string component for organisation. Also create a number slider to tell the script how many iterations to run.

(PARAMS/SPECIAL/PANEL) Next, add the VB SCRIPT component. Connect the first string to the x input as the ‘starting condition’. Connect the rules strings to the y input, and right click the y input and choose ‘list access’. We will also need to tell the script component the type of object we are supplying, so choose ‘type hint’ and set it to String. Lastly, connect the slider to the z input.

(MATH/SCRIPT/VBSCRIPT) Rename the inputs. Change the x input to ‘initString’. Change the y input to ‘rules’, and the z input to ‘iterations’. Now we are ready to write the code, so double click the component to open the script editor.

164


Exercise First things first. You are going to write a script that other people are going to want to read, share, extend and credit you for. Make sure they know who you are. Use (‘) apostrophes to comment code in VB. Comments are lines that the computer doesnt read - you do. Be careful with syntax make sure you type each line very carefully and watch out for spelling and grammar errors.

‘--------------------------‘L System string generator ‘elseware ‘gwyllim jahn ‘copyright 2012 ‘---------------------------

The code that executes in the main body of the script is very short. Like the last VB exercise, we create an object to store the output of the script (tree). Then we create an integer variable to keep track of how many iterations to run the script for (Integers [whole numbers] are typically used for counting, Doubles [numbers with decimal points] are used for measuring).

‘--------------------------‘L System string generator ‘elseware ‘gwyllim jahn ‘copyright 2012 ‘---------------------------

Then we tell the main script to run a custom function that we are about to write, called createLSystem. This function will have three parameters: The object that stores all of the previous branches of our lsystem (tree), then current iteration of the system (iter) and the substitution rules (rules).

‘create an output tree and add our first string Dim tree As New list(Of String) tree.add(initialString) Dim iter As Integer = iterations ‘run the recursive function and output the final tree createLSystem(tree, iter, rules) a = tree

Now we set about declaring our function. We do this outside of the main body of the script, in the highlighted section to the right. (it should say ‘custom additional code’ by default). The Script editor is organised in this way to facilitate organisation of code.

165


Exercise Inside of this function area, we begin writing the code that defines the function, in a similar way to how we might define a variable. We use the Function keyword to tell VB we are creating a new function, followed by the name of the function (createLSystem) that will be used to call the function elsewhere in our script. Then we define the variables to be used as parameters for the function, and specify whether they are passed to the function ByVal (objects that are read as values and cannot be modified by the script) or ByRef (objects that are read by reference and can be modified.) Then we add the line End Function to tell the script when our function is over.

Function createLSystem(ByRef t As list(Of String), ByRef iter As Integer, ByVal r As list(Of String))

In these couple of lines, we get the last string produced by the LSystem. We use the count() method of the List class to find out how many items there are currently stored in the list (the same function as the List Length component in grasshopper). Then we use the bracket syntax to get an item out of a list at a specified index.

Function createLSystem(ByRef t As list(Of String), ByRef iter As Integer, ByVal r As list(Of String))

The first time the function runs, this last string will be the initial input to the system (if you followed the tutorial, this will be ‘a’). Next we subtract one from our iterations variable (iter), and we can use this later as a check for our function to tell it when to stop running. Finally, we create a new variable called nextString that will be used to store the next generation of the lsystem.

166

‘recursive function for iterating over ‘the last branch of the lsystem and ‘performing substitutions to create a new ‘branch. End Function

‘recursive function for iterating over ‘the last branch of the lsystem and ‘performing substitutions to create a new ‘branch. ‘get the last branch Dim numB As Integer = t.count() - 1 Dim lastString As String = t(numB) iter -= 1 ‘get ready to make a new branch Dim nextString As String = “” End Function


Exercise Now we create the guts of the function, which is a loop that iterates over all of the characters in the previous generation of the lsystem (lastString.Length - 1), and then finds the appropriate substitution rule. The script does this using another loop, which iterates through all of the possible rules (r.count() - 1). For each rule, it splits the string at the comma (r(j).split(“,”)), which creates two new strings, one for characters to the left of the comma (which will be identifiers for our rule) and one for characters to the right of our string (the substitution characters). We then use a conditional statement to check if the first character of the rule (If(rule(0) = c)) is the same as the character we are currently trying to substitute. If it is, then we set the value of our new substitution string to being equal to the second part of our rule (rule(1)). Once we have found the appropriate substitution, we can add this to our nextString string. (nextString = nextString + substituteString).

Function createLSystem(ByRef t As list(Of String), ByRef iter As Integer, ByVal r As list(Of String)) ‘recursive function for iterating over ‘the last branch of the lsystem and ‘performing substitutions to create a new ‘branch. ‘get the last branch Dim numB As Integer = t.count() - 1 Dim lastString As String = t(numB) iter -= 1 ‘get ready to make a new branch Dim nextString As String = “” ‘loop through last branch and find substitution ‘rules for each character For i As Integer = 0 To lastString.Length - 1 Dim c As String = lastString.chars(i) ‘get sub rules Dim substituteString As String = “” For j As Integer = 0 To r.count() - 1 Dim rule() As String = r(j).split(“,”) If(rule(0) = c) Then substituteString = rule(1) End If Next ‘add the rule nextString = nextString + substituteString Next End Function

167


Exercise Once we have finished the loop through all of the characters in the previous generation, we can add the new string to our lsystem(t. add(nextString)). Up to this point, the script is not recursive, that is, it does not continue to call itself. The next few lines add a conditional statement that check to see if the code needs to continue running (If(iter > 0)). If this condition is met, then the function calls itself again. Because some variables are passed by reference, the function will continue to add to the data in the t list, which we passed to the function using our original tree object. Connect the A output of the script to a panel to see your LSystem.

Function createLSystem(ByRef t As list(Of String), ByRef iter As Integer, ByVal r As list(Of String)) ‘recursive function for iterating over ‘the last branch of the lsystem and ‘performing substitutions to create a new ‘branch. ‘get the last branch Dim numB As Integer = t.count() - 1 Dim lastString As String = t(numB) iter -= 1 ‘get ready to make a new branch Dim nextString As String = “” ‘loop through last branch and find substitution ‘rules for each character For i As Integer = 0 To lastString.Length - 1 Dim c As String = lastString.chars(i) ‘get sub rules Dim substituteString As String = “” For j As Integer = 0 To r.count() - 1 Dim rule() As String = r(j).split(“,”) If(rule(0) = c) Then substituteString = rule(1) End If Next ‘add the rule nextString = nextString + substituteString Next ‘create the next branch t.add(nextString) If(iter > 0) Then createLSystem(t, iter, r) End If End Function

168


Idea

Tutorial 8 - Create a recursive transformation in VB.NET

This exercise presents another recursive function written in VB.NET, this time dealing with geometry, patterns and transforms. It is intended to be used in combination with other grasshopper definitions that could generate the inputs to the script. It will help students to understand some of the processes and concepts that are utilised in the longer LSystem script that is presented during the seminar.

169


Exercise Firstly, we set up the inputs for the script component. Use a panel component to define the pattern for the recursion script. Create a slider to define the number of iterations of the function, and a curve component to reference the list of curves to use in the script. Note - the pattern is used to specify which curve to use. For example, 012 will use curve 0, then curve 1, then curve 2, then repeat. For this reason, the pattern cannot specify a curve index that is greater than the number of curves you have referenced.

Next, setup the VB component. Add an input called crvs, change its input to LIST ACCESS and type hint to CURVE. Add an input called iterations, and connect the slider. Add an input called pattern, and connect the panel.

By now our script should be looking a little familiar, as the main body of the script is similar. We create a New list(Of Curve) object called crvList to store our chain of curves, and we add the first referenced curve to the list to begin with. Then we define our variable to keep track of the number of iterations we have performed, and we split our string into an array (sort of like a list) of individual characters (pattern. ToCharArray()) for ease of use in our recursive function. Finally we make the call to our function, and output the result. Now, lets get on to the function code.

‘--------------------------‘Recursive Chain ‘elseware ‘gwyllim jahn ‘copyright 2012 ‘--------------------------‘create an output tree and add our first string Dim crvList As New list(Of Curve) crvList.add(crvs(0)) Dim currentIter As Integer = iterations Dim chars As Array = pattern.ToCharArray() ‘run the recursive function and output ‘the final tree createChain(crvList, crvs, currentIter, chars, iterations) a = crvList

170


Exercise The function definition should look similar, we are simply passing in all the variables we need and assigning any that we want to modify by reference (ByRef). Next we subtract one from our variable that keeps track of the number of times the function has run, so that we can stop once we hit zero. Then we can proceed to get the last curve in the chain, in order to begin adding to it.

Function createChain(ByRef CHAIN As list(Of Curve), ByVal CRVS As list(Of Curve), ByRef i As Integer, ByVal chars As Array, ByVal iterations As Integer) ‘keep track of this new iteration i -= 1 ‘get the last curve in the chain Dim lastCrv As Curve = CHAIN(CHAIN.count() 1).duplicate() End Function

Now we need to use some maths in order to get the appropriate curve from our repeating pattern. We create a variable called charToUse that will represent the index of the character in our string. We use a Mod function to find the remainder of a division. This way, if we divide the total number of iterations minus the number of iterations remaining (iterations - i - 1) by the total number of characters in the pattern (chars. Length) we will get a number that cycles from 0 to the last character in the pattern, then goes back to 0 again. For instance: Say total iterations is 10, the iterations remaining is 6, and the number of characters in our pattern is 3. iterations=10 i==6 chars.length = 3 (10-6-1) = 3 3 / 3 = 1 with 0 remaining

Function createChain(ByRef CHAIN As list(Of Curve), ByVal CRVS As list(Of Curve), ByRef i As Integer, ByVal chars As Array, ByVal iterations As Integer) i -= 1 ‘get the last curve in the chain Dim lastCrv As Curve = CHAIN(CHAIN.count() 1).duplicate() ‘get the next curve, alternate between all the inputted curves Dim charToUse As Integer charToUse = ((iterations - i - 1) Mod (chars.Length)) Dim nextIndexToUse As Integer = val(chars(charToUse)) Dim nextCrv As curve = CRVS(nextIndexToUse). duplicate() print(charToUse) End Function

so we would be using the first character in our pattern

171


Exercise Next we get on to the transforms. We create a Plane object for both our last curve and the next curve we are adding. The plane objects are created using the FrameAt method of the Curve class. This method creates a plane at the specified parameter of a curve. For our last curve, we use the end of curve (lastCrv.Domain.Max), whilst for our next curve, we use the start (0). Then we create a Transform object with which to store our transform information. We use the PlaneToPlane method of the transform class to orient an object from one plane to another. We can then use the Transform method of our next curve to pefform the reorientation.(nextCrv. Transform(reorient)). Finally, we add our new curve to the list of curves in the chain, and perform the recursive check to see if we need to call out function again. You’re done!

Function createChain(ByRef CHAIN As list(Of Curve), ByVal CRVS As list(Of Curve), ByRef i As Integer, ByVal chars As Array, ByVal iterations As Integer) i -= 1 ‘get the last curve in the chain Dim lastCrv As Curve = CHAIN(CHAIN.count() 1).duplicate() ‘get the next curve, alternate between all the inputted curves Dim charToUse As Integer = ((iterations - i 1) Mod (chars.Length)) Dim nextIndexToUse As Integer = val(chars(charToUse)) Dim nextCrv As curve = CRVS(nextIndexToUse). duplicate() print(charToUse) ‘get a perp frame on the end of the two curves Dim lastFrame As Plane lastCrv.FrameAt(lastCrv.Domain.Max, lastFrame) Dim nextFrame As Plane nextCrv.FrameAt(0, nextFrame) ‘perform transformation Dim reorient As Transform reorient = Transform.PlaneToPlane(nextFrame, lastFrame) nextCrv.Transform(reorient) ‘add curve to the chain CHAIN.add(nextCrv) ‘perform recursive check If(i >= 0) Then createChain(CHAIN, CRVS, i, chars, iterations) End If End Function

172


Idea

Tutorial 9 - Convert curves to spring objects REQUIRES KANGAROO PLUGIN

This exercise will demonstrate how to extend grasshoppers â&#x20AC;&#x2DC;iterativeâ&#x20AC;&#x2122; capacity using the Kangaroo Physics plugin. We will learn how to convert nurbs geometry to Kangaroo Force objects for input into the physics engine, and how to run, pause and reset the simulation. The ability to convert curves to springs will form the basis for all other work in this tutorial. Later we will create more complex force objects in order to simulate more complex dynamic behaviour, such as static forces between fibres.

173


Exercise We begin by referencing some curves drawn in rhino (or created in some other way using grasshopper) into a curve component.

Kangaroo springs are defined by two particles whose attraction to one another is a product of the distance between them (REFER TO THE KANGAROO MANUAL). What we want to do is convert our nurbs curve to a series of straight segments of equal length. To do this we use the DIVIDE LENGTH component, and use a number slider to parametrically set this even length. Next we connect the resulting list of points to a polyline component to create the faceted curve.

(CURVE/DIVISION/DIVIDELENGTH) Next we EXPLODE the polyline to get the individual line segments. We could just as easily create these segments using a combination of shift list and line components - it is up to you. Next we make sure that we have not accidentally produced any duplicate lines (this will break kangaroo) using kangaroos REMOVE DUPLICATE LINES component, and connect the output to a line component for ease of use later.

(CURVE/UTILITIES/EXPLODE) (KANGAROO/UTILITIES/REMOVEDUPLICATELINES) Now lets add the KANGAROO PHYSICS component and take a look at its inputs. Flatten the FORCE OBJECTS input, as kangaroo only accepts single lists of force objects - these we will create in a minute. The component also has inputs for anchor points - points that remain fixed, specific settings, geometry, and a reset toggle. Connect our line component to the geometry input, and create a new BOOLEAN TOGGLE to turn the simulation on and off.

(PARAMS/SPECIAL/BOOLEANTOGGLE) (KANGAROO/KANGAROO/KANGAROOPHYSICS)

174


Exercise Add a SPRINGS FROM LINE component to the canvas. Connect our lines to the Connection input - this will tell kangaroo how construct the springs. If we also connect the lines to the Rest Length input of the springs component, kangaroo will use the Length of the line as the rest length. This simulates rigid behaviour as the two ends of the spring will attempt to maintain the same distance apart throughout the simulation.

If we connect a number to the rest length input that is LESS than the original length of the spring, we will be simulating tensile behaviour (elastic bands, stockings, membranes etc). Lengths over the original length cause networks to explode and reorganise. For now, we are not interested in the remaining inputs, so connect the output from the spring object to the force objects input of the kangaroo component.

(KANGAROO/FORCES/SPRINGSFROMLINE)

Lastly we are going to anchor the end points of our original curves to prevent the springs flying all over the place. To do this we use an END POINTS component, with a REMOVE DUPLICATE POINTS component to avoid overlapping points that would otherwise break the simulation. We can connect the points to the ANCHOR POINTS input of the physics engine.

Now we are ready to run the simulation. We want to see Kangaroo continuously update, so to do this create a TIMER component, right click it and set its interval to 20ms, then drag and drop from its on/ off indicator on the right of the component onto the Kangaroo Physics component. This makes sure that the timer only updates the physics engine, not everything else in our definition.

(KANGAROO/UTILITIES/REMOVEDUPLICATEPTS) (CURVE/ANALYSIS/ENDPOINTS)

The timer can make everything run VERY slowly, so you can turn it on and off in the windows task bar if something goes awry. You can double click your toggle to set it to False in order to start running the simulation. Setting it to True will reset. Our original curves are now springs - try moving a control point in rhino and see what happens while the simulation is running.

(PARAMS/SPECIAL/TIMER)

175


Idea

Tutorial 9 - Create Power Law forces using VB.NET REQUIRES KANGAROO PLUGIN

This exercise will demonstrate how to use VB.NET to create a specific force network between multiple curves in anticipation of the simulation of fibrous behaviour. Students should be familiar with the principles of Objects, Loops and Conditional statements in VB.NET before attempting the tutorial.

176


Exercise We are going to extend the definition from the previous exercise (Grouped as grey in the image below) , so open it up and create a VB SCRIPT component near the divide length components. We will use the points from this component for our script, so connect them to the X input, and rename the input pts. Then right click the input, choose TREE ACCESS, and specify the type hint as POINT. You can rename the VB component to something else as well if you like, I have called mine ‘ VB Attract Fibres’.

Double click the VB component to open the script editor. If you have completed the previous exercises, this should once again look familiar. Leave comments at the top of the code to let others know who you are, and then Dim a New list(Of Line) object called outLines to store and output the results of our script. Then we define a loop that will iterate over every branch in our tree of points (pts.Paths).

‘--------------------------‘Attract Fibres ‘elseware ‘gwyllim jahn ‘copyright 2012 ‘--------------------------Dim outLines As New list(Of Line) For i As Integer = 0 To pts.Paths.Count() - 1 ‘loop code here Next a = outLines

177


Exercise Next we create another loop that will iterate over all the points on the current branch (pts. Branch). We will create lines from each of these points to every other point on every other line - but NOT to points on the current line. This functionality could be achieved with normal grasshopper components, but it is simpler with script. We create another two loops to iterate over all other branches (curves in our network), and all the points on each branch. Then we extract the appropriate curves for each line, using list notation. pts.Branch(pts.Paths(i)). item(j) Uses the branch method to extract a particular branch from a tree based on where we are at in our loop. Then the item method extracts an item from the current branch. Finally, we can create our line object, and add it to our output list. ‘--------------------------‘Attract Fibres ‘elseware ‘gwyllim jahn ‘copyright 2012 ‘--------------------------Dim outLines As New list(Of Line) For i As Integer = 0 To pts.Paths.Count() - 1 For j As Integer = 0 To pts.Branch(pts.Paths(i)).Count() - 1 ‘loop through all the branches again, ‘dont use previously used branches, or this branch For k As Integer = (i + 1) To pts.paths.count() - 2 ‘loop through all the pts on the branch For l As Integer= 0 To pts.Branch(pts.Paths(k)).Count() - 1 ‘make the line and add it to the list Dim sPt As Point3d = pts.Branch(pts.Paths(i)).item(j) Dim ePt As Point3d = pts.Branch(pts.Paths(k)).item(l) Dim tLine As New Line(sPt, ePt) outLines.add(tLine) Next Next Next

Next

a = outLines

178


Exercise Once we have finished creating the lines with our script component, we can use these lines to define the connections for our POWER LAW component. This component works in a similar fashion to a spring component, except that forces are always positive (attraction) or negative (repulsion). Connect the line output to the Connection input of the power law component, set the EXPONENTS input to -1, and connect sliders to STRENGTH and CUTOFF. These inputs will be dependant on the size of your model.

(KANGAROO/FORCES/POWERLAW)

If you connect the P output of the Power Law component to the forces input of the Kangaroo Physics component, you should see your curves begin to attract to one another once the simulation is running. You will need to play with the parameters of each of the Force objects in order to get the simulation to produce aesthetic results and prevent the system from â&#x20AC;&#x2DC;explodingâ&#x20AC;&#x2122; due to forces being out of balance. This will be the objective of the next exercise.

179

Bend by The Experimental Design Lab | ex-lab 2012  

"The workshop manual is available to read online and download below. It contains all seminar descriptions and daily exercises together with...

Read more
Read more
Similar to
Popular now
Just for you