Grasshopper Extrude-Loft-Contour-Project

From TOI-Pedia

Introduction

From Nurbs to Surface to Polysurface (Brep or Solid)


Extrude

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

The example use the Params » Geometry » Curve component to use an existing curve in Rhino.


The Surface » Freeform » Extrude component is used to make a straight extrusion. Other extrusion options are also available. The direction and distance are controlled by a single vector. The example uses a Vector » Vector » Vector XYZ component to create a vector, which is fed into a Vector » Vector » Amplitude component that sets the length (magnitude) of the vector. This is fed into the Direction Vector input of the Extrude component.


You might also want to set the extrusion direction by specifying an angle (relative to some vector). You could use one of the Vector » Vector » Unit X/Y/Z components to create a fixed vector that you rotate (Vector » Vector » Rotate) around an axis by a set amount of radians or degrees.


Loft

example of moveing existing curves before lofting them

When you have existing curves that you use to make a loft, you may want to change the position of these curves. You can do this using the Transform » Euclidian » Move or Transform » Euclidian » Rotate components. The move component uses vectors to specify the direction and distance.


The first curve is moved in the Z-direction by using a Vector » Vector » Unit Z component. The length of this Unit factor is changed by using the Factor input with a Number Slider.

The second curve is moved by rotating a Z-vector around the Y-axis using the Vector » Vector » Rotate component. To specify an angle in degrees, right-click the Angle input and enable 'Degrees', which converts the input from degrees to radians, which are used internally in the component by default.


Note that the Surface » Freeform » Loft component only has one input, Curves, for curves that should be lofted. A loft always uses at least two curves, so in this example we need to link both outputs from the Move components to this input, by holding Shift for every additional connection.


Combining multiple inputs may be tricky in more complicated definitions. The Tree structure of the connections determines which curves will be lofted together. Refer to Data Trees in Grasshopper Components for more information on Data Trees.

Contour

Example of Contouring a Surface from 2 lofted Curves, in several directions

Contours can be derived from any surface using the Intersect » Mathematical » Contour component. The component requires a Surface input and (at least) the Distance between contours, to be controlled by a Number Slider. By default the direction is set to a Z-direction (0.0,0.0,1.0). You can change this by inserting a X or Y-direction using one of the Vector » Vector » Unit X/Y/Z components.


If you change the input curves, it automatically updates the surface and the location of the contours. By moving the Number Slider you can make changes in the distance between contours. You could for example set this to the minimum or maximum step-height (150mm-180mm) of a stair to generate a walkable surface.

Project

Example of Projecting Horizontal Contours on a Surface retrieved from Bounding Box

3D Curves can be projected onto a plane, projected onto a plane along a vector or projected onto a brep. Depending on what you will do after the projection you select which command is most useful. The Transform » Affine » Project command and Transform » Affine » Project Along command both project a Geometry onto a plane. The input can either be Curves, Surfaces or Breps. By default the plane is the horizontal origin (X,Y) plane. You could use one of the Vector » Plane » Unit XY-Plane/XZ-Plane/YZ-Plane components to define a plane.


To project along a vector you could insert a vector-direction. By default this is set to a negative Z direction. Again, you can insert a Vector » Vector » Unit X/Y/Z for a positive direction, or convert these to a negative direction using the Math » Operators » Negative command.


To project onto a brep, using the Curve » Util » Project command, you can only insert Curves, no other geometry. Similar to the other Project commands, you can insert also insert a vector direction. Make sure that your the projection is actually hitting the targetted brep, otherwise it will not work.

Stepped Topography

LEVEL: INTERMEDIATE
Final Result of following Stepped Topography Tutorial
Shifting lists and Constructing Domain
GH Definition for Stepped Topography Tutorial

This tutorial combines the 4 operations above; extrude, loft, contour and project. To reduce the complexity and to avoid using data trees we generate the contours by intersection the surface with series of boxes rather than using the contour command.


Set the Curves and Loft a Surface between the curves, as demonstrated previously. Using the Surface » Primitive » BoundingBox command, create a BoundingBox. The BoundingBox finds the minimal box paralel to a coordinate system plane that includes all input geometry, finding the extreme corners of the geometry. Because this definition is based on a bounding box, it only works if the input curves are paralel to the x-axis or y-axis in plan, aligned with the edges of the bounding box.


Once we have the BoundingBox, we need to divide the height of the Bounding Box based on the distance between contours. We can use a number slider for this. For example, if the distance between contours is 0.5, we need to place a box every 0.5 with a height of 0.5 (0-0.5, 0.5-1, 1-1.5, 1.5-2, 2-2.5, 2.5-3, etc.) untill the total height of the original Bounding Box is reached. If we want to keep the definition parametric, this series of numbers always needs to adjust according to the height of the bounding box. To find the height of the BoundingBox we use the Maths » Domain » Deconstruct Domain command. This gives the Start and End of a Domain, in this case the lowest and highest z-coordinates of the Bounding Box. When we divide Math » Operators » Division this by our distance between contours (0.5, in the example, or the Number Slider in the definition). We round to an integer (ceiling) by using the Math » Util » Round command and we add (+1) Math » Operators » Addition to include the last contour inside a bounding box as well.


We create a new box using the plane, x-, and y-coordinates from the previous box, but inserting a new domain for the z-coordinates of the new boxes. This domain is constructed by shifting the list Sets » List » Shift List (+1 and -1), taking out the first and last number of the list. In order to do so, Wrap should be set to 'False' and right-click 'Invert' in both cases.Construct the domain Maths » Domain » Construct Domain by plugging in the (-1) list into 'A' and the (+1) list into 'B'. The result will be a list of domains (0-0.5, 0.5-1, 1-1.5, 1.5-2, 2-2.5, 2.5-3, etc.) which we can insert in the z-coordinates for the boxes. Now you have a box at each specified contour level.


Now we find the intersection between the boxes and the input Surface using the Intersect » Physcial » Brep-Brep command, inserting the lofted Surface into 'A' and the boxes into 'B'.The result is a series of curves arranged by the correct height which we are going to project onto planes at the corresponding height. In order to do this, we first need to place planes at the correct height. To do this, we can use the same (-1) list component, which has the correct z-values for the planes. We place an horizontal XY-plane Vector » Plane » Unit XY-Plane and use the Transform » Euclidean » Move command. Connect a z-vector Vector » Vector » Unit Z to the Transform input and the XY-plane to the Geometry input. Once you load the (-1) list into the z-vector, you will have a plane located at the same height of each contour-line.


To ensure the projection of only one set of curves at the corresponding plane, we need to graft Sets » Tree » Graft Tree the planes before plugging them into the Transform » Affine » Project component. Clean the tree Sets » Tree » Clean Tree to get rid of 'nulls'. Use Surface » Freeform » Boundary Surface component to make planar surfaces.


To conclude the stepped topography we can Surface » Freeform » Extrude the surfaces using the Number Slider that determines the distance between contours. Connect a z-vector Vector » Vector » Unit Z into the Distance input on the extrude component. Plug the contour distances Number Slider into the z-vector.

Personal tools
Actions
Navigation
Tools