This shows you the differences between two versions of the page.
labs:grasshopperworkshop [2015/11/12] |
labs:grasshopperworkshop [2020/08/14] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Grasshopper Workshop Agenda and Exercises ====== | ||
+ | |||
+ | | {{: | ||
+ | | // | ||
+ | |||
+ | ---- | ||
+ | |||
+ | > **Summary: | ||
+ | |||
+ | {{: | ||
+ | |||
+ | \\ | ||
+ | |||
+ | The most up-to-date information is on the [[http:// | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | =====Instructional goal or outcome===== | ||
+ | This workshop will give students a functional understanding of Grasshopper, | ||
+ | |||
+ | * A basic understanding of the Grasshopper interface | ||
+ | * Troubleshoot definition problems and solutions | ||
+ | * Know the main component types | ||
+ | * Be able to join, and manage connections | ||
+ | * Use Expressions for both calculation and boolean creation | ||
+ | * Understand Data Matching | ||
+ | * Understand list management within Grasshopper | ||
+ | * Have a basic understanding of Grasshopper components | ||
+ | * Experience creating a few of their own definitions | ||
+ | \\ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | ======General interface tricks====== | ||
+ | [[http:// | ||
+ | |||
+ | > **Definitions: | ||
+ | > **Document: | ||
+ | =====Interface overview===== | ||
+ | * The screen | ||
+ | * Navigation around a definition | ||
+ | * Panning | ||
+ | * Zooming | ||
+ | * Resetting the view | ||
+ | * Searching for a component - Double-click on screen | ||
+ | * Saving definitions | ||
+ | * The GHX file | ||
+ | * The Rhino file | ||
+ | * Other files | ||
+ | * GH file | ||
+ | * WRM files | ||
+ | * Opening and editing your first definition | ||
+ | * Looking at the flow from left to right | ||
+ | * Understanding how to hover over inputs and outputs to see how components are working | ||
+ | |||
+ | ====Connecting components==== | ||
+ | * Creating connections | ||
+ | * Deleting connections | ||
+ | * Multiple connections | ||
+ | * Component search - Double-click on background | ||
+ | ====Debugging information==== | ||
+ | * Component colors | ||
+ | * Debugging Window | ||
+ | * Input and output mouse hover | ||
+ | ====Commenting definitions==== | ||
+ | > **Definitions: | ||
+ | |||
+ | * Post-its | ||
+ | * Using Post-it to note definitions | ||
+ | * Using post-it to document input or output | ||
+ | * Drawing Curves | ||
+ | * Free-form | ||
+ | * Rectangles | ||
+ | |||
+ | =====Components===== | ||
+ | The core of Grasshopper is the component. [[http:// | ||
+ | |||
+ | > **Document: | ||
+ | > **Definition: | ||
+ | |||
+ | ====Parameter component type==== | ||
+ | Parameters are a special type of component. | ||
+ | |||
+ | \\ | ||
+ | * **Primitive component** | ||
+ | * Holding a value | ||
+ | * As a translator | ||
+ | {{: | ||
+ | |||
+ | > **Definition: | ||
+ | \\ | ||
+ | * **U\I components** | ||
+ | * The slider | ||
+ | {{: | ||
+ | |||
+ | > **Definition: | ||
+ | \\ | ||
+ | * **Geometry parameter components** | ||
+ | * Picking from a Rhino object | ||
+ | * Implicit components | ||
+ | {{: | ||
+ | |||
+ | > **Definition: | ||
+ | \\ | ||
+ | * **Parameter component colors** | ||
+ | * Orange - empty | ||
+ | * Grey - with data | ||
+ | * Hatched - not previewing | ||
+ | |||
+ | > **Definition: | ||
+ | \\ | ||
+ | |||
+ | ====Component==== | ||
+ | * Compared to a primitive, component is more involved since it contains input and output parameters, expressions, | ||
+ | * A standard component takes information from its left and processes the data out to the right. | ||
+ | * Component color\status. | ||
+ | * Orange - not enough inputs. | ||
+ | * Grey - functioning fine with data | ||
+ | * Red - a component which contains at least one error. The error can come either from the component itself or from one of its input/ | ||
+ | * Hatched - not previewing | ||
+ | |||
+ | * Volatile vs Persistant Data Management in components | ||
+ | * [[http:// | ||
+ | * [[http:// | ||
+ | * Data handling - understanding how to manipulate lists and data is critical to understanding Grasshopper | ||
+ | * Handling a list of inputs | ||
+ | * Matching a list of data | ||
+ | * Built-in data matching | ||
+ | * Short list | ||
+ | * Long list | ||
+ | * Cross reference | ||
+ | * Connecting | ||
+ | * One or multiple connectors to inputs or outputs. | ||
+ | * Disconnecting with a right-click | ||
+ | * Visible component preview | ||
+ | * Preview Off-On | ||
+ | * Rendering of a component that is not previewing (Hatch) | ||
+ | * Rhino Preview Object Colors | ||
+ | * Blue feedback geometry means you are currently picking it with the mouse. | ||
+ | * Green geometry in the viewport belongs to a component which is currently selected. | ||
+ | * Red geometry in the viewport belongs to a component which is currently unselected. | ||
+ | * Point geometry is drawn as a cross rather than a rectangle to distinguish it from Rhino point objects. | ||
+ | |||
+ | ====Scalar component types==== | ||
+ | These are for primary mathematical functions. | ||
+ | |||
+ | * Expressions | ||
+ | * Operators | ||
+ | * Polynomials | ||
+ | * Trigonometry | ||
+ | * Custom Math Functions | ||
+ | |||
+ | > **Definition: | ||
+ | |||
+ | \\ | ||
+ | |||
+ | ====Interval vs Series vs Range==== | ||
+ | * Intervals - A range of all numbers between a low and high number. | ||
+ | * Range - A list of evenly spaced numbers between a low and a high value | ||
+ | * Series - A list of discrete numbers | ||
+ | |||
+ | > **Definitions: | ||
+ | \\ | ||
+ | |||
+ | ====Expressions==== | ||
+ | * Formula component | ||
+ | * Expressions within components | ||
+ | * Expression editor | ||
+ | |||
+ | > **Definitions: | ||
+ | \\ | ||
+ | * Uses of expressions | ||
+ | * Unit Conversion - at the end of a slider | ||
+ | * 0 indexing of a list | ||
+ | |||
+ | ====Vectors and planes==== | ||
+ | * Vector as a direction | ||
+ | * Plane/Frame as a construction plane | ||
+ | |||
+ | ====Make a building==== | ||
+ | ===Create shell=== | ||
+ | * Create a base point | ||
+ | * Create and elipse component with sliders for width and height | ||
+ | ===Thicken floors=== | ||
+ | ===Elevator shaft=== | ||
+ | |||
+ | ====Booleans and expressions==== | ||
+ | * True\False Booleans | ||
+ | * Creating Booleans | ||
+ | * Component | ||
+ | * Expression | ||
+ | * Booleans in list culling | ||
+ | * Booleans and logic gates | ||
+ | |||
+ | > **Definition: | ||
+ | |||
+ | > **Definition: | ||
+ | |||
+ | ====Sorting==== | ||
+ | * Sorting on list with another | ||
+ | * Numbering the order with 3D text | ||
+ | |||
+ | > **Definition: | ||
+ | |||
+ | =====Advanced topics===== | ||
+ | ====Clusters==== | ||
+ | * Using Clusters | ||
+ | * Cluster tips and tricks | ||
+ | |||
+ | ====Script component==== | ||
+ | Inside a Grasshopper workshop only the most basic of scripting concepts can be presented. A script component can be used to manupulate data in a way that existing components cannot. You can also create geometry with script components. | ||
+ | |||
+ | Definition: http:// | ||
+ | ===General setup=== | ||
+ | When you drag and drop a VB.NET component you get a base VB.NET code component. | ||
+ | |||
+ | To edit the component, just double-click on the component. You will get a basic code editor. | ||
+ | |||
+ | {{: | ||
+ | You cannot edit the gray areas. | ||
+ | |||
+ | ===Simple scripting flow: Seeing a script as a loop=== | ||
+ | Each time a piece of data flows into an input, the script you type runs. In the most simple case a script can be used as a math function. This could also be done with a math function component, but it is used here as a simple example of scripting. | ||
+ | |||
+ | {{: | ||
+ | Sub RhinoScript(ByVal angle As Object) | ||
+ | |||
+ | ' | ||
+ | A = Cos(angle) | ||
+ | |||
+ | End Sub | ||
+ | Here you can see that every time the slider is changed, the code runs in the VB.NET component. | ||
+ | |||
+ | Also, there is a line the starts with a **' | ||
+ | |||
+ | ===Variables=== | ||
+ | Perhaps the most important part of VB.NET programming is understanding variables and datatypes. | ||
+ | |||
+ | Variables are containers of information. And, like any real container, depending on what you intend to store in the container you may select from different containers sizes and styles. It is important to know the type of data you intend to contain in the variable. | ||
+ | |||
+ | When you create a new Variable in VB.NET you must declare what type (size) the container needs to be in order to hold the information you have. | ||
+ | |||
+ | * Input Data | ||
+ | * Basic Input | ||
+ | * Location of input variables - At the top of the code | ||
+ | * Type - Object unless using the Type Hint on the input itself | ||
+ | * Adding - Adding more inputs | ||
+ | * Subtracting - Subtracting inputs | ||
+ | * Renaming - Right-click to rename input names | ||
+ | * Declaring variables | ||
+ | * Basic variable types - Value types: Boolean, Char, Integer, Long, ULong, Double, etc. | ||
+ | This line declares a simple Integer container with the name is i. | ||
+ | Dim i As Int32 | ||
+ | * Reference Variable types String, Object. | ||
+ | Dim name As String = " | ||
+ | \\ | ||
+ | Dim name As Object = " | ||
+ | |||
+ | * Object Variable Types - [[developer: | ||
+ | Dim pt As New On3dPoint ' | ||
+ | Dim pt As New On3dPoint(1.0, | ||
+ | pt.x = 10 ' | ||
+ | |||
+ | * Outputting data | ||
+ | * Method - Use "A =" | ||
+ | |||
+ | Sub RhinoScript(ByVal point As ON3dPoint, ByVal dis As Object) | ||
+ | |||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | A = point | ||
+ | |||
+ | End Sub | ||
+ | * Types | ||
+ | * Multiple Outputs - Sometimes you want to output more than one variable each time the loop goes through. | ||
+ | Dim points As New List(Of On3dPoint) | ||
+ | |||
+ | To add a new member of a list use the .add method | ||
+ | |||
+ | points.Add(new_pt) | ||
+ | |||
+ | Here is a full sample: | ||
+ | |||
+ | Sub RunScript(ByVal x As Object, ByVal y As Object) | ||
+ | Dim Sorted As New List(Of Object) | ||
+ | | ||
+ | | ||
+ | A = Sorted | ||
+ | End Sub | ||
+ | |||
+ | * Looping - Standard VB.NET looping and flow control can be used. | ||
+ | * If..Then | ||
+ | * For...Next | ||
+ | |||
+ | **Definition** - [[developer: | ||
+ | |||
+ | * Using [[developer: | ||
+ | * If you find that you have students that are familiar with RhinoScript, | ||
+ | |||
+ | |||
+ | ====Specialty components==== | ||
+ | * Graph component | ||
+ | * Curve distribution component | ||
+ | * Fibonacci sequence component | ||
+ | * Jitter component | ||
+ | * The Post-its as component | ||
+ | * Post-It notes can write their contents to text files | ||
+ | |||
+ | ===Developer tools=== | ||
+ | |||
+ | * [[labs: | ||
+ | |||
+ | ====Extras==== | ||
+ | |||
+ | |||