How to Extrude a Curve in Grasshopper – Tutorial for Beginners

Extrude along Curve in Grasshopper
Quick links

If you come from modeling in Rhino, there’s nothing more natural than extruding a curve. But as soon as you try and do it in Grasshopper, you realize things look quite different! There are two main methods to extrude a curve in Grasshopper: extruding using vectors or using other curves. In this post, we’ll look at both methods using step-by-step instructions.

Let’s dive in!

Extruding a Curve Along a Vector

The Extrude component is one of the most basic but also most powerful components in Grasshopper. It allows us to turn curves into surfaces and surfaces into volumes, a key operation when fleshing out our scripts.

To add the Extrude component to the canvas, double-click into the empty Grasshopper canvas, type ‘Extrude‘, and click on the first result, at the bottom of the list.

Add an Extrude component to the canvas by typing 'Extrude'
Add an Extrude component to the canvas by typing ‘Extrude’

The component looks deceivingly simple. The first input B asks for the curve or surface to be extruded, and the second input D (from extrusion direction) for an extrusion vector.

To fully understand how the Extrude component works, we need to understand how vectors work. Here are the essentials:

Understanding Vectors in Grasshopper

A vector has two essential properties:

  • direction
  • length
The two properties of a vector in Grasshopper: direction and length.
The two properties of a vector in Grasshopper: direction and length.

In Rhino we never encounter vectors. When we extrude or move objects, we define the movement with two clicks: one click at the starting point, where we want to move the object from, and one click at the endpoint, where we want the object to be moved to.

Rhino takes care of everything else and moves the object to the desired location.

Moving an object in Rhino, the two clicks actually define a vector.
Moving an object in Rhino, the two clicks actually define a vector.

In essence, with our two clicks we are defining a vector: we are defining the direction by defining a start and endpoint and the length is the shortest distance between the two points.

Since we can’t interact with geometries directly in Grasshopper, we have to construct vectors to move and extrude curves.

We can create and manipulate vectors in a number of ways in Grasshopper:

Improve your Grasshopper Skills quickly

Download a free copy of our Learning Roadmap,

“Mastering Grasshopper”

Defining a vector through X, Y and Z coordinates

By definition a vector can be described with three numbers: the X, Y and Z coordinates. These coordinates allow us to describe a direction in relation to the world origin. The origin will be the starting point of the vector, and the three coordinates will describe the location of the endpoint. As a result, we get both the direction as well as the length.

Defining a vector through X, Y and Z coordinates.
Defining a vector through X, Y and Z coordinates.

To add a X, Y, Z Vector component, double click onto the canvas and type ‘Vector XYZ‘.

Type 'Vector XYZ' to add the component.
Type ‘Vector XYZ’ to add the component.

By specifying all three coordinates, for example with three separate Number Sliders, we can describe virtually any possible direction, since we can also use negative coordinate values.

Provide three different slider values to build a custom vector.
Provide three different slider values to build a custom vector.

While math enthusiasts may like this way of creating vectors, it is of little practical use when modeling in Grasshopper. 3D models are rarely completely aligned with the world coordinate system, and if they are not, figuring out the correct numbers to define a particular direction can get very complicated.

Another disadvantage of this method is that the length is purely a consequence of our three coordinates – it’s the distance from the origin to the point we are describing with our three coordinates.

Not very helpful if we want to control how far we want to move or extrude an object.

Using ‘readymade’ unit vectors

If we just want to extrude a curve along one of the main coordinate system axis, we can use unit vectors. We can add them to our script by double-clicking on the canvas and typing ‘Unit X’, ‘Unit Y’ or ‘Unit Z’.

Type 'Unit' + the coordinate direction you need to add a Unit vector.
Type ‘Unit’ + the coordinate direction you need to add a Unit vector.

These ready-to-use vectors are vectors with a locked, predefined direction: they will point in the X, Y or Z direction respectively.

Unit X, Y and Z vectors visualized.
Unit X, Y and Z vectors visualized.

The only thing we can change is the length of the vector. We can define the length by providing a number to the only input the components have, called Factor (F). By default these unit vectors come with a length of 1. Any number we connect to the Factor (F) input will define the curve’s length.

Plug a number into the 'Factor' input of Unit vector components to control the length of the vector.
Plug a number into the ‘Factor’ input of Unit vector components to control the length of the vector.

Using unit vectors to extrude curves in Grasshopper can be very useful when our models are aligned with the main coordinate system.

Regardless of the orientation, the Unit-Z component will be very useful anytime we want to extrude a curve vertically, whether it be up or down.

If we just want to extrude a curve vertically, using the Extrude component combined with the Unit-Z component and a number slider that defines the extrusion length, is the most effective way.

Example of a simple extrusion with a Unit Z vector and a custom extrusion height.
Example of a simple extrusion with a Unit Z vector and a custom extrusion height.

Defining a Vector with Two Points

Grasshopper offers a component that allows us to create a vector in the same way we would when moving objects in the Rhino viewport: by defining a start and an endpoint.

The component is called ‘Vector 2Pt’, type the name into the search bar to add it.

Type 'Vector 2Pt' to add the component.
Type ‘Vector 2Pt’ to add the component.

The component has three inputs: the first two are points. The first point will be the starting point, and the second the endpoint of the vector. The outputs are the resulting vector as well as the length of the resulting vector.

A Vector 2Pt component in action.
A Vector 2Pt component in action.

With third input ‘U’ which stands for unitize, we can reset the length of the vector to a length of 1, in the direction we specify with the two points. By default this option is set to ‘False’, we can right-click on the input, go to ‘Set Boolean’ and toggle the value there.

This way of defining vectors is one of the more intuitive, because it is similar to the way we define extrusions in Rhino.

Controlling Extrusion Length with the Amplitude Component

In most cases we want to extrude a curve along the direction of another curve in our Grasshopper script. But in many cases we are we still want to be able to specify our own extrusion length.

To do that we can use a component called ‘Amplitude‘. The name of the component refers to the fact that we can define the length (or amplitude) of a vector.

Simply type ‘Amplitude’ into the component search bar to find it and add it to the canvas.

Type 'Amplitude' to add an amplitude component to the canvas.
Type ‘Amplitude’ to add an amplitude component to the canvas.

The component has two inputs: the vector to use for the direction and the amplitude or length we want our vector to be.

Here is where it gets interesting: for the vector defining the direction we can use any vector from the methods mentioned above, but we can also plug in any straight curve. The line is automatically converted into a vector by the component. This works because a straight line shares the same properties as vectors: it has a direction defined by the start and endpoint and a length.

Although the component won’t throw an error message if we provide a non-linear curve for the vector input, it will result in unpredictable outputs, so make sure to use straight lines only.

See a simple example below: In this example we have surface we want to extrude and a straight, vertical curve. Extruding a surface will lead to a polysurface or Brep. By feeding the curve into the first input of the Amplitude component we can specify the extrusion direction, and by adding a number slider to the second input, we specify the length of the extrusion in that direction.

Example of using the Amplitude component and a straight curve as vector.
Example of using the Amplitude component and a straight curve as vector.

Extrude Along Curve in Grasshopper 

If we extrude a curve with a vector in Grasshopper, we’ll always be limited to straight extrusions due to the nature of vectors. If we want to extrude a curve with something other than a straight line, like a smooth curve, we can do that by extruding along another curve.

The component to do that is ‘Extrude Along‘. You can find it by double-clicking onto the blank canvas and typing its name.

Type 'Extrude Along' into the search bar to add the extrude along curve Grasshopper component.
Type ‘Extrude Along’ into the search bar to add the extrude along curve Grasshopper component.

Much like its Rhino counterpart, this component will extrude a curve along another curve. The inputs are two:

  • the curve to extrude
  • and the curve to extrude along.

The order is important here: The focus is on the first input, the curve to be extruded. The second input, the extrusion curve can actually be anywhere in the document, it just describes the extrusion trajectory of the base curve, it will not be directly involved in the creation of the surface, like it would be in a loft for example.

I still recommend to place the extrusion curve at the beginning of the base curve, as shown in the example below. That way you’ll have an easier time controlling the result.

Always be aware of the curve direction of the extrusion curve to avoid unexpected results.

Extrude along curve with a smooth curve.
Extrude along curve with a smooth curve.

Extrude along curve with a straight curve.
Extrude along curve with a straight curve.

While this component does create a complex surface with just two curves, it does lack ways to fully control the output. In many cases, you can generate the same output with a combination of offsets and lofts, which gives you better control.

Concluding Thoughts

In conclusion, extruding a curve in Grasshopper is a crucial operation that allows you to turn curves into surfaces and surfaces into volumes. There are two ways to extrude a curve in Grasshopper, extruding with a vector or extruding with a curve. In both cases we can control the direction of the extrusion, the length and the extrusion trajectory.

By understanding the basics of vectors and using the right technique for your needs, you can easily achieve the desired result and take your modeling skills to the next level.

If you want to learn more about Grasshopper, check out Grasshopper Pro – our online course tailor-made for architects. The course will fast-track your learnings by teaching you the exact techniques the leading architecture firms world-wide use to create outstanding designs!

Happy designing!

Transform Your Architectural Designs with Grasshopper.

Master Grasshopper from Scratch and Apply Advanced Techniques in Your Architectural Designs.

Like this article?
Share on LinkedIn
Picture of Thomas Tait
Thomas Tait
Architect at Snøhetta and Head Instructor @ Hopific (or, in plain English, I help designers use Grasshopper to supercharge their designs.
Ready to Dive into Grasshopper? Grab Your Free Ebook!

Accelerate Your Learning and Get Up and Running Quickly.