Grasshopper: Visual Scripting for Rhinoceros 3D. David Bachman

Grasshopper: Visual Scripting for Rhinoceros 3D - David Bachman


Скачать книгу
final step is to use the Map to Surface component (Transform tab, Morph panel). This component requires three inputs: (C) The curves in the domain space to map to a target surface, (T) the target surface that the final curves end up on, and (S) a “source surface” representing the domain space. To create the source surface we feed the rectangle curve defined earlier to a Boundary Surfaces component (Surface tab, Freeform panel). This component creates a planar surface that is bounded by any closed planar curve, similar to Rhino’s built-in Planar Surface command. The final result is depicted in Figure 5.3.

img

      In the previous section we used the Map to Surface component to put a curve on a surface. Here we show how to make other geometry conform to a surface. One common application is to emboss a logo on an object. Consider the logo created in Rhino, depicted in Figure 5.4.

      The script depicted in Figure 5.5 will emboss this logo on a cylinder with the Surface Morph component (Transform tab, Morph panel). This useful component will take any user-defined geometry and deform it to follow a surface, similar to Rhino’s built-in Flow along Surface command.

img

      The Surface Morph component takes four essential pieces of data: (G) the geometry to transform, (R) a box containing that geometry, (S) the surface to transform the input geometry onto, and (U), (V), and (W), a box built by subsets of the surface’s u, v and w parameter space. (The w parameter represents a direction perpendicular to the surface.)

      As in the example of the previous section, we will use a cylinder as the surface to transform the input geometry to. For the input geometry we use the logo depicted in Figure 5.4 by setting it to be referenced by the Brep component (Params tab, Geometry panel) in the script. We get a box containing the input geometry by feeding it to a Bounding Box component (Surface tab, Primitive panel).

img img

      The U, V, and W inputs are created with Construct Domain components (Math tab, Domain panel), and each of those is determined by two number sliders. The values of the sliders that you see in the script were set to produce the result depicted in Figure 5.6

img

      A common modeling problem is to panel a surface with one or more sets of geometric components. While there are some very powerful plugins for paneling (e.g., Rajaa Issa’s Paneling Tools) with Grasshopper and Rhino, it is possible to use Grasshopper’s Surface Morph component to do basic paneling.

      The script depicted in Figure 5.7 is a modification of that in Figure 5.5. For this example we will use the “panel” depicted in Figure 5.8. As before, this is referenced by the Brep component in the script.

img

      To get a paneling effect, we break up the domain of the surface into smaller regions with the Divide Domain2 component (Math tab, Domain panel). At the U and V inputs to this component we set numbers to tell it how many times to break up the domain in each direction. For the script depicted here, we have set the U input to the value 10, and the V input to the value 5. Thus, at the S output we get a list of 50 smaller rectangular domains. Each of these is then fed to a Deconstruct Domain2 component (Math tab, Domain panel) to find sets of U and V parameters. Finally, at the W input of the Surface Morph component we use a “0.0 to 1.0” Domain, output by default from a Construct Domain component (Math tab, Domain panel). After playing with the values set at the radius (R) and length (L) inputs of the Cylinder component, the result is the paneling of a cylinder depicted in Figure 5.9.

img img

       More List Manipulations

      As we have already seen, most Grasshopper scripts contain components that act on every element in a list. However, it is often the case that you will want different things to happen to different elements of a list. To accomplish this, Grasshopper contains many special components to separate lists and put them back together. Two of the most common are the Weave and Dispatch components (both in Set tab, List panel). We illustrate the use of both of these components with the script of Figure 6.1, which is a further modification of the paneling script from the last chapter.

      The Brep component shown here is set to reference the panel depicted in Figure 6.2. The U and V inputs to the Divide Domain2


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