Grasshopper: Visual Scripting for Rhinoceros 3D. David Bachman

Чтение книги онлайн.

Читать онлайн книгу Grasshopper: Visual Scripting for Rhinoceros 3D - David Bachman страница 4

Автор:
Жанр:
Серия:
Издательство:
Grasshopper: Visual Scripting for Rhinoceros 3D - David Bachman

Скачать книгу

img

      At this point the Extrude component should be orange, indicating that it needs more information in order to function. A small bubble appears in its top-right corner, and hovering over it reveals the message “Input parameter D failed to collect data.” The “D” input is waiting for a vector to tell the Extrude component which direction to do the extrusion, and how far. Drop a Unit Z component (Vector tab, Vector panel), representing a unit vector in the Z-direction, on the canvas and connect it to the “D” input of the Extrude component. All components should now be their usual gray, representing the fact that they are functioning properly, and a cylinder should appear in the Rhino viewport.

      Hovering over the output of each component reveals a description of what that component is generating. For example, hovering over the output of the Unit Z component displays “{0.0,0.0,1,0},” which is a vertical vector of length one. As with the previous method, to change the radius of the cylinder, just attach a number slider to the “R” input of the Circle component. To change the height, attach a number slider to the “F” input of the Unit Z component. This has the effect of rescaling the vector coming out of that component, which in turn tells the Extrude component to create a surface of a different height.

      At this point there are two components outputting geometry to the Rhino viewport: the Circle component and the Extrude component. When we build more complicated objects, you will want to display only the object generated by one particular component. To do this, click on the small icon in the top-right corner of the Grasshopper window that looks like a half-green, half-gray surface, as shown in Figure 1.5. Now you’ll only see objects in the Rhino viewport when you select them on the canvas, and they will appear there green.

img img

      Following the previous method, select the Extrude component and delete it. In its place, drop a Move component (Transform tab, Euclidean panel). Connect the output of the Circle component to the “G” input, and the output of the Unit Z component to the “T” input. As you would likely guess, the Move component will now move the circle up in the Z-direction.

      Now place a Loft component (Surface tab, Freeform panel) on the canvas, above and to the right of the Move component. Connect the output of the Move component to the “C” input of the Loft component. Then, holding down the shift key, also connect the output of the Circle component to the “C” input of the Loft component, as in Figure 1.6. The Loft component is now being given two circles, and will create a surface between them.

      Our fourth method is depicted in Figure 1.7. Begin with a Line component (Curve tab, Primitive panel). Right-click on the “A” input, and choose “Set one Point.” The Grasshopper window will temporarily disappear, leaving you looking at the Rhino viewport. Select the origin. Do the same thing for the “B” input, but this time select the point (0, 0,1). (You’ll have to do this in Rhino’s Front or Right viewport. If you want to select these points exactly, it is helpful to have Grid Snaps on in Rhino.) The Line component should now make a line connecting these two points.

img

      Now drop a Pipe component (Surface tab, Freeform panel) onto the canvas. Connect the output of the Line component to the “C” input of the pipe. Just as in the Rhino “Pipe” command, the Pipe component puts a tube around the curve that is fed into it. A tube around the line segment constructed above is again a cylinder. The radius of the resulting cylinder can be adjusted at the “R” input of the Pipe component.

      Begin with the line segment from the previous method. As in the third method demonstrated previously, move this line segment one unit in the X-direction by feeding it to the “G” input of a Move component, with a Unit X component connected to the “T” input. Place a Revolution component (Surface tab, Freeform panel) on the right side of the canvas. Connect the output of the Line component to the “A” input (thus defining the axis of revolution), and the output of the Move component to the “P” input (defining the curve to be revolved). See Figure 1.8. By default, the input curve is revolved a full 2π radians (360 degrees) around the axis line, in this case creating a full cylinder.

img

       Lists

      As we saw in the previous chapter, wires in a Grasshopper script represent the flow of information between components. In each of the scripts of the previous section, there was a single piece of information passing through each wire. However, one of the things that makes Grasshopper powerful is that wires can simultaneously contain multiple pieces of information in a list. We illustrate this in our next example.

      One of the primitive surfaces in Rhino is a torus, or donut shape, as in Figure 2.1. Unfortunately, at the time of this writing this has not been incorporated as a Grasshopper primitive surface. Perhaps the easiest way to make such a surface is to create a pipe around a circle, just as when we made a cylinder by piping a line segment in the previous chapter. Here we will use a different method as an illustration of a basic use of lists.

      The torus in Figure 2.1 was made with the script of Figure 2.2. To create this script, start by dropping a Circle component (Curve tab, Primitive panel) on the canvas. Connect the “P” input to the output of an XZ Plane component (Vector tab, Plane panel). Then right-click on the “O” input of the XZ Plane

Скачать книгу