Grasshopper 3D Grid from Surface

From TOI-Pedia

Introduction

LEVEL: BEGINNER

This is a continuation of Grasshopper 2D Grid. This method is based on subdivison (defining U and V values) of a surface which is lofted between two curves. We can change the control points along the curve and manipulate the input surface this way.

3D Grid from Surface

Example of an extrude based on a curve in Rhino

First you set two curves drawn in Rhino and create a loft between them using the Surface » Freeform » Loft component. Then we repeat the same steps as we did in the UV Surface Divide example from Grasshopper 2D Grid. You subdivide the surface with the Surface » Util » Istotrim command. The Isotrim (SubSurface) requires you to divide a UV Domain Maths » Domain » Divide Domain based on the input Surface. Connect the divided domain and the input surface to the Isotrim (SubSurface) component. The result is a series of smaller surfaces, you've pannelized the surface. These are the cells of your grid.

BoxMorph

Example of an extrude based on a curve in Rhino
Example of an extrude based on a curve in Rhino

Once the surface is pannellized into a uv-grid, you can use it for many different transformations. One of the transformations we will demonstrate here are the Surface Box and the BoxMorph tool. A SurfaceBox creates 3D cells (with a specified height) from the 2D cells of the divided Surface. The Boxmorph places an object within those 3D cells, automatically adjusting the dimensions of your geometry. It adjusts the BoundingBox of the geometry to match the 3d boxes on the surface, and scales the geometry accordingly.


First, you need to convert the 2D cells to 3D by using the Transform » Morph » SurfaceBox command. Connect the original surface and use the Domain from the Divide Domain component. Specificy the Height by using a Number Slider. Now you have generated the Target boxes for the geometry.


Then you can load the geometry you would like to morph over your surface. Params » Geometry » Geometry Use set one geometry and make a BoundingBox per object with the Surface » Primitive » BoundingBox tool. Then load your Geometry into the Transform » Morph » BoxMorph and plug the BoundingBox into the Reference Box input on the Boxmorph tool. Finally add the Target boxes from the SurfaceBox command.


You can use also set multiple geometries, but then you have to set the BoundingBox to union box by right clicking on the component and checking union box. You also have to ensure that the geometry is grouped before you enter it into the Geometry input. To group geometries, use Transform » Util » Group

Surface Analysis

Example of an extrude based on a curve in Rhino
Example of an extrude based on a curve in Rhino
Example of an extrude based on a curve in Rhino
Example of an extrude based on a curve in Rhino

The surface subdivision can also be useful in analyzing the surface. For example, by using Surface » Analysis » Evaluate Surface we can evaluate the surface based on a uv coordinate.


UV coordinates refer to the domain of the surface. For our purposes we will reparametrize the surface, meaning we redistribute the uv domain from 0-1. Right-click on the Surface input of the Evaluate Surface component. Select Reparametrize. Now we generate the uv input. This can be done in several ways.


Using the Params » Input » MD Slider is visually easy to understand as the square lay-out of the slider mimics the uv-point in relation to the surface. The output of the slider is a x,y,z coordinate where the z is always 0.


Another method is creating an x,y,z-point by using Vector » Point » Construct Point and Number Sliders (0-1) for the x and y input. Do not define the z coordinate, as it is not necessary.


The last alternative is to write your coordinates in a panel. Params » Input » Panel Write {0.5,0.5,0.0} to retrieve the centerpoint, for example.


To keep your definition compact you can decide to internalize the uv-coordinate. This means that the data is stored inside the component and is permanent until substituted with another input. Right-click the uv-input and select internalize data

Color by Slope

LEVEL: INTERMEDIATE
Example of an extrude based on a curve in Rhino
Example of an extrude based on a curve in Rhino

The Evaluate Surface component returns a Point, a Normal and a Frame (plane derived from geometry). We can use this data to analyze the curvature of the surface. In order to visualize this data, we will color the subdivisions according to their slope. This could be useful when you are generating a walkable surface and the slope cannot by higher than 10% (wheelchair accessibility, for example. This can be done in many ways, but to understand the process exactly we calculate the vector of the normal compared to a vertical vector. If we multiply this by 100, we obtain the slope percentage.


To visualize the process we will first draw two SDL-lines Curve » Primitive » Line SDL. One SDL-line will Start from the evaluated surface Point following the Direction of the Normal. The L doesn't matter, a Number Slider can be used in this case. The other SDL-line follows the z-Direction, Starting from the same Point, using the same Number Slider for the Length. Make sure the have the same orientation, if not (like in the example here) one of them needs to be inverted by using the Math » Operators » Negative.


Now we extract the Endpoints Curve » Analysis » End Points to easily generate a 2-Point VectorVector » Vector » Vector 2Pt, ensuring the correct direction of both vectors instantly. Compute the angle between the two vectors. This equals the slope since calculating the difference between the horizontal vector and the tangent vector on the surface (90 degrees rotated normal) returns the same number. Use Vector » Vector » Angle and multiply Math » Operators » Multiplication this by a 100. You can either use a panel to specify the number, or you can set a number.


For a colored representation of the different slopes we can use a color gradient option.Params » Input » Gradient. There are different pre-sets if you right-click on the colored component. Moving the small dots adjusts the corresponding colors and percentages. Connect the slope percentages from the Multiplication component into the Parameter t of the Color Gradient. Plug the Divided Surface geometry into a Display » Preview » Custom Preview component. Then enter the output of the Color Gradient into the Color input of the Custom Preview.

Personal tools
Actions
Navigation
Tools