How to Close a Curve in Grasshopper 

Contents

To close a curve in Grasshopper we need to add an additional curve segment and then join it with the original curve.

How we close it depends on how the curve was created, and whether the added segment is a line or a smooth curve. We’ll go through the different scenarios one by one.

But let start with at the beginning, how can we check whether a curve is closed or not in Grasshopper?

How to check whether a curve is closed or not

To check whether a curve is open or closed we can use the Closed (Cls) component. If we feed in our curves, the first output will tell us whether the curve is open or closed with a Boolean True or False value.

Checking whether a curve is closed or not with a Closed (Cls) Grasshopper component,

We can use these Boolean values to process a list of curves to only keep the open or closed curves, with the help of a Cull Pattern component. We could do this to find the open curves in the list and the proceed to close them with one of techniques below.

Creating a closed curve from control points

If we are creating a curve from a set of points, we can close it right away.

All curve creation components based on control points, like the NURBS curve component, the interpolate component and the polyline component have an option that allows us to close the curve upon creation.

We can do so by adjusting one of the component inputs after connecting our points.

The input in question is called ‘Periodic’ for the NURBS and Interpolate components and simply ‘Closed’ for the Polyline component.

If a curve is periodic, it means that the curve is closed in a loop. For NURBS curves this means that the curvature will be smooth across the start and endpoints.

To change the Periodic/Closed option, we have to specify a Boolean value: either True (0) or False (1), and feed it into its input. We can set the value with a Boolean Toggle component.

From left to right: NURBS Curve, Interpolated Curve, Polyline.
Different curve creation components. Closing the curve is achieved by setting the ‘periodic’/’closed’ option to True.

If we want to ‘set it and forget it’ we right-click on the input and set the Boolean value there. To do that we right-click on the input, go to ‘Set Boolean’ and choose the value we want.

Manually setting the ‘periodic’ option inside the component input directly.

Transform Your Architectural Designs with Grasshopper.

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

Closing an open curve

If the curve we are aiming to close is a referenced curve or if the curve is the output of a sequence of Grasshopper components, we can’t change the periodic property anymore and we need to manually connect the two endpoints of the curve.

Here we have several option, depending on our design intent:

  1. connecting the curve endpoints with a line
  2. blending the curve at both ends

Connecting the curve endpoints with a line

If the curve we want to close is a polyline, we can close it by adding a line segment and joining the curves.

To do this we need to get the end points of the curve with the End Points component. It will output the start and end points of the curve.

Next we’ll use a Line component and feed the Start and Endpoint into the A and B input of the Line component. A and B are the points that will be connected.

At this point we’ve added a line segment, but we are still dealing with two separate curves. The last step is to join them into one. Add a JoinCurves component and connect both the original curve and the newly created line segment to it. (We can connect multiple inputs by holding down Shift as we drag the second wire.)

Open Curve > Curve end points > Create line from two points > Join curves
Closing an open curve in Grasshopper with a line segment.

The result is a single, closed curve.

Blending curves in Grasshopper

If we are dealing with non-linear open curves, be it organic curves or circles, adding a line segment won’t get us the result we want.

To close a NURBS curve in Grasshopper in a way that keeps the curve continuity we can use the Blend Curves component.

The blend curves component is usually used to blend to separate curves, but we can use it to blend the ends of one and the same curve as well.

Here is how it works:

Simply feed the open curve into both the A and B input of the blend curve component. Grasshopper describes theses inputs as the ‘first’ and ‘second’ curve to blend, but if we connect the same curve, Grasshopper will pick the two open ends to blend.

The following two inputs, called the ‘bulge factor’ at A and B is used to control the curvature of the blend on both curve ends. The default value is usually too harsh, in the example below I set it to 0.50 to get a natural transition. Once again, connect the same slider value to both the Fa and the Fb input.

Curve Continuity

The last input of the Blend Curve component allows us to specify to continuity we want the blend to achieve. By right-clicking on this input we can choose between the following:

  • Position
  • Tangency
  • Curvature

Position means that there won’t be any curvature continuity, the blend will effectively be a straight line between the two endpoints of the open curve.

Tangency and Curvature both create a smoother transition, the difference is that with tangential continuity the tangents at the connection points between the existing and the new curve match, but the curvature won’t, whereas curvature continuity ensures a perfectly smooth transition. If in doubt, pick ‘Curvature’, it will result in a cleaner curve.

Tip: We can also use the Blend Curve component with the Curvature set to Position to close polylines – it’s a clunkier component, but we need one component fewer than by closing the curve with a line segment. Your choice!

Conclusion

As you’ve seen there are many different ways of closing a curve in Grasshopper. Which one to pick depends on when and how you want to close the curve.

Closing an open curve is usually the kind of problem we run into if something went wrong and we are trying to fix it. Oftentimes this can be avoided by finding a cleaner logic of creating curves to begin with. If that’s not possible, one of the techniques mentioned above should fix it!

Good luck!

Improve your Grasshopper Skills quickly

Download a free copy of our Learning Roadmap,

“Mastering Grasshopper”

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.

More Great Reads