hopific logo blue

How to Remove Duplicate Points in Grasshopper – Tutorial

How to remove duplicate points in Grasshopper
Quick links

Dealing with duplicate points in Grasshopper can be frustrating. They are hard to spot and can disrupt lists, leading to unexpected outcomes. In Grasshopper, we can find and remove duplicate points with the Cull Duplicates component.

The Cull Duplicates component finds duplicate points in a list and then either removes all duplicates, averages out the duplicate points, or just leaves one of the them. This post will guide you on how to use it effectively.

The Cull Duplicates Component

To start, let’s add the Cull Duplicates component to our canvas. It’s located in the ‘Vector‘ component tab, in the ‘Point‘ group.

Adding the Cull Duplicates component in Grasshopper

To add it using the component search bar, double-click anywhere on the canvas, type ‘cull duplicates’ and select the component.

Quick-Adding the Cull Duplicates component in Grasshopper

Cull Duplicates – Inputs and Outputs Explained

Let’s take a closer look at the component. The component has two inputs:

  • a list of Points (P)
  • and a Tolerance (T)
Inputs and Outputs of the Cull Duplicates component

The Cull Duplicates component will check the list of points we connect in the Points (P) input for duplicates.

But what’s a duplicate point, in Rhino’s terms? It’s two (or more) points that are within a certain tolerance or distance from each other. The Tolerance (T) input controls how close points can get before being considered duplicates.

The Tolerance (T) is a distance value. Any points in the Points (P) list that are closer than that distance, will be regarded ‘duplicates’. The Tolerance (T) comes with a default value of 0.1, which usually works ‘out of the box’.

Note: Keep in mind that the Cull Duplicates component will only remove duplicates within a list. If we connect a data tree with several branches, the duplicates will only be removed within each individual branch! So, to remove all duplicates across branches, flatten the input first.

Cull Duplicates Outputs

Using the inputs we provided, the Cull Duplicates component has now identified the duplicate points. It provides three outputs:

Inputs and Outputs of the Cull Duplicates component
  • The Culled Points (P)
  • The Indices (I) of the Culled Points
  • and the Valence (V), or the number of input points represented by the output points.

The first output Culled Points (P) is clear: it contains the cleaned point list without duplicates.

The Indices (I) output contains a list of the indices of all the points that remain after the duplicates have been culled (removed). More on how this information can be used later in this article.

The Valence (V) is a list of numbers that shows the number of input points represented by the remaining output points. Truth be told, I’ve never found a practical use for it in a decade of using Grasshopper.

Culling Options: Leave One, Cull All & Average Explained

But there’s more to this component than just inputs and outputs! We can choose how the component removes the duplicate points it finds. The black label on the bottom edge of the component displays the current culling mode (by default, ‘Average‘).

We can access the culling options by right-clicking on the component.

Controlling the Culling Option

We can choose between:

  • Leave One
  • Cull All
  • Average

To understand how these modes work, it’s important to know that points within the specified Tolerance (T) are grouped by proximity. A duplicate group can have just two points or multiple points. The Culling Modes control the output for each of these duplicate groups.

Leave one” will keep one of the duplicate points. We don’t get to choose which one.

Cull Duplicates - Leave One Option

Cull all” will delete all duplicate points.

Cull Duplicates - Cull All Option

Average” (the default) will average the duplicate point group and output one new point.

Cull Duplicates - Average Option

In most cases, we’ll want to use the “Leave One” option. This ensures we keep one element and just remove any duplicates.

How to Use the Cull Duplicates Component to Remove Duplicate Surfaces or Curves

The Cull Duplicates in Grasshopper can do more than just remove duplicate points: it can also remove duplicate curves, surfaces, and even volumes.

Here’s how:

  • Step 1: Get a representative point for each geometry. This can be the curve middle, or the surface centroid for example (using the Area component).
  • Step 2: Use the Cull Duplicates component as describes in this article.
  • Step 3: Use the Indices of Culled Points (I) output, it contains all the indices of the geometry to keep. You can filter the original geometry list by using a List Item component.

For a more in-depth explanation and example, check out the following post: How to Remove Duplicate Curves.

Happy designing!

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.